Skip to content
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

support state override for debug_traceTransaction ("offchain events") #29423

Closed

Conversation

hananbeer
Copy link

@hananbeer hananbeer commented Apr 1, 2024

the debug_traceCall function supports state overrides, but debug_traceTransaction does not - it only accepts a transaction hash.

I wrote this originally as the backbone for generating "offchain events" (as developed by shadow / ghost logs)

to prevent confusion with nodes that don't implement this feature I created a distinct function debug_traceTransactionOverrides.
by overriding contracts bytecode it is possible to reexecute onchain transactions in different context, specifically to emit so called "offchain events" but not limited to this.

see equivalent implementations:

reth: paradigmxyz/reth#7410
erigon: erigontech/erigon#9847

@hananbeer hananbeer requested a review from s1na as a code owner April 1, 2024 11:00
@hananbeer hananbeer changed the title debug_traceTransaction with overrides support state override for debug_traceTransaction ("offchain events") Apr 1, 2024
@s1na
Copy link
Contributor

s1na commented Apr 1, 2024

Why is this not possible by using debug_traceCall and passing in all the tx args? traceCall has the option to produce the state of a (block, tx_id).

@hananbeer
Copy link
Author

Why is this not possible by using debug_traceCall and passing in all the tx args? traceCall has the option to produce the state of a (block, tx_id).

I haven't seen this in docs.
https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug

do you have reference?

@s1na
Copy link
Contributor

s1na commented Apr 1, 2024

I haven't seen this in docs.

Sorry about that. It seems we forgot to update the docs after adding it. This is the PR #28460 in question. So it's added to the last object which has the state and block overrides and tracing config.`

@jsvisa care to update the docs?

@jsvisa
Copy link
Contributor

jsvisa commented Apr 1, 2024

I haven't seen this in docs.

Sorry about that. It seems we forgot to update the docs after adding it. This is the PR #28460 in question. So it's added to the last object which has the state and block overrides and tracing config.`

@jsvisa care to update the docs?

Sure, I'll add it in the docs later today or tomorrow

@jsvisa
Copy link
Contributor

jsvisa commented Apr 2, 2024

@s1na how about let's also add TxIndex for the eth_call RPC, seems that is also a useful feature, wdyt.

@s1na
Copy link
Contributor

s1na commented Apr 2, 2024

@s1na how about let's also add TxIndex for the eth_call RPC, seems that is also a useful feature, wdyt.

@jsvisa Yep I think it makes sense. But with multicall around the corner I'd say it's a short term benefit anyway.

@hananbeer let me know if you tried the alternative I suggested and it works for you, then I'd go ahead and close this PR. We can keep the debug_traceTransaction a pure re-execution while adding allowing all override possibilities in traceCall.

@hananbeer
Copy link
Author

that solution is fine I just want it to be standardized across nodes :)
I guess we can close this pr.

@hananbeer hananbeer closed this Apr 2, 2024
@ArtificialPB
Copy link
Contributor

IMO, it still makes sense to support state overrides on both TraceTransaction and TraceBlock calls. This will allow tracing a whole block with injected events, with a single call, instead of doing a TraceCall for each tx in the block.

It would be a two-line code change: just move StateOverrides *ethapi.StateOverride from TraceCallConfig to TraceConfig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants