-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
eth_getProof
implementation returns invalid code hash
#28355
Comments
Wonky! The comment and clause here is so strange -- I don't even.. https://github.com/ethereum/go-ethereum/blob/master/internal/ethapi/api.go#L705 Hm, seems I reacted to it at the time too, but I guess I eventually just accepted it with a shrug: #17737 (comment) . We should just get the codehash unconditionally -- there's not even any reason to avoid it, internally we've already loaded the account from db, so it's not even an extra lookup.
|
It would be highly appreciated if you could test against #28357, and see if it fixes it for you. |
This change fixes #28355, where eth_getProof failed to return the correct codehash under certain conditions. This PR changes the logic to unconditionally look up the codehash, and also adds some more tests.
The example described in the issue now seems to work for me 👍 |
Thanks for verifying! |
This change fixes ethereum#28355, where eth_getProof failed to return the correct codehash under certain conditions. This PR changes the logic to unconditionally look up the codehash, and also adds some more tests.
Description
When
eth_getProof
is called for an account with an empty storage trie (storageTrie == nil
), it always returns the empty code hash, even if the code is not empty.Steps to reproduce the behaviour
An example of such an account would be contract 0xb55ac2656c53ccdc3b8218f86b5595ac88ad4752 that gets created in block 16044617. Thus, calling
eth_getProof
on this combination will result in the described problem:Actual behaviour
The previous command returns
Verification of this result against the provided
accountProof
fails due to an invalid code hash.Expected behaviour
Calling the corresponding
eth_getCode
returns
Therefore, the
codeHash
returned byeth_getProof
should correspond to the hash of this result, i.e."codeHash": "0x197506d6551b948e13201746f78ba7bec7c6404eb9804b477e6203f31a4b9e66"
,instead.
By replacing the empty
codeHash
in the previous result ofeth_getProof
with this value, the proof can be verified, e.g:The text was updated successfully, but these errors were encountered: