Repository navigation
rust!: Update reth to v2.7.0 - #24024
Merged
Merged
Conversation
Wiz Scan Summary
To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio. |
Following the guide for the reth v2.7.0 fork branch left gaps. Step 2 listed the fork's commits but not how to tell whether the target contains each one. Pick retained patches with -x, list each fork commit with its recorded sources, and check each upstream source with git merge-base --is-ancestor. Skip ci: commits, whose sources would wrongly mark the CI squash as contained, and decide fork-only commits by hand. The detour from step 2 to The reth fork and back to step 3 was only mentioned midway through step 3. Point to it where step 2 ends and from the end of the tagging steps. The fork's CI commit is the previous branch's CI commits squashed into one, but the guide did not say how to find or build it. List the CI commits from the branch tip, since CI-only fixes are untagged, then cherry-pick and squash them with a soft reset. Read the squash's code comments before the first push: some are instructions for the replay. Upstream edits its workflows in most releases: resolve each hunk to upstream's side and re-apply only our edits. It also adds steps without conflicts, some of which `act` cannot run, such as jobs that need a GitHub OIDC token. Count new id-token: write grants, list new actions and workflow files, and stub what `act` cannot run. Resolve a Cargo.lock conflict to the new base's lockfile and redo the advisory bumps that cargo deny reports, filtering its output to the advisory lines. Check formatting with the nightly lint.yml pins and the build before the first push, after which the ruleset turns every fix into a reviewed PR. The audit stops at the pinned tag, while the old branch and develop keep moving during an update. Check both again before pinning and before the PR leaves draft, including open PRs against the old branch. Step 8 asked to test "any vendored-workspace crate", which names nothing. Name the SP1 guest workspace, which `just test` does not cover, and the two checks that run without the guest ELFs: its lockfile and its crypto patches. Leave the guest tests to CI, which builds the ELFs first.
Pin the reth crates to the head of ethereum-optimism/reth#35, which stacks on ethereum-optimism/reth#34 on top of op-v2.7.0. Both are unmerged, so the pin is a rev until op-v2.7.0-0 is tagged. Sync the shared dependencies to the versions reth v2.7.0 requires: alloy 2.5.0, alloy-hardforks 0.4.9, reth-core 0.8.1, revm 43 and revm-inspectors 0.44. Adapt to the upstream API changes: - StateProviderDatabase now takes an EvmStateProvider (paradigmxyz/reth#27109). Wrap each provider with into_evm_state_provider, on a reference where it is used again. - CancelOnDrop moved from reth-revm to reth-tasks (paradigmxyz/reth#27466). - StateProviderFactory gained a Primitives type (paradigmxyz/reth#26923). Where a bound also names NodePrimitivesProvider, the debug witness API now says which one it means. - BlockAndReceipts holds SharedReceipts (paradigmxyz/reth#27427). - The e2e setup functions folded into E2ETestSetupBuilder (paradigmxyz/reth#27432). - MemoryOverlayStateProvider was removed in favour of the overlay manager (paradigmxyz/reth#26923). The test engine records every validated block in the manager it shares with its provider, so it now appends a block to its real parent with state_with_block_appended. The flashblock pending state does the same, but on the canonical anchor: a speculative block's parent is the pending block before it, which the overlay does not know. The next commit shows that this breaks for speculative builds.
A speculative flashblock build has a pending block as its parent, not the canonical head. Its bundle holds every write since the canonical anchor, and its header names the pending block before it as parent. The pending state used to layer that bundle on the anchor's state with MemoryOverlayStateProvider, which reth v2.7.0 removed. Its replacement, state_with_block_appended, takes the block's parent from the header and asserts that it matches the hash it was given. Passing the anchor fails that assertion, and the pending block before the tip is unknown to the overlay, so passing the real parent fails to resolve. Test the pending state of a tip built on another pending block. It panics on that assertion, so the test expects the panic until the pending state is fixed.
reth v2.7.0 removed MemoryOverlayStateProvider (paradigmxyz/reth#26923), and its replacement cannot open the pending state of a speculative flashblock build, as the previous commit shows. Vendor the v2.6.0 provider into reth-optimism-rpc and open the pending state with it as before: the tip's executed block on the canonical anchor's state, looked up by hash. The tip's bundle holds every write since the anchor, so the earlier pending blocks are not needed. The trait impls are unchanged from upstream. The rest fits the file to this crate: import paths, crate-private visibility and the lints that follow from it, and no default for the primitives type. #23998 will make the whole speculative chain available to the RPC. Appending that chain block by block would only work through reth if its API accepted a chain, so the overlay stays until then. The speculative test now passes, alongside a canonical case.
Re-verify every stale UPSTREAM-MIRROR tag against what the workspace now resolves, and advance each one: reth from rev:8d359d0 to rev:d7a863a, alloy-consensus and alloy-rpc-types-engine to 2.5.0, alloy-hardforks to 0.4.11, revm-context-interface to 43.0.2, and the other revm crates to 43.0.3. The sp1 BLS12-381 overrides were already behind before this bump, at revm-precompile 42.0.1. The Crypto trait and the arkworks backend they must match are unchanged up to 43.0.3; only the blst backend changed. Two mirrors needed more than a new version: - reth v2.7.0 adds --rpc-cache.max-bals-bytes. As the RpcStateCacheArgs mirror asks for new block access list flags, deny it like the other ones, since OP blocks carry no EIP-7928 BALs. - MemoryOverlayStateProviderRef::hashed_post_state no longer exists upstream (paradigmxyz/reth#26923), so the proofs buffer's copy of it becomes a port frozen at v2.6.0. Upstream's EthState::get_proof now resolves the state before taking a blocking thread. Note on the proofs-history copy why it doesn't need to: OpEthApi's pending state spawns no blocking work. The mirrors in the other changed upstream files are unchanged where they are mirrored, and the remaining files did not change at all.
reth v2.7.0 adds --rpc-cache.max-blocks-bytes, --rpc-cache.max-receipts-bytes, --rpc-cache.idle-timeout and --engine.backfill-threshold. It adds --rpc-cache.max-bals-bytes too, which op-reth denies and hides like the other block access list options. It lowers the default --rpc-cache.max-blocks from 5000 to 1000 and --rpc-cache.max-receipts from 2000 to 500, and turns --engine.sender-recovery-cache on by default, now taking an optional value to turn it off. --rpc.gascap now also caps eth_estimateGas.
develop's op-v2.6.0-2 carries upstream's iterator seek boundary fix (paradigmxyz/reth#28264), which v2.7.0 lacks. ethereum-optimism/reth#40 cherry-picks it onto ethereum-optimism/reth#35, so pin its head until op-v2.7.0-0 is tagged. Only the reth git source changes in Cargo.lock, and the SP1 guest workspace doesn't use reth. The fix only touches the trie node iterator, which no UPSTREAM-MIRROR covers, so the reth mirror tags move to the new rev unchanged.
aakoshh
force-pushed
the
af/23404-reth-v2.7.0
branch
from
November 10, 2026 10:21
854af0c to
8ebf1ff
Compare
The vendored MemoryOverlayStateProvider reserved capacity for the whole requested range in canonical_hashes_range, although it pushes at most one hash per in-memory block. A wide range such as 0..u64::MAX panics with a capacity overflow, and a range of a few billion blocks aborts on the allocation. Nothing calls it on the flashblock pending state today, but BlockHashReader requires it. Reserve one slot per in-memory block, as upstream's successor, OverlayStateProvider, doesn't preallocate either.
reth v2.7.0 adds a sender_recovery_cache field to EthApiCtx (paradigmxyz/reth#27368), so the offline tracing example in the node's rpc module no longer compiled. Pass the launch context's cache, as upstream's own RPC launch does.
op-will
marked this pull request as ready for review
November 10, 2026 19:03
develop now pins op-v2.6.0-4 (#23942), which carries ethereum-optimism/reth#37: RPC block replays through the block executor, which op-reth's SDM refund settlement depends on. Carry it onto op-v2.7.0 as ethereum-optimism/reth#41, stacked on ethereum-optimism/reth#40, and pin its head. Resolve the conflicts with #23942: - Cargo.toml and Cargo.lock: keep the op-v2.7.0 rev, now ethereum-optimism/reth#41's head. - UPDATING-RETH.md: keep both sides, and update "Carried patches" for op-v2.7.0: where ethereum-optimism/reth#37's carry conflicted on v2.7.0, and the trie seek boundary fix carried as ethereum-optimism/reth#40. - invalid_post_exec.rs: develop's crate::lagoon helpers in the E2ETestSetupBuilder call reth v2.7.0 needs. Adapt #23942's new tests to reth v2.7.0: trace_replayTransaction returns an optional TraceResultsWithTransactionHash, and StateProviderDatabase takes an EvmStateProvider. Advance the reth mirror tags; ethereum-optimism/reth#41 touches no mirrored symbol.
op-will
previously approved these changes
Nov 10, 2026
op-will
left a comment
Contributor
There was a problem hiding this comment.
LGTM. All inline comments are non-blocking; address them here or in a follow-up.
On your two review requests:
- Sender-recovery cache:
OpEvmConfigrecovers payload senders directly, so block execution never reads the cache. Deposits and0x7Dcan't reach it at ingress either, sinceOpPooledTransactionexcludes both.0x7D's signer is the constant zero address regardless. - Pending state:
OpEthApidoesn't overridelocal_pending_block_or_state, so pending state RPCs still reach the vendored overlay.
I didn't run the reth-update-reviewer sweep.
Use reth's state_with_block_appended for a pending tip built on the canonical anchor, and keep the vendored MemoryOverlayStateProvider only for a speculative tip, whose parent is another pending block. The common case then runs on reth's maintained overlay, and the copy only serves the windows where block import lags behind the flashblocks stream. Open the state on the blocking pool. Since paradigmxyz/reth#27415, callers resolve pending state before taking a blocking thread, so the database reads behind it would otherwise run on an async worker. Tag the local_pending_state override as an UPSTREAM-MIRROR, so the next bump re-checks it against upstream's default, which is where this change showed. Note on the proofs-history get_proof copy why it can still resolve state inside its task: pending never reaches it. Document that block hash lookups see only the speculative tip, and when the vendored copy can be deleted. Extend the pending state test with a storage write and a destroyed account, checked on both paths.
block_state only needs the requested block: the provider resolves its recorded ancestors through the shared overlay manager. Look it up directly instead of collecting every ancestor back to genesis, which grew with the chain on every call, and drop the anchor check, which opened a state provider to test that genesis exists. This also removes the expect on the collected chain.
The vendored MemoryOverlayStateProvider can go once reth lets op-reth fold the speculative flashblock chain through its overlay manager. Point the module doc at the issue that tracks that reth change.
clippy's iter_on_single_items rejects collecting a one-element array.
op-will
approved these changes
Nov 11, 2026
op-will
left a comment
Contributor
There was a problem hiding this comment.
Approving. Thanks for working through my last review. Nothing I found should block merge.
The inline comments are optional follow-ups. Fix them here if it's easy, or track them in an issue.
op-will
enabled auto-merge
November 11, 2026 15:19
This was referenced Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #23404. This is the first of the version-by-version reth bumps; v2.8.x and v2.9.0 follow.
What
Updates reth to v2.7.0 through the
op-v2.7.0fork branch. The pin is arevon the fork stack ethereum-optimism/reth#34 → ethereum-optimism/reth#35 → ethereum-optimism/reth#40 → ethereum-optimism/reth#41 (0447ceb) until that stack merges andop-v2.7.0-0is tagged. Two of them carryop-v2.6.0patches that v2.7.0 lacks: ethereum-optimism/reth#40 the trie seek boundary fix (paradigmxyz/reth#28264), and ethereum-optimism/reth#41 the RPC replay through the block executor (ethereum-optimism/reth#37, a backport ofparadigmxyz/reth#28266) that #23942'srpc_replay_settlementtests depend on.Changes beyond the version sync:
StateProviderDatabasetakes anEvmStateProvider(paradigmxyz/reth#27109).CancelOnDropmoved toreth-tasks(paradigmxyz/reth#27466).StateProviderFactoryhas aPrimitivestype (paradigmxyz/reth#26923).BlockAndReceiptsholdsSharedReceipts(paradigmxyz/reth#27427).E2ETestSetupBuilder(paradigmxyz/reth#27432).reth-optimism-rpcvendors reth v2.6.0'sMemoryOverlayStateProviderfor the flashblocks pending state (see How).--rpc-cache.max-bals-bytes, like every other block access list option.MemoryOverlayStateProviderRef::hashed_post_statebecomes a frozenport, and the proofs-historyget_proofcopy notes why it doesn't follow upstream's newspawn_blocking_io_with_state.rust/UPDATING-RETH.mdgains what building theop-v2.7.0fork branch needed.Release notes
op-reth inherits these operator-facing changes from reth v2.7.0. No flags are removed. The RPC cache defaults are upstream's and were not tuned for OP's 2-second blocks: 1000 blocks is about 33 minutes of OP history.
--rpc-cache.max-blocks-bytes(2 GiB),--rpc-cache.max-receipts-bytes(1 GiB),--rpc-cache.idle-timeout(1h), and--engine.backfill-threshold(32, as before).--rpc-cache.max-blocks5000 → 1000,--rpc-cache.max-receipts2000 → 500.--engine.sender-recovery-cacheis on by default.--engine.sender-recovery-cache=falseturns it off. On OP it only serves transaction ingress:OpEvmConfigrecovers block senders itself, and deposits and0x7Dnever enter it.--rpc.gascap(default 50M) now also capseth_estimateGas.--rpc.max-tracing-requests,--rpc.max-blocking-io-requestsand--rpc.proof-permitsreject0.4444and "pruned history unavailable: requested N, earliest available M" (paradigmxyz/reth#27367). It used to be an internal error (-32603, "insufficient changesets..."). Nothing in this repo matches either. External clients matching the old text need updating.Why
Keeps op-reth on a supported reth line.
How
paradigmxyz/reth#26923removedMemoryOverlayStateProvider, and its replacement,state_with_block_appended, can't open the pending state of a speculative flashblock build. With canonical head N-1, a build can run several blocks ahead: N+1 on pending N, and so on. The tip's header names pending N as its parent, which reth's overlay doesn't know, while its bundle holds every write since the anchor N-1. Passing N fails withBlockHashNotFound, and passing N-1 panics on the parentdebug_assertinOverlayBuilder::with_appended_block. A tip built on the anchor still opens throughstate_with_block_appended; only a speculative tip uses the vendored provider, which layers it onhistory_by_block_hash(anchor)as before. Block hash lookups through it see only the tip, as they did on v2.6.0. The commits show it in order: the compiling API change, a red test of the speculative case, then the fix.op-reth-test-engineusesstate_with_block_appendeddirectly, since its blocks link to real parents in the overlay manager it shares with its provider.Review request: the agentic sweep from
docs/ai/reth-update-review.md(reth-update-reviewer, full-range and forward) has not run on this PR. Please run it. Two leads:--engine.sender-recovery-cacheis now on by default (paradigmxyz/reth#27447), sharing recovered senders between transaction ingress and payload execution. Check that recovery through the cache matches the uncached path for deposits (0x7E) and post-exec transactions (0x7D).LoadState::spawn_blocking_io_with_statebuilds pending state throughstate_with_block_appendedfor aPendingStateSource::Block. Check that everypendingstate query still reaches the vendored overlay throughOpEthApi::local_pending_state.Caveats
alloy-triestays at 0.9.7 in both lockfiles. The declared range (0.9.4, as in reth) admits 0.9.9, which breaksreth-trie-commonat this reth version (HashBuilder::all_branch_nodes), so don't refresh it with a broadcargo update.absolutePrestatein the dispute game args updated on-chain, before or as proposers switch: a proposer whose proofs don't verify against the configured prestate loses its challenged games.eth/memory_overlay.rskeeps upstream's threeTODO: Currently this does not reuse available in-memory trie nodes.comments. We don't plan to resolve them:ExecutedBlocks carry no trie updates, so there are no in-memory nodes to reuse.Alternatives
parent_num_hash).OverlayBuilder::with_appended_blockneeds both the chain at the RPC (op-reth: Transactions in earlier speculative flashblock blocks disappear from RPC lookups #23998) and reth access we don't have:state_with_block_appendedtakes one block, andProviderFactory::overlay_manageris crate-private.Potential follow-ups
op-v2.6.0, need carrying ontoop-v2.7.0if they merge first.