-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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: check the parent callframe's length before removing precompile call #27290
Conversation
…ompile call When using flat call tracer, by default, we remove the call to precompile. However, we should check the length of parent's callframe before doing that because when OnlyTopCall option is provided the call tracer's CaptureExit does not push the child's callframe to parent's callframe. As a result, the parent's callframe is empty, trying to remove the precompile call leads to index out of range. This commit checks the length of parent's callframe before removing precompile call.
Good find! I'm a bit torn on this. I feel like we should clear the config for the flat call tracer. For example Do you need OnlyTopCall for the flatCallTracer? or discovered this by accident? |
Yes, I also feel that call tracer configs are not intended to be used when flat call tracer is used. Our team does not use the OnlyTopCall for flatCallTracer, just find it during testing. So, do you prefer this solution, not pass the config from flat call tracer down to inner call tracer?
|
Nice find! For some stuff, I wouldn't suggest touching the base formatting as this might be useful for endusers consuming the Parity tracer in past. On the other hand, extending on top of this tracer feels welcoming, and About the I think it makes sense to have all the logic and base functionality coming from the |
Honestly I'd prefer to clear the config for now and only allow those options if someone asks for it. The reason we added the @minh-bq that patch looks good! |
@s1na yes that a valid point. It's wiser to do this in discussion with other clients when needed. |
// When OnlyTopCall is provided, the call tracer CaptureExit does | ||
// not push the child's callframe to parent's callframe so we don't | ||
// need to remove the call to precompile. | ||
if len(t.tracer.callstack[len(t.tracer.callstack)-1].Calls) == 0 { |
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.
Do you think the suggestion below will miss any edge cases in case the CallTracer.CaptureExit
gets modified? Probably the way you coded it is more safe.
if len(t.tracer.callstack[len(t.tracer.callstack)-1].Calls) == 0 { | |
if t.tracer.config.OnlyTopCall { |
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 suggestion looks good to me
Look like we prefer to clear the config passed to inner call tracer, don't want to edit this PR description and title for reference, I create another PR: #27304 for that implementation. |
When using flat call tracer, by default, we remove the call to precompile. However, we should check the length of parent's callframe before doing that because when OnlyTopCall option is provided the call tracer's CaptureExit does not push the child's callframe to parent's callframe. As a result, the parent's callframe is empty, trying to remove the precompile call leads to index out of range. This commit checks the length of parent's callframe before removing precompile call.