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

Different behavior of getCode* external calls vs. EXTCODE* opcodes #137

Open
tinchoabbate opened this issue Jan 28, 2025 · 0 comments
Open

Comments

@tinchoabbate
Copy link

Hey folks, I've been experimenting these past days with the testnet and the 7702 features. I think there's an inconsistent behavior in how the node is handling some calls vs. how the EVM is doing it.

According to EIP 7702, it is expected that "code reading operations to act only on the delegation designator", instead of following the delegation pointer.This affects opcodes EXTCODESIZE, EXTCODEHASH, EXTCODECOPY.

So let's see account 0x1aD89593788CC8cc570aD0f4257862171d7f46A8 which at the moment of writing is delegating to 0x35202a6e6317f3cc3a177eeee562d3bcda4a6fcc.

Querying the account's code, codesize and codehash using cast, I'm getting:

cast --version
cast 0.3.0 (5a8bd89 2024-12-20T08:46:21.564365462Z)

cast code 0x1aD89593788CC8cc570aD0f4257862171d7f46A8
0xef010035202a6e6317f3cc3a177eeee562d3bcda4a6fcc

cast codesize 0x1aD89593788CC8cc570aD0f4257862171d7f46A8
23

cast codehash 0x1aD89593788CC8cc570aD0f4257862171d7f46A8
0xf4947bb097e4eadc6155a0f41855edde889b4c0c2f28f6c43330d497e9640f76

As far as I understand, that's the expected behavior.

But, if I query the account through this on-chain Reader contract, it seems like it's following the address pointer and reading the values from the that account instead.

export READER=0x7e5355d2A8b8bcfFb9611695D3Db5409Ee596120

cast call $READER "getCode(address)" "0x1aD89593788CC8cc570aD0f4257862171d7f46A8"
0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000113660806040526004361015610018575b361561001657005b00...

cast call $READER "getCodesize(address)" "0x1aD89593788CC8cc570aD0f4257862171d7f46A8"
0x0000000000000000000000000000000000000000000000000000000000001136

cast call $READER "getCodehash(address)" "0x1aD89593788CC8cc570aD0f4257862171d7f46A8"
0xa490dbd91fa7986d52b36a8207eab9f97b52dc5fe35f312493426101abbf85dd

If I understand the EIP correctly, then these last on-chain results I'm getting are wrong, aren't they?

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

1 participant