Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add test case for precompile implementation #283

Merged
merged 3 commits into from
Jun 3, 2019
Merged

Conversation

axic
Copy link
Member

@axic axic commented May 14, 2019

Part of #259.

@axic axic requested a review from chfast May 14, 2019 12:19
@@ -44,7 +44,7 @@ static evmc_result execute_empty(const evmc_message* msg)
static evmc_result not_implemented()
{
auto result = evmc_result{};
result.status_code = EVMC_INTERNAL_ERROR;
result.status_code = EVMC_REJECTED;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this special case for non-supported code/message. I think it fits better.

Also we have the specialised EVMC_PRECOMPILE_FAILURE which we don't use in this example.

@axic axic force-pushed the test-precompiles branch 2 times, most recently from 9482672 to 1dc7098 Compare May 14, 2019 12:31
test/vmtester/tests.cpp Outdated Show resolved Hide resolved
EVMC_CREATE, 0, 0, 65536, destination, evmc_address{}, NULL, 0, evmc_uint256be{},
evmc_bytes32{}};

evmc_result result = vm->execute(vm, context, EVMC_MAX_REVISION, &msg, nullptr, 0);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should even set context to nullptr according to the EIP.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

Copy link
Member Author

@axic axic May 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it may be needed to check callvalue and sender.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are available in the message.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, that's great.

@axic
Copy link
Member Author

axic commented May 15, 2019

@chfast can I get a review?

EVMC_CREATE, 0, 0, 65536, destination, evmc_address{}, NULL, 0, evmc_uint256be{},
evmc_bytes32{}};

evmc_result result = vm->execute(vm, context, EVMC_MAX_REVISION, &msg, nullptr, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

test/vmtester/tests.cpp Outdated Show resolved Hide resolved
test/vmtester/tests.cpp Outdated Show resolved Hide resolved
@axic
Copy link
Member Author

axic commented Jun 2, 2019

I think now this should be in line with ethereum/EIPs#2003

@axic axic merged commit d7c6d08 into master Jun 3, 2019
@axic axic deleted the test-precompiles branch June 3, 2019 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants