Skip to content

rust!: Update reth to v2.7.0 - #24024

Merged
op-will merged 14 commits into
developfrom
af/23404-reth-v2.7.0
Nov 11, 2026
Merged

op-will merged 14 commits into
developfrom
af/23404-reth-v2.7.0

Conversation

@aakoshh

@aakoshh aakoshh commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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.0 fork branch. The pin is a rev on the fork stack ethereum-optimism/reth#34 → ethereum-optimism/reth#35 → ethereum-optimism/reth#40 → ethereum-optimism/reth#41 (0447ceb) until that stack merges and op-v2.7.0-0 is tagged. Two of them carry op-v2.6.0 patches 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 of paradigmxyz/reth#28266) that #23942's rpc_replay_settlement tests depend on.

Changes beyond the version sync:

  • API adaptations:
    • StateProviderDatabase takes an EvmStateProvider (paradigmxyz/reth#27109).
    • CancelOnDrop moved to reth-tasks (paradigmxyz/reth#27466).
    • StateProviderFactory has a Primitives type (paradigmxyz/reth#26923).
    • BlockAndReceipts holds SharedReceipts (paradigmxyz/reth#27427).
    • The e2e setup functions folded into E2ETestSetupBuilder (paradigmxyz/reth#27432).
  • reth-optimism-rpc vendors reth v2.6.0's MemoryOverlayStateProvider for the flashblocks pending state (see How).
  • op-reth denies the new --rpc-cache.max-bals-bytes, like every other block access list option.
  • Two mirrored upstream symbols changed: the proofs buffer's copy of the deleted MemoryOverlayStateProviderRef::hashed_post_state becomes a frozen port, and the proofs-history get_proof copy notes why it doesn't follow upstream's new spawn_blocking_io_with_state.
  • rust/UPDATING-RETH.md gains what building the op-v2.7.0 fork 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.

  • New: --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).
  • Lower defaults: --rpc-cache.max-blocks 5000 → 1000, --rpc-cache.max-receipts 2000 → 500.
  • --engine.sender-recovery-cache is on by default. --engine.sender-recovery-cache=false turns it off. On OP it only serves transaction ingress: OpEvmConfig recovers block senders itself, and deposits and 0x7D never enter it.
  • --rpc.gascap (default 50M) now also caps eth_estimateGas.
  • --rpc.max-tracing-requests, --rpc.max-blocking-io-requests and --rpc.proof-permits reject 0.
  • A state query for a block whose changesets are pruned now fails with code 4444 and "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#26923 removed MemoryOverlayStateProvider, 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 with BlockHashNotFound, and passing N-1 panics on the parent debug_assert in OverlayBuilder::with_appended_block. A tip built on the anchor still opens through state_with_block_appended; only a speculative tip uses the vendored provider, which layers it on history_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-engine uses state_with_block_appended directly, 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:

  1. --engine.sender-recovery-cache is 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).
  2. Upstream's new LoadState::spawn_blocking_io_with_state builds pending state through state_with_block_appended for a PendingStateSource::Block. Check that every pending state query still reaches the vendored overlay through OpEthApi::local_pending_state.

Caveats

  • alloy-trie stays at 0.9.7 in both lockfiles. The declared range (0.9.4, as in reth) admits 0.9.9, which breaks reth-trie-common at this reth version (HashBuilder::all_branch_nodes), so don't refresh it with a broad cargo update.
  • The bump changes code that both proof programs run (revm, alloy and kona's executor). The next kona-sp1 build has a new super-aggregation vkey, and the next kona client build has a new Cannon prestate. Releasing either needs the matching absolutePrestate in 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.rs keeps upstream's three TODO: Currently this does not reuse available in-memory trie nodes. comments. We don't plan to resolve them:

Alternatives

  • For the flashblocks pending state, several ways to stay on reth's new overlay were considered and dropped:
    • Rewriting the tip's header parent to the anchor breaks the overlay's assumption that parent numbers are consecutive (parent_num_hash).
    • Feeding speculative blocks into the engine's overlay manager would mix unvalidated, cumulative-diff blocks into engine state.
    • Folding the whole speculative chain through OverlayBuilder::with_appended_block needs 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_appended takes one block, and ProviderFactory::overlay_manager is crate-private.

Potential follow-ups

@wiz-0f98cca50a

wiz-0f98cca50a Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total -

View scan details in Wiz

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
aakoshh force-pushed the af/23404-reth-v2.7.0 branch from 854af0c to 8ebf1ff Compare November 10, 2026 10:21
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.
@aakoshh aakoshh mentioned this pull request Nov 10, 2026
7 tasks
@aakoshh
aakoshh requested a review from sebastianst November 10, 2026 15:28
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
op-will marked this pull request as ready for review November 10, 2026 19:03
@op-will
op-will requested a review from a team as a code owner 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 op-will changed the title rust: Update reth to v2.7.0 rust!: Update reth to v2.7.0 Nov 10, 2026
op-will
op-will previously approved these changes Nov 10, 2026

@op-will op-will left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. All inline comments are non-blocking; address them here or in a follow-up.

On your two review requests:

  • Sender-recovery cache: OpEvmConfig recovers payload senders directly, so block execution never reads the cache. Deposits and 0x7D can't reach it at ingress either, since OpPooledTransaction excludes both. 0x7D's signer is the constant zero address regardless.
  • Pending state: OpEthApi doesn't override local_pending_block_or_state, so pending state RPCs still reach the vendored overlay.

I didn't run the reth-update-reviewer sweep.

Comment thread rust/op-reth-test-engine/src/chain.rs Resolved
Comment thread rust/op-reth-test-engine/src/chain.rs Resolved
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 op-will left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread rust/op-reth-test-engine/src/chain.rs Resolved
@op-will
op-will enabled auto-merge November 11, 2026 15:19
@op-will
op-will added this pull request to the merge queue Nov 11, 2026
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.

rust: bump reth to 2.7.0

2 participants