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. |
| 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.
@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.
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.
…27691) Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
…thereum#27691)" This reverts commit 99ee35c.
…thereum#27691)" This reverts commit 99ee35c.
…27691) Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
…7691 Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
…7691 Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
…7691 Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
We've run into a panic mentioned in #26845 inside the prestate tracer, not that #26848 fixed the issue in
callTracerbut did not fixed theprestateTracerissue 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
CaptureStatedoesn't return an error itself. Looks liketracers.GetMemoryCopyPaddedonly 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: