Skip to content

op-reth: use the engine's shared execution cache on the payload build path - #22600

Closed
palango wants to merge 1 commit into
ethereum-optimism:developfrom
palango:palango/op-payload-execution-cache
Closed

palango wants to merge 1 commit into
ethereum-optimism:developfrom
palango:palango/op-payload-execution-cache

Conversation

@palango

@palango palango commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

op-reth's payload builder threw away the execution cache the engine hands it, so
--engine.share-execution-cache-with-payload-builder did nothing on the build path: every payload
read accounts, storage and bytecode straight from the provider, even when the engine had a warm
cache ready for that exact parent. This wires it through, same as reth's Ethereum builder.

What was wrong

OpPayloadBuilder::build_payload swept execution_cache into the .. of its BuildArguments
destructure (rust/op-reth/crates/payload/src/builder.rs:258). Everything leading up to that line
already worked: the engine checks out a SavedCache on FCU-with-attributes, BasicPayloadJob
clones it into every build attempt, and op-reth's own convert_build_args forwards it faithfully
(builder.rs:404-430). Then the builder dropped it.

What this does

Wraps the state provider in a CachedStateProvider before the database is built, matching
crates/ethereum/payload/src/lib.rs:173-181 at the pinned rev line for line, per-build
CachedStateMetrics::zeroed(Builder) handle included.

The cache serves basic_account, storage and bytecode_by_hash. Trie, proof and storage-root
reads delegate to the inner provider, so the state root walk in BlockBuilder::finish is
unaffected. CachedStateProvider::new selects CacheFillMode::LookupOnly, so the builder reads
without ever writing into the engine's cache.

Relationship to other PRs

Independent of #22566, which pulls state_root_handle out of the same destructure. The two conflict
textually and nowhere else, so whichever lands second is a one-line resolution. #22495 leaves
BuildArguments flat, so this survives the v2.5.0 bump with only the manifest line changing.

Verified

  • cargo test -p reth-optimism-payload-builder: 25 passed.
  • cargo test -p reth-optimism-node --all-features --test e2e_testsuite: 2 passed, 1 pre-existing
    ignore.
  • cargo +nightly fmt --check and cargo clippy --all-targets clean.

… path

`build_payload` swept `execution_cache` into the `..` alongside the state root
handle, so `--engine.share-execution-cache-with-payload-builder` never reached a
build: every payload read accounts, storage and bytecode straight from the
provider. Wire it through the same way reth's Ethereum builder does, by wrapping
the state provider in a `CachedStateProvider` before the database is built.

Reads served this way are only accounts, storage and bytecode; trie and proof
reads still go to the inner provider. Expect a closed plumbing gap rather than a
latency win.
@opgitgovernance

Copy link
Copy Markdown
Contributor

This pr has been automatically marked as stale and will be closed in 5 days if no updates

@opgitgovernance opgitgovernance added the S-stale Status: Will be closed unless there is activity label Sep 5, 2026
@karlb

karlb commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

We still care about this, since we require performance improvements compared to vanilla op-reth to run our sequencer. Is there no interest in merging this or did you just not get to reviewing the PR?

@opgitgovernance opgitgovernance removed the S-stale Status: Will be closed unless there is activity label Sep 10, 2026
@opgitgovernance

Copy link
Copy Markdown
Contributor

This pr has been automatically marked as stale and will be closed in 5 days if no updates

@opgitgovernance opgitgovernance added the S-stale Status: Will be closed unless there is activity label Sep 25, 2026
@karlb

karlb commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

I'm repeating myself, but this PR is still relevant. Happy to rebase to the lastest version if there is any feedback.

@opgitgovernance opgitgovernance removed the S-stale Status: Will be closed unless there is activity label Sep 26, 2026
@opgitgovernance

Copy link
Copy Markdown
Contributor

This pr has been automatically marked as stale and will be closed in 5 days if no updates

@opgitgovernance opgitgovernance added the S-stale Status: Will be closed unless there is activity label Oct 10, 2026
@palango

palango commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

still a worthwhile change

@opgitgovernance opgitgovernance removed the S-stale Status: Will be closed unless there is activity label Oct 13, 2026
@opgitgovernance

Copy link
Copy Markdown
Contributor

This pr has been automatically marked as stale and will be closed in 5 days if no updates

@opgitgovernance opgitgovernance added the S-stale Status: Will be closed unless there is activity label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-stale Status: Will be closed unless there is activity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants