-
Notifications
You must be signed in to change notification settings - Fork 773
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
EVM: non-empty "empty" account bugfixes #2383
Conversation
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. |
Awesome, I am glad that you helped to solve the problem so quickly! it looks like there are no more problems with it, gj |
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.
LGTM
Congrats, your important contribution to this open-source project has earned you a GitPOAP! GitPOAP: 2022 EthereumJS Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
Did you run https://github.com/ethereum/tests/blob/develop/src/GeneralStateTestsFiller/stExtCodeHash/extcodehashEmptyFiller.yml? It should have detected this bug because after EOA A sends its balance it should have a non-zero nonce. Or was the problem that the balance sending tx didn't raise the nonce? |
Thanks to @kchojn who found this bug. It was introduced by #2054
The PR fixes 4 bugs in our lib.
This is the situation:
EOA Account
A
has balanceB
, nonce 0, and (of course) no code and no storage.Account
A
now sends a Tx to contractC
and it forwards ALL balance upfront to pay for gas. (So, at this point, accountA
has 0 balance as it starts running the contract).Now JS has 3 bugs in these situations:
Calling
EXTCODEHASH
on account A will put 0 on the stack, not the empty code hash, because we report that account is empty.CALL
will chargecallNewAccount
gas when we forward nonzero amount from the contract back into the accountSELFDESTRUCT
will do the same if we selfdestruct nonzero value to account A.