-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
The prestateTracer
under diffMode
does not return all the storage diffs.
#30774
Comments
Seems empty values are explicitly removed: go-ethereum/eth/tracers/native/prestate.go Lines 234 to 237 in e3d61e6
would ask @s1na, @jsvisa for more context. Looks to always have been this way: #25422 |
Yeah, the cleared post storage were not included: go-ethereum/eth/tracers/native/prestate.go Lines 245 to 247 in e3d61e6
|
Honestly I also stumbled across this a few weeks ago. What was the reasoning for not just including a simple diff w/o removing zero values ? Is it okay to remove these clauses? |
@lightclient I think this is proposed by @s1na in #25422 (comment) But here, we can't distinguish the
As the other clients also follow geth's implementation, so I think let's keep as it is right now. We should add more instructions of the |
@lightclient after some digging, I think we should remove the if clause, because in post's state, if a slot is cleared that is also a modification, and a modification should be included in the diffMode, else user will think this slot is touched but without modification. |
I think it is correct as it stands. As a general rule:
In the case above a storage slot is cleared. You can tell this has happened because the value for that slot is returned in You have to take both of these maps together to build the whole picture. |
I see, I got @lum7na 's point, in his mind, he just set the value from x to y(here is zero), so he would require a slot diff of After all, I agree with @s1na, let me add more documents in the built-in tracers, sorry for the inconvenience. |
In the meanwhile, I was confused with this one in https://geth.ethereum.org/docs/developers/evm-tracing/built-in-tracers#prestate-tracer-config I think those fields were
In the second {
post: {
0x0000000000000000000000000000000000000000: {
balance: "0x233e16af82a"
},
0x040528d526a5dfc315bd990230f5aa285d168173: {
balance: "0x1"
},
0xf077b491b355e64048ce21e3a6fc4751eeea77fa: {
balance: "0x1a0555aa0149ed972",
nonce: 18
}
},
pre: {
0x0000000000000000000000000000000000000000: {
balance: "0x231420db60c"
},
0x040528d526a5dfc315bd990230f5aa285d168173: {
balance: "0x0",
code: "0x608060405260043610610033575f3560e01c80638702b6ed14610037578063d492613c1461004c578063d61f5f421461006b575b5f80fd5b61004a6100453660046101a9565b6100bd565b005b348015610057575f80fd5b5061004a6100663660046101a9565b610123565b348015610076575f80fd5b506040805180820182525f80825260209182018190528251808401909352548252600154908201526040805182518152602092830151928101929092520160405180910390f35b805f036101115760405162461bcd60e51b815260206004820152601a60248201527f44656e6f6d696e61746f722063616e6e6f74206265207a65726f00000000000060448201526064015b60405180910390fd5b5f5482900361011e575050565b505f55565b805f036101725760405162461bcd60e51b815260206004820152601a60248201527f44656e6f6d696e61746f722063616e6e6f74206265207a65726f0000000000006044820152606401610108565b5f8281556040516bffffffffffffffffffffffff193360601b16602082015260340160408051601f19818403019052525060015550565b5f80604083850312156101ba575f80fd5b5050803592602090910135915056fea2646970667358221220230f73022bcc1a72523beb8ef0ed6be1de384e721e28a402073c7761e1eb272e64736f6c63430008190033",
nonce: 1
},
0xf077b491b355e64048ce21e3a6fc4751eeea77fa: {
balance: "0x1a0555aa806de09d7",
nonce: 17
} The |
Hmm I see your point. Generally the rule I stated above applies to the account level and the storage slot level. It doesn't work for individual account fields. Since account balance/nonce etc are not created and destroyed in the same way. Thinking about it showing only the fields that are modified is probably cleaner. I'm not sure why we went with showing the full account in |
@lum7na Can you please confirm if this is still an issue for you? I will try to summarize why you're getting the result you are getting. The state transition that happens in your tx is as follows:
You are surprised that the state diff returned by the The reason is that this is considered a deletion of the storage slot. Deletions are represented in the state diff in this way where they only appear in Unless it is an issue I will close this ticket. @jsvisa has made some updates to the website docs to clarify this aspect. |
Based on #30774 (comment) Add more descrption for the `to` field in callTracer, and also refine the `diffMode` in prestateTracer: - Clarifies when ALL fields (`nonce`, `balance`, `code`) are included in the `pre` object - Adds detail about storage clearing behavior (zero value treatment) --------- Signed-off-by: jsvisa <delweng@gmail.com> Co-authored-by: Sina M <1591639+s1na@users.noreply.github.com>
Hello! I have resolved my issue. I just find the behavior here a bit strange, sometimes modifying to 0 does not mean deletion. |
Thanks for confirming. |
System information
Geth version: 1.14.12
OS & Version: Linux
Expected behavior
Hi! I'm trying to debug the transaction using
debug_traceTransaction
. I use the built-inprestateTracer
and enablediffMode
. I notice in thepost
section of the returned result, an address that should have been modified was ignored.The following modifications occurred after executing the transaction
setRational(-34342247582603709930262480515100532418408549587488298634819624648327228197968,54)
The
debug_traceTransaction
RPC call returned the correct result. However, if I continue to execute the transactionsetRational(0,-3686082785242131774829242764878224605745458421934561058325782450253198843211)
. The state modification should be:However,
debug_traceTransaction
only returned one modification in the post section:{'0x0000000000000000000000000000000000000000000000000000000000000001': '0xf7d9c0469c411e6b7d7863011ce7f3f258685e4ce99f5467f28c3598787722b5'}
. It ignored the modification of0x0000000000000000000000000000000000000000000000000000000000000000
.Result:
The text was updated successfully, but these errors were encountered: