-
Notifications
You must be signed in to change notification settings - Fork 20.7k
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
tracers/prestate: always remove empty accounts from pre-state #31427
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
for addr, s := range t.pre { | ||
if s.empty { | ||
delete(t.pre, addr) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a potential variant that avoids to include all empty state accesses, since the client can assume if it isn't in the result then it is empty.
The variant that I would personally prefer is actually the opposite: always including empty accesses. Althought they are redundant as mentioned before, I like knowing those accesses actually happened. But this is more useful for some use cases that I want, and might be a bit unjustified for what the API tries to provide.
This is a good change thank you. Evidence is in the failing tests:
We can see that previously we had |
Ok noting that we are also emitting empty storage slots it seems. This is another inconsistency IMO.
This is what I'm leaning towards: clear all empty accounts and storage slots by default. Add option to include empties. Would that satisfy your use-case? Also: would you need only keys or also the values for empty accts? |
Cool, that would be useful as an option (disabled by default). I think a single option including both empty storage slots and empty accounts access might be the best. Feels a bit weird somebody would like only one but not the other. |
@s1na, would you like to work on top of this branch, or should I close the PR? |
Happy to work on top of your branch. |
I am creating this PR to continue my chat with @s1na about the prestate native tracer.
The current code only removes empty accounts from the prestate if they are created contracts. Any other added empty accounts are left for the prestate output.
A priori, this looked weird since I don't see a reason to keep any empty account in the returned pre-state. If the tracer always keeps empty accounts or always removes them, that sounds reasonable (although adding empty accounts doesn't add much value).
Adding empty accounts to
pre
still makes sense sincepre
is used forconfig.DiffMode==true
, so the pre vs. post diff can be generated.Even if removing all empty accounts after generating the (potentially) state diff sounds reasonable, this might be considered a breaking change, i.e., maybe some users assume non-created empty accounts appear in the output.
I am leaving this as a draft PR to continue the discussion here, as requested by @s1na.