-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
eth/tracers/native: panic on memory read in prestateTracer #27691
Conversation
#26848 was fixing multiple issues and it seems this one fell through the cracks. Thanks a lot for the detailed report and fix! We do in fact have a test case which is supposed to cover memory expansion of CREATE2 for the prestateTracer, but checking now and CREATE2 is not being traced because the op goes OOG. That does cover the fix we added in #26848 that opcodes shouldn't be processed if interpreter returned an error but not memory expansion as the name suggests. I'll check what's the issue in a bit. As for the error handling, I prefer |
So what was happening in that test is the memory expansion is so big the call was going OOG instead. I added a new test case which covers the memory padding case. Pushed directly to your PR. |
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
init, err := tracers.GetMemoryCopyPadded(scope.Memory, int64(offset.Uint64()), int64(size.Uint64())) | ||
if err != nil { | ||
log.Warn("failed to copy CREATE2 input", "err", err, "tracer", "prestateTracer", "offset", offset, "size", size) | ||
return |
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.
@s1na thinking about this more personally I'd prefer this panic(err)
instead of an early return, especially since the log warnings could get spammy under load since one line could be logged per RPC request triggering the issue.
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.
A panic
in an rpc call would not crash the server, just the method-handler, and the user would get some form of error message like "method handler crashed", if I recall correctly.
As I see it, we have these options for what to return to the user:
- A mostly correct trace + server-side printout indicating error
- No trace + "method handler crashed" error
- No trace + specific error about what happened and when ("failed to copy create2 input")
Not sure what my preference is. But previously, we settled for 1.
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
…27691) Co-authored-by: Sina Mahmoodi <[email protected]>
…thereum#27691)" This reverts commit 99ee35c.
…thereum#27691)" This reverts commit 99ee35c.
…27691) Co-authored-by: Sina Mahmoodi <[email protected]>
We've run into a panic mentioned in #26845 inside the prestate tracer, not that #26848 fixed the issue in
callTracer
but did not fixed theprestateTracer
issue also mentioned in the original issue, this PR goes back and fixes that as well.However, I'm not sure what I should do, if anything, with the returned error, since
CaptureState
doesn't return an error itself. Looks liketracers.GetMemoryCopyPadded
only really fails if the arguments are wrong or the copy is more than 1024KB, in which sae I personally think it's ok topanic(err)
but wanted to discuss before doing so.Also unsure if there should have been a unit test to cover this, FWIW this is the payload we hit on goerli to get a panic:
With this panic log: