-
Notifications
You must be signed in to change notification settings - Fork 298
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
Implement SELFBALANCE opcode from EIP-1884 #24
Conversation
Codecov Report
@@ Coverage Diff @@
## master #24 +/- ##
========================================
+ Coverage 99.88% 100% +0.11%
========================================
Files 5 5
Lines 842 845 +3
Branches 109 109
========================================
+ Hits 841 845 +4
+ Misses 1 0 -1 |
The invalid opcode test is failing because |
Add |
Will make this one depend on ethereum/evmc#372 |
Rebased and fixed the previous issues, however now for some reason |
It just checks stack requirements earlier (at the beginning of the block) than instruction returns |
Rebased. |
TEST_F(evm_state, selfbalance) | ||
{ | ||
accounts[msg.destination].set_balance(0x0504030201); | ||
auto code = bytecode{} + push(1) + OP_SELFBALANCE + mstore(0) + ret(32 - 6, 6); |
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.
There's no argument to selfbalanace.
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.
But when OP_SELFBALANCE
is undefined, there is an argument missing to mstore(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.
But shouldn't it just abort because of invalid instruction?
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.
Only in naive implementation of EVM. Here we check stack requirements for the whole block of instructions before executing them.
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.
I get that, but the concept is wrong then. evmone fails with a strange error code on invalid input then?
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.
Not sure this concept you mean, but yes, it can return other error code.
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.
This suggest to me that evmone cannot handle badly formatted EVM input, which has a stack underflow.
Please add CHANGELOG entry. |
@chfast updated |
Ref https://eips.ethereum.org/EIPS/eip-1884
Need to actually add all the changes to EVMC apparently.