Skip to content

upgrade: upgrade xlayer-reth with reth v2.1.0 and op-reth v2.1.0#270

Merged
KamiD merged 13 commits intomainfrom
niven/reth-v2.0.0
Apr 30, 2026
Merged

upgrade: upgrade xlayer-reth with reth v2.1.0 and op-reth v2.1.0#270
KamiD merged 13 commits intomainfrom
niven/reth-v2.0.0

Conversation

@sieniven
Copy link
Copy Markdown
Contributor

@sieniven sieniven commented Apr 27, 2026

Summary

  1. Bump reth to okx/reth@044b173 (upstream/dev-v2.1.0)
  2. Bump op-reth optimism submodule to op-reth v2.2.0 (Sync upstream version v1.17.0 optimism#237)
  3. Align all alloy/revm/op-alloy deps to versions used by reth
  4. Drop obsolete op-alloy crates.io patches
  5. Bump rust toolchain to 1.94.0
  6. Drop the local alloy-rpc-types-engine fork: the v1.8.3 jsonwebtoken CVE-2026-25537 patch is no longer needed because alloy-rpc-types-engine 2.0.0 ships with jsonwebtoken 10.3.0 upstream

🤖 Generated with Claude Code

sieniven and others added 2 commits April 27, 2026 22:55
Bump reth to okx/reth@056289cd (v2.0.0), align all alloy/revm/op-alloy
deps to versions used by reth, bump optimism submodule, drop obsolete
op-alloy crates.io patches, and bump toolchain to 1.94.0.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sieniven sieniven changed the title upgrade: upgrade xlayer-reth with reth v2.0.0 and op-reth v2.0.0 upgrade: upgrade xlayer-reth with reth v2.0.0 and op-reth v2.1.0 Apr 27, 2026
Migrate xlayer-reth call sites for the upstream reth v2.0.0 and op-reth
v2.1.0 upgrade:

- Replace removed `PayloadBuilderAttributes` trait usage with
  `OpPayloadBuilderAttributes` struct + `OpPayloadAttrs` engine API
  wrapper; flatten nested `payload_attributes.X` field accesses.
- Drop the removed `TaskSpawner` / `TokioTaskExecutor` generics in
  flashblocks builder, generator, handler, RPC subscription, and
  monitor in favor of concrete `reth_tasks::TaskExecutor`.
- Rewrite `DefaultPayloadBuilder` `PayloadBuilder` impl to mirror
  upstream `OpPayloadBuilder` (`Attributes = OpPayloadAttrs`, convert
  to internal builder attrs in `try_build`).
- Plumb `runtime: reth_tasks::Runtime` through bin/tools commands and
  the new `import_blocks_from_file` arg.
- Add `cache_for`, `sparse_trie_handle_for`, and a separate
  `WaitForCaches` impl on `XLayerEngineValidator` to satisfy the new
  `EngineValidator` trait surface; return the new
  `(ExecutedBlock, Option<Box<ExecutionTimingStats>>)` tuple.
- Update `OpFlashblockPayloadMetadata` construction for the new
  `Option<BTreeMap>` fields plus `access_list`.
- Migrate validator state-root pipeline to the new payload_processor
  surface: keep `Arc<TrieUpdates>` end-to-end into
  `DeferredTrieData::pending`, switch from the now-private
  `ChangesetCache::insert` to `register_pending`/`resolve`, set
  `ExecutionEnv.gas_used`, and box the `OnStateHook` from the
  optional state hook.
- Preserve `WithEncoded` bytes through `flashblock_tx_iterator` so
  the prewarm path uses `FromTxWithEncoded` instead of recomputing
  `tx.encoded_2718()` per transaction via `FromRecoveredTx`.
- Add `PostExec` arms for `OpReceipt` and `OpTypedTransaction`,
  pairing them with the existing `Deposit` arm in `Signer::sign_tx`
  (system transactions, never user-signed).
- Implement `PoolTransaction::consensus_ref` on `MockFbTransaction`
  mirroring upstream's `unimplemented!()` mock pattern.
- Replace the removed `set_state_clear_flag` call (Spurious Dragon
  empty-account handling is always on in revm 12.0).
- Derive next-block number from `provider.last_block_number() + 1`
  in `monitor::handle` since `Events::Attributes` no longer carries
  parent hash.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sieniven
Copy link
Copy Markdown
Contributor Author

@claude review my diff for me, with the new reth v2.0.0 version upgrade

Copy link
Copy Markdown

@XLayer-Bot XLayer-Bot left a comment

Choose a reason for hiding this comment

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

Overall this is a clean and well-executed adaptation to the reth v2.0.0 / op-reth v2.1.0 API surface. The mechanical changes — flattening EthPayloadBuilderAttributes into OpPayloadBuilderAttributes, removing the OpAttributes bound, concretising Tasks type params to TaskExecutor, propagating the (ExecutedBlock, timing) tuple from validate_payload/validate_block, wrapping TrieUpdates in Arc, updating OpFlashblockPayloadMetadata fields to Option<…>, adding OpReceipt::PostExec coverage, and replacing [patch.crates-io] redirects with native path deps for op-alloy — are all correct and faithful to upstream.

Three minor items inline below.

workflow run

Comment thread README.md
Comment thread crates/monitor/src/handle.rs
Comment thread crates/builder/src/flashblocks/builder_tx.rs
The Rust badge was bumped in the v2.0.0 upgrade commit but the Reth
badge link/version was missed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sieniven
Copy link
Copy Markdown
Contributor Author

@claude review again

Copy link
Copy Markdown

@XLayer-Bot XLayer-Bot left a comment

Choose a reason for hiding this comment

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

All three previously raised concerns have been addressed:

README badge — updated to reth-v2.0.0 in 33be64b. ✓

monitor/handle.rs last_block_number() — author confirmed this is an acceptable approximation for monitoring metrics, and the change was unavoidable given that reth v2 no longer exposes the parent hash in the Events::Attributes variant. ✓

builder_tx.rs enveloped_tx: Some(Bytes::new()) — author verified that the previous OpTransactionRequest::try_into_tx_env impl (alloy-evm 0.26.3) already produced enveloped_tx: Some(Bytes::new()), confirmed by an upstream unit test. The new explicit construction is byte-identical to the old behavior. ✓

The rest of the reth v2 / op-reth v2.1.0 API migration looks mechanically correct: OpTxEnvConverter adoption, TaskExecutor concretisation, spawn_blocking_named additions, OpReceipt::PostExec arm, Arc<TrieUpdates> wrapping, deferred changeset provider creation, and the set_state_clear_flag removal (safe — reth v2's State::builder().with_bundle_prestate(bundle) inherits the correct Spurious Dragon flag from the accumulated bundle, making the explicit call redundant).

workflow run

Bump okx/reth pin to ccbef3f and update deps/optimism submodule.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Vui-Chee
Copy link
Copy Markdown
Contributor

@ci

@XLayer-Bot
Copy link
Copy Markdown

🔧 CI running for 97b978c7c17afed17df387808989bf968cbe27b7workflow run

@XLayer-Bot
Copy link
Copy Markdown

XLayer Reth CI failed for commit 97b978c7c17afed17df387808989bf968cbe27b7

Step Result
format-check ❌ failure
compile-check ⏩ skipped
clippy ⏩ skipped
tests ⏩ skipped

View run

@XLayer-Bot
Copy link
Copy Markdown

🔧 CI running for 97b978c7c17afed17df387808989bf968cbe27b7workflow run

@XLayer-Bot
Copy link
Copy Markdown

XLayer Reth CI failed for commit 97b978c7c17afed17df387808989bf968cbe27b7

Step Result
format-check ❌ failure
compile-check ⏩ skipped
clippy ⏩ skipped
tests ⏩ skipped

View run

@Vui-Chee
Copy link
Copy Markdown
Contributor

@ci

@XLayer-Bot
Copy link
Copy Markdown

🔧 CI running for 97b978c7c17afed17df387808989bf968cbe27b7workflow run

@XLayer-Bot
Copy link
Copy Markdown

XLayer Reth CI failed for commit 97b978c7c17afed17df387808989bf968cbe27b7

Step Result
format-check ⏩ skipped
compile-check ⏩ skipped
clippy ⏩ skipped
tests ⏩ skipped

View run

@Vui-Chee
Copy link
Copy Markdown
Contributor

@ci

@XLayer-Bot
Copy link
Copy Markdown

🔧 CI running for 97b978c7c17afed17df387808989bf968cbe27b7workflow run

@XLayer-Bot
Copy link
Copy Markdown

XLayer Reth CI passed for commit 97b978c7c17afed17df387808989bf968cbe27b7

Step Result
format-check ✅ success
compile-check ✅ success
clippy ✅ success
tests ✅ success

View run

@sieniven sieniven force-pushed the niven/reth-v2.0.0 branch from 12c782c to c9e40fd Compare April 30, 2026 02:08
sieniven and others added 3 commits April 30, 2026 10:32
- Add [patch."https://github.com/paradigmxyz/reth"] in workspace root so
  reth-* crates pulled transitively via deps/optimism/rust path crates
  resolve to the same okx/reth rev pinned in [workspace.dependencies],
  collapsing the lockfile to a single reth source.
- Bump deps/optimism submodule to 73460092 (sync upstream).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…VE patch

The local fork was at 1.6.3 from when the workspace shipped reth v1.11.3.
The reth v2.0.0 alignment bumped alloy-rpc-types-engine to 1.8.x, leaving
the 1.6.3 fork outside semver range and silently unused — jsonwebtoken
fell back to the vulnerable 9.3.1 from crates.io.

Replace the fork's contents with upstream alloy-rpc-types-engine 1.8.3,
re-apply the jsonwebtoken pin to 10.3.0 with the rust_crypto backend, and
add the missing [patch.crates-io] header above the security patches so
both the alloy-rpc-types-engine and libp2p-yamux overrides actually take
effect. Cargo.lock now resolves jsonwebtoken to 10.3.0, libp2p-yamux to
the local fork (no yamux 0.12.x), and emits no patch-unused warnings.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bump okx/reth rev from ccbef3f8 to 2de4f640 across both
[workspace.dependencies] and [patch."https://github.com/paradigmxyz/reth"]
so the workspace stays on a single reth source. Cargo.lock fully migrated
to the new rev (103 refs, no stragglers on the old one).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sieniven
Copy link
Copy Markdown
Contributor Author

@claude review again for me

Copy link
Copy Markdown

@XLayer-Bot XLayer-Bot left a comment

Choose a reason for hiding this comment

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

All three previous review threads are resolved — the badge fix, the monitoring approximation (accepted trade-off), and the enveloped_tx behavior (verified byte-identical to v1.11.3). The four new commits are clean:

  • chore: fmt — pure formatting, no logic change.
  • chore(deps): patch reth to okx fork — correctly adds [patch."https://github.com/paradigmxyz/reth"] so transitive reth deps pulled in by deps/optimism resolve to the same okx/reth rev, collapsing the lockfile to a single source. The op-alloy / alloy-op-* crates were removed from [patch.crates-io] because they are now declared as direct workspace path deps, which takes precedence without a patch entry — verified in the lock file.
  • fix(deps): rebase alloy-rpc-types-engine fork onto 1.8.3 — restores the CVE-2026-25537 jsonwebtoken security patch that was silently unused after the 1.6.3→1.8.x bump (the [patch.crates-io] entry didn't match the new semver range). The manual Deserialize impls for V2/V3/V4/InputV2/EnvelopeV4 are correct: the derived Serialize retains #[serde(flatten)] on the inner payload fields, and the Helper structs in each custom Deserialize read the same flat camelCase fields. Round-trip tests validate this. The JwtSecret Debug name typo fix from upstream 1.7.4 is also included.
  • chore(deps): switch okx/reth tip — bumps the rev to pick up the storage v2 static-file fix, keeping both [workspace.dependencies] and the new [patch."https://github.com/paradigmxyz/reth"] on the same rev. Verified the lock file has a single reth source.

workflow run

Comment thread bin/tools/main.rs Outdated
Replace Runtime::test() (test helper with 2 worker threads, 2 rayon
threads, 16 max blocking tasks) with a production-grade Runtime built
via RuntimeBuilder using RuntimeConfig::default() and attached to the
existing #[tokio::main] handle. This gives full CPU-derived rayon pool
sizing for import/export/gen-genesis/legacy-migrate operations without
spawning a second tokio runtime.

Addresses PR #270 review comment on bin/tools/main.rs:63.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread Cargo.toml Outdated
@sieniven sieniven changed the title upgrade: upgrade xlayer-reth with reth v2.0.0 and op-reth v2.1.0 upgrade: upgrade xlayer-reth with reth v2.1.0 and op-reth v2.1.0 Apr 30, 2026
sieniven and others added 2 commits April 30, 2026 15:17
Align workspace deps to reth v2.1.0 (okx/reth@044b173):

- reth-primitives-traits 0.1.0 → 0.3.0
- revm 36.0.0 → 38.0.0; op-revm 17.0.0 → 19.0.0
- alloy-evm 0.30.0 → 0.33.0; alloy-op-evm 0.30.0 → 0.31.0
- alloy-hardforks 0.4.5 → 0.4.7
- alloy-{consensus,contract,eips,genesis,json-rpc,network,provider,
  rpc-client,rpc-types-{beacon,engine,eth},serde,signer-local,
  transport,transport-http} 1.8.2 → 2.0.0
- tokio 1.44.2 → 1.51.1; tokio-tungstenite 0.26.2 → 0.28.0
- metrics 0.24.1 → 0.24.0
- README badge: reth v2.0.0 → v2.1.0

Drop the local alloy-rpc-types-engine fork: the v1.8.3 jsonwebtoken
CVE patch is no longer needed since alloy-rpc-types-engine 2.0.0
ships with jsonwebtoken 10.3.0 upstream.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- alloy-consensus 2.0 added block_access_list_hash and slot_number to
  Header; populate as None in flashblocks builder and assemble paths
  (matches op-reth/crates/evm/src/build.rs)
- alloy-rpc-types-eth 2.0 added block_timestamp to TransactionInfo;
  use ..Default::default() to match reth v2.1.0 RPC convention
- alloy-network 2.0 split TransactionRequest::build off into the
  NetworkTransactionBuilder trait; import it in e2e test utils
- revm 38 deprecated ExecutionResult::gas_used / Gas::used after the
  EIP-8037 state-gas split; switch flashblocks builder, context, and
  handler to tx_gas_used()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@KamiD KamiD merged commit 8a17bcd into main Apr 30, 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.

5 participants