Skip to content
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: EXTCODEHASH and SELFDESTRUCT #1730

Open
raulk opened this issue Mar 27, 2023 · 1 comment
Open

EVM: EXTCODEHASH and SELFDESTRUCT #1730

raulk opened this issue Mar 27, 2023 · 1 comment

Comments

@raulk
Copy link
Member

raulk commented Mar 27, 2023

When a contract self-destructs, it marks itself as dead. If a subsequent transaction calls EXTCODEHASH, we return whatever the EVM actor returned from GetBytecodeHash. For dead contracts, this is the EMPTY hash. I believe we modelled this after EIP-1052.

However, we have reports from the community saying that this behaviour diverges from Ethereum, who returns 0 when calling EXTCODEHASH on a self-destructed contract on a subsequent transaction.

Apprently this is the result of both https://eips.ethereum.org/EIPS/eip-161 and https://eips.ethereum.org/EIPS/eip-1052.

@Stebalien
Copy link
Member

Well, sort of. The EVM returns 0 until funds are first sent to the address, after which it returns EMPTY. We could introduce an "if dead and balance is 0" check, but any code relying on that fact is likely broken anyways.

Well, I guess it could be doing this as a short-cut to avoid calling the BALANCE instruction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants