-
Notifications
You must be signed in to change notification settings - Fork 775
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
Possible VM bug in EIP 3860 #1923
Comments
is the state reverted if it throws there? in that case the nonce wouldn't be updated in the trie. it does make sense to me that the check can be moved up a few lines before the nonce update. (edit: andrei clarified below in case of failure nonce should still be updated) looking further though, does it catch here first? is there a reason why we would have this check in two places ethereumjs-monorepo/packages/vm/src/evm/evm.ts Lines 319 to 331 in 2f42dcf
|
@gumb0 @jochem-brouwer is there anything we need to clarify in terms of error cases in the EIP? |
I think I just gotta see and test it, but if you CREATE/CREATE2 it first calls into EEI's @axic I think the EIP is clear enough here, but just to check, in case of the |
@axic nvm, just saw my comment on the |
Yes, we have not updated it yet, sorry.
When initcode exceeds limit, gas for initcode execution is not deducted (so only upfront charges are: base cost, memory expansion, hashing, initcode charge, too). Nonce is updated even in case of failure, which is similar to other creation errors like contract already existing or error during initcode execution. |
Not 100% sure, can this be closed (then please do)? |
The tests are not yet updated so we can't check against the existing implementation, so I'd say that this issue is not yet closed until the tests are finalized (the |
I think tests had correct behavior all along (no update expected), and EIP wording was updated recently ethereum/EIPs#5130 |
Can't completely judge this issue, can this be closed? //cc @jochem-brouwer |
(if so please do) |
Yep this is indeed resolved, should have closed before. |
Upon refactoring I stumbled across this:
ethereumjs-monorepo/packages/vm/src/evm/eei.ts
Line 634 in 2f42dcf
The contract nonce is updated, and then the
maxInitCodeSize
check is done. Before that there are checks on the nonce, call depth, and balance checks. It seems to me that if those checks are violated then no further gas is consumed (so not the providedgasLimit
is consumed) and the frame is directly returned. However upon themaxInitCodeSize
check it seems that the nonce is updated, so this state change dangles (and seems wrong to me). I think there are tests for this EIP somewhere in anethereum/tests
PR, I do recall testing it, but this situation was not caught (it should catch this as a state root error though, since the nonce is 1 too high if the maxInitCodeSize is violated..?)The text was updated successfully, but these errors were encountered: