-
Notifications
You must be signed in to change notification settings - Fork 770
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
VM: address consensus issue: tx goes OOG but refunds get applied anyways #1603
Conversation
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
This doesn't work, will stop here for now. The problem seems to be that we revert to old refund here, but this does not catch all errors which are not caught in this scope; if anything happens which makes a message scope revert then the entire refund should be forfeited. |
CC @winsvega we have encountered an consensus bug in this PR which is not covered in |
Hm, should be covered, lets check |
Here's the problem. We check if there's an execution error in This is all fine if we don't do additional error checks afterwards. For call frames, we dont do this, however, for create frames we do this and here lies the problem. In case that we throw an error over there, then we don't reset the refunds. Note that any error down the NOTE: there might be an uncovered edge case as well, in run interpreter in case of an error we also reset;
We might have to check what happens in case that in case we dont have enough gas to pay for code deposit, if we also revert the selfdestruct / logs correctly. |
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.
Looks good to me. One nigly change in the wording for the test to clarify what's happening that you can take or leave but awesome work getting a fix so quickly!
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.
Looks good to me.
Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
96d2173
ethereum/tests#1003 has found that the possible selfdestruct bug as described in #1605 is also present, will fix here. We probably also have the issue in #1605 with logs. |
…pcoming ethereum/tests CreateOOGFromEOARefunds_d13g0v0)
@jochem-brouwer So do we need to add some additional tests for these other cases regard logs/self-destruct? |
I could add tests, but since these test cases which I want are covered in the |
…epo into check-refund
Okay, ethereum/tests#1003 now has tests for both selfdestructs and logs into the contract creation context for cases where (0) contract gets deployed succesfully, (1) contract goes OOG due to invalid opcode, and (2) contract goes OOG because execution finishes but there is not enough gas left to deploy the code. Tests now pass after 2f33d13. We had the selfdestruct vulnerability, we did not have the log vulnerability. |
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.
amazing speed and execution on this, thank you everyone! lgtm
Closes #1601, closes #1604