Skip to content

rpc: expose block replay extension points - #26

Closed
einar-oplabs wants to merge 3 commits into
op-v2.6.0from
einar/rpc-replay-hooks-485
Closed

einar-oplabs wants to merge 3 commits into
op-v2.6.0from
einar/rpc-replay-hooks-485

Conversation

@einar-oplabs

@einar-oplabs einar-oplabs commented Oct 26, 2026 •

Copy link
Copy Markdown

Related to ethereum-optimism/protocol-team#485. Exposes replay hooks so downstream executors can apply transaction settlement while canonical and diagnostic block tracing retain distinct policies. Ethereum keeps its existing EVM and BAL behavior. Builds on George’s extension-point work in #25 as an independent replacement PR. Proposed upstream as paradigmxyz#28233, ported to main on evm2 types, and this PR now mirrors that shape so the eventual move to a release containing the upstream hooks is small: TracingCtx holds a borrowed ResultAndState, the database and an owned per-transaction inspector that take_inspector consumes, inspector_setup runs once per transaction, canonical and unvalidated block tracing are two methods, and the canonical transaction hook returns the same tuple as inspect_transaction_in_block. The remaining difference from upstream is the revm versus evm2 type names.

Targets op-v2.6.0 directly. The compression security backport (#27 and ethereum-optimism/reth-core#1) is no longer part of this change. To keep the fork’s cargo-deny gate green on this release line, the lockfile takes compatible patch releases for the advisories that have them (libz-sys 1.1.31, rustls-webpki 0.103.16, tokio 1.53.3, webpki-root-certs 1.0.10, webpki-roots 1.0.10, zstd-sys 2.1.2), and deny.toml documents ignores for the ones op-v2.6.0 cannot fix: zstd 0.13 and zstd-safe 7 are pinned by reth-zstd-compressors 0.7, whose patched releases need reth-core 0.8 and Rust 1.96, and crypto-bigint 0.5 has no patched release compatible with elliptic-curve 0.13. op-reth and op-reth-premium already resolve the same zstd and crypto-bigint versions. The Rust 1.95 minimum is preserved.

BREAKING CHANGE: explicitly typed block-trace callbacks must import TracingCtx from reth_rpc_eth_api::helpers::trace instead of alloy-evm, read ctx.result.result and ctx.result.state instead of ctx.result and ctx.state, and take_inspector takes the context by value. Canonical transaction tracing has a separate hook, so the existing supplied-environment helper keeps its contract.

Replay coverage uses seven standard Rust #[test] cases in trace/replay_tests.rs, included from trace/mod.rs, with a shared parity assertion helper. No test framework is added. The compact job uses real Git checkouts under act, preserving generated vectors while removing source files deleted between revisions.

Validation: the CI invocation cargo deny --log-level warn --all-features check all (cargo-deny 0.20.2) passes locally on 470cfb96. The RPC sources are unchanged from d87b1bb0, on which every functional CI check passed. The final commit pins the docs build to the nightly the book job already installs, adapted from upstream paradigmxyz#28220, because the unpinned cargo +nightly picked up the 2026-11-01 nightly that fails to compile boa_engine (rust-lang/rust#165263). All 30 checks passed on 831e5742 before the API alignment, including the cargo-deny gate and the book build. The branch is one signed commit, e6d32dc3, with the same tree as the previously pushed 6edc1bdb, plus a merge of op-v2.6.0 after #30 landed, so the diff against the base is now the RPC change alone; all 30 checks passed on e6d32dc3 and CI on the merged head is in progress.

Consumer: ethereum-optimism/optimism#23670, pinned at this head. Replace temporary source revisions with the validated merged fork tag before landing consumers.

ethereum-optimism/optimism#23795 adds opt-in check-lagoon sdm rpc detection against canonical receipts and transaction-boundary state; it does not fix clients. Correct receipts and balances alone do not establish tracing correctness. Release-artifact replay validation, including JS-tracer parity and coverage skips, remains outstanding.

@einar-oplabs einar-oplabs self-assigned this Oct 26, 2026
@einar-oplabs
einar-oplabs changed the base branch from op-v2.6.0 to einar/reth-compression-security-485 October 27, 2026 01:16
@einar-oplabs
einar-oplabs changed the base branch from einar/reth-compression-security-485 to op-v2.6.0 October 29, 2026 17:18
@einar-oplabs einar-oplabs changed the title rpc!: expose block replay extension points rpc: expose block replay extension points Oct 30, 2026
@einar-oplabs
einar-oplabs changed the base branch from op-v2.6.0 to einar/reth-compression-security-485 October 31, 2026 01:53
@einar-oplabs
einar-oplabs changed the base branch from einar/reth-compression-security-485 to op-v2.6.0 November 1, 2026 16:18
@einar-oplabs
einar-oplabs marked this pull request as ready for review November 2, 2026 04:12
Moves the debug_traceBlock*, debug_traceChain and debug_intermediateRoots
loops out of DebugApi, and the trace_* block loop out of
Trace::trace_block_until_with_inspector, into defaulted Trace methods, and
adds Trace::inspect_canonical_transaction_in_block for replaying the
signed transaction recorded at an index. Canonical and unvalidated block
tracing are separate methods so a downstream block executor only sees
blocks the node validated. The loop bodies move verbatim and Ethereum
behavior is unchanged; seven standard tests pin the moved loop against
alloy-evm's tracer, including callback errors, inspector handoff and the
truncation on a failed transaction.

The trace context mirrors upstream main: a borrowed `ResultAndState`, the
database and an owned per-transaction inspector that `take_inspector`
consumes, with `inspector_setup` invoked once per transaction.

BREAKING CHANGE: explicitly typed block-trace callbacks import
`TracingCtx` from `reth_rpc_eth_api::helpers::trace` instead of
alloy-evm, read `ctx.result.result` and `ctx.result.state`, and
`take_inspector` takes the context by value.

Also keeps the fork's required check green on op-v2.6.0: compatible
lockfile patch releases for libz-sys, rustls-webpki, tokio,
webpki-root-certs, webpki-roots and zstd-sys; documented deny.toml
ignores for the zstd advisories pinned by reth-core 0.7 and for
crypto-bigint RUSTSEC-2026-0387; the docs build pinned to the nightly the
book job installs; and real Git checkouts for the compact job under act.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@einar-oplabs
einar-oplabs force-pushed the einar/rpc-replay-hooks-485 branch from 6edc1bd to e6d32dc Compare November 2, 2026 04:28
einar-oplabs and others added 2 commits November 2, 2026 09:21
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@einar-oplabs

Copy link
Copy Markdown
Author

Superseded by the executor routing approach in paradigmxyz#28266

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.

1 participant