-
Notifications
You must be signed in to change notification settings - Fork 20.3k
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
core/tracing: add system call callback when performing ProcessBeaconBlockRoot
#29355
core/tracing: add system call callback when performing ProcessBeaconBlockRoot
#29355
Conversation
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 thanks!
EDIT: why not just use the fact that the tx sender is a magic system sender, and use that to distinguish? |
The reason we added this is the tracer will be surprised to see a call frame enter outside of a tx. It's true that |
I'm a little skeptical of the need for this. @maoueh could you elaborate on your intended use case? And if you're using EVM tracing to build an external DB of data, how do you deal with withdrawals which are directly applied to the state? I could imagine that other downstream chains using go-ethereum might appreciate these modifications the tracer API though if they have developed more complex system calls. |
@lightclient That is totally correct. Live tracer has an interest to whatever make state changes to the chain which is the case here with beacon root. The EVM call that is being made is going to trace a We have a real use case today for this like you said which is a virtual archive node fed by state changes (storage,balance,nonce,etc.) generated by our Firehose tracer. We are able to then implement Completely omitting those tracing is contrary to the live tracer spirit IMO. It's true that I could infer from the block header and generate a StorageChange "manually" but having proper marker enable me to right now to support any future "system call" doing any kind of state changes. About withdrawals, they generate a |
Now, how this can be done, there is different possibilities of course. I think the marker Quite open to check other possibilities, a specific Just a |
@lightclient Just saw your other PR, going to take a look. |
For extra clarity, actually right now I get all that data I need from the live tracer even without this PR because the EVM and StateDB are still correctly traced so storage changes are properly sent. I'm just unable to group them into a "special" bucket "system_call" which is more contextual. |
Thanks @maoueh, I think I understand now. This PR seems reasonable. |
I would be fine with this too, but it seems more and more "system call" are considered from that I saw in @lightclient PR. I think it would make sense to have something that works well with all those. Of course not alway easy to design future proof API from the start. It would be fine waiting a bit too to ensure we correctly cover other currently planned system calls. |
Closed by mistake |
It would work for all of them -- they all use the same magic system sender, don't they? |
ProcessBeaconBlockRoot
ProcessBeaconBlockRoot
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.
Yeah ok
|
Hmm, I'll check that |
Added a `start/end` system where tracer can be notified that processing of some Ethereum system calls is starting processing and also notifies it when the processing has completed. Doing a `start/end` for system call will enable tracers to "route" incoming next tracing events to go to a separate bucket than other EVM calls. Those not interested by this fact can simply avoid registering the hooks. The EVM call is going to be traced normally afterward between the signals provided by those 2 new hooks but outside of a transaction context `OnTxStart/End`. That something implementors of live tracers will need to be aware of (since only "trx tracers" are not concerned by `ProcessBeaconRoot`). One thing of importance for tracers
c02c1d9
to
8bec7ef
Compare
@holiman Can you make the CI re-run? Locally I cannot see any lints error using |
The CI is ok now. Please add the new hooks to the changelog in core/tracing/changelog.md |
Updated the changelog here s1na@827f13c but can't push it to the PR directly as the organization permissions don't allow it. |
ProcessBeaconBlockRoot
ProcessBeaconBlockRoot
…BlockRoot` (ethereum#29355) Added a start/end system where tracer can be notified that processing of some Ethereum system calls is starting processing and also notifies it when the processing has completed. Doing a start/end for system call will enable tracers to "route" incoming next tracing events to go to a separate bucket than other EVM calls. Those not interested by this fact can simply avoid registering the hooks. The EVM call is going to be traced normally afterward between the signals provided by those 2 new hooks but outside of a transaction context OnTxStart/End. That something implementors of live tracers will need to be aware of (since only "trx tracers" are not concerned by ProcessBeaconRoot). --------- Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
…BlockRoot` (ethereum#29355) Added a start/end system where tracer can be notified that processing of some Ethereum system calls is starting processing and also notifies it when the processing has completed. Doing a start/end for system call will enable tracers to "route" incoming next tracing events to go to a separate bucket than other EVM calls. Those not interested by this fact can simply avoid registering the hooks. The EVM call is going to be traced normally afterward between the signals provided by those 2 new hooks but outside of a transaction context OnTxStart/End. That something implementors of live tracers will need to be aware of (since only "trx tracers" are not concerned by ProcessBeaconRoot). --------- Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Added a
start/end
system where tracer can be notified that processing of some Ethereum system calls is starting processing and also notifies it when the processing has completed.Doing a
start/end
for system call will enable tracers to "route" incoming next tracing events to go to a separate bucket than other EVM calls. Those not interested by this fact can simply avoid registering the hooks.The EVM call is going to be traced normally afterward between the signals provided by those 2 new hooks but outside of a transaction context
OnTxStart/End
. That something implementors of live tracers will need to be aware of (since only "trx tracers" are not concerned byProcessBeaconRoot
).I've looked into providing some kind of unit tests for that but it prove harder than anticipated. Since this has a minimal implementation surface, it think it's fine but I can take a second look if deemed required.