-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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
cmd/evm: don't reuse state between iterations, show errors #30780
Conversation
…enchmark errors are captured and printed to output.
Co-authored-by: Martin HS <[email protected]>
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.
Some nits
Co-authored-by: Martin HS <[email protected]>
Co-authored-by: Martin HS <[email protected]>
Co-authored-by: Martin HS <[email protected]>
Co-authored-by: Martin HS <[email protected]>
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.
LGTM
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.
Even though you worked around the panic due to b.Fatalf
, I think it would still be more "correct" to also invoke testing.Init()
when you enter the if bench
clause.
// don't mutate the state! | ||
runtimeConfig.State = prestate.Copy() |
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.
Why was this done here?
This makes it impossible to re-use the state dump. The account still gets inserted however instead of an address I now see this in the state dump:
"pre(0xdfeeda06f79105a5aa975e5ef88e1b24d0062f31b5f42850e35d9cd4596df77e)": {
Which is wrong (should be the address) and means I can no longer take the state dump and execute another call based on the state dump.
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.
Could you please open an issue with this, so we wont forget about it
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.
Execution will modify the runtimeConfig.State
. We wanted to ensure that the same prestate is used for executing every benchmark iteration, so we copy it here.
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.
@jwasinger thanks for pointing this out, got it. #31151 fixes this by only copying it during benchmarks.
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.
@MariusVanDerWijden since the fix looks obvious to me I decided to open a small PR instead (#31151).
Reusing state between benchmark iterations resulted in inconsistent results across runs, which surfaced in #30778 .
If these errors are triggered again, they should be printed to output. To ensure that the code invoking
testing.Benchmark()
can catch and output these errors, and then exit: I replace calls tot.B.Fatalf
with setting an error which is consumed by the calling code.The same consistency checks should probably be applied to the state test benchmarker. I am figuring that out now.
closes #30778 .