-
Notifications
You must be signed in to change notification settings - Fork 310
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
Conversation
@@ -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; |
There was a problem hiding this comment.
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.
9482672
to
1dc7098
Compare
test/vmtester/tests.cpp
Outdated
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@chfast can I get a review? |
test/vmtester/tests.cpp
Outdated
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
0aad350
to
fd1eb3f
Compare
I think now this should be in line with ethereum/EIPs#2003 |
Part of #259.