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") #9847

Closed

Conversation

hananbeer
Copy link

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.

usage:

cast rpc debug_traceTransactionOverrides $txhash '{ "stateOverrides": { "$addr": { "code": "$bytecode" } } }'

eg for mainnet:

cast rpc debug_traceTransactionOverrides 0xc9ab90a1796613b0fbccb33827de583901d4c0775e89c0f25d604b7c3a71771e '{ "stateOverrides": { "0x0000001D0000F38CC10d0028474a9c180058B091": { "code": "0x6000ff" } } }' | jq .

see equivalent implementations:

geth: ethereum/go-ethereum#29423
reth: paradigmxyz/reth#7410

Copy link

sonarqubecloud bot commented Apr 1, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
3.2% Duplication on New Code (required ≤ 3%)
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@AskAlexSharov
Copy link
Collaborator

@hananbeer hi. Seems geth PR was closed: ethereum/go-ethereum#29423

@hananbeer
Copy link
Author

hananbeer commented Apr 2, 2024

@hananbeer hi. Seems geth PR was closed: ethereum/go-ethereum#29423

yes apparently someone implemented this feature in a similar way using debug_traceCall. (just days before me 😅 )
it seems this is also merged into erigon we can close this pr too.

(based on TxIndex existing in TraceConfig)
https://github.com/ledgerwatch/erigon/blob/devel/eth/tracers/api.go#L22

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.

2 participants