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

Ambiguity in debug_traceCall with PreStateTracer DiffMode = true #27208

Closed
georgewhewell opened this issue May 2, 2023 · 2 comments
Closed
Labels

Comments

@georgewhewell
Copy link

System information

Geth version: 1.11.5
CL client & version: e.g. [email protected]
OS & Version: Linux

Expected behaviour

When calling debug_traceCall with a transaction, I should receive a diff which shows me all changes made to storage when this tx is executed

Actual behaviour

When a storage slot is zeroed OR unchanged it is not included in the post output. There appears to be no way to disambiguate these two cases.

Steps to reproduce the behaviour

Check https://etherscan.io/tx/0x5ca691b0415722b95b596b2cfd45cee7572540e456accd8478445e40c86ab778#statechange
For the frxETH token, we can see that two storage slots were changed- one increased and one is zeroed.

When I check the trace output of this call:

❯ cat trace.json | jq '.result.pre."0x5e8422345238f34275888049021821e8e08caa1f".storage'
{
  "0x1a7ad90a4b0c412d59e4127bd2d2f5276514c60aee7c77da0d8c2b326ef7c489": "0x000000000000000000000000000000000000000000000ae7e214f3a3b33f4e37",
  "0xb953595e5003b3f7c54e53b6f59502915a6d381e159e09dbe5056b4bfbdaca80": "0x000000000000000000000000000000000000000000000002b2926891c6ddd518"
}

❯ cat trace.json | jq '.result.post."0x5e8422345238f34275888049021821e8e08caa1f".storage'
{
  "0x1a7ad90a4b0c412d59e4127bd2d2f5276514c60aee7c77da0d8c2b326ef7c489": "0x000000000000000000000000000000000000000000000aea94a75c357a1d234f"
}

There is only one slot in the post output, showing the slot that increased. The second changed slot (which was zeroed) is not included in the output.

From #25422 (comment) I can see this change was intentional, but I don't understand how it is trivial to fix this problem given that the output gives no indication as to why the slot is not included in post- it could either be unchanged by the tx or it could be zero'd

@s1na
Copy link
Contributor

s1na commented May 2, 2023

From #25422 (comment) I can see this change was intentional, but I don't understand how it is trivial to fix this problem given that the output gives no indication as to why the slot is not included in post- it could either be unchanged by the tx or it could be zero'd

This is not documented very well, but you will find the system in this comment: #25422 (comment).
For the case you mentioned the rule is: if it is included in pre and not in post means it was cleared. If it's not included in pre nor post then it has not been modified.

The intuition here is that this is a diff, a slot that hasn't been modified shouldn't be part of diff at all.

@georgewhewell
Copy link
Author

@s1na thanks for explanation! didn't realise unchanged were not present in pre

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

No branches or pull requests

2 participants