From 0ee9d3915dd099c78fec56f588825515fa0cd853 Mon Sep 17 00:00:00 2001 From: Sebastian Stammler Date: Thu, 15 Oct 2026 14:21:47 +0200 Subject: [PATCH 1/3] op-reth!: build derived payloads at forkchoiceUpdated OpEngineApi builds the payload of derived (noTxPool) attributes that carry a non-deposit transaction while it answers engine_forkchoiceUpdated, with op-reth's payload builder whatever payload service the node runs. If the transactions make the block invalid it answers -38003, so the rollup node replaces the block with a deposits-only one or drops the batch. Before, the payload service either skipped the invalid transaction and built a block the fault proof rejects, or failed the build at getPayload, which the rollup node retries forever. The builder no longer skips invalid transactions of noTxPool attributes. getPayload serves the payload and publishes it to the payload service, whose subscribers include the engine tree, so newPayload does not execute the block again. That needs PayloadBuilderHandle::publish_built_payload, so reth is pinned to the fork commit that adds it. Attributes reth rejects, and builds that fail for a node-local reason, take reth's path as before. Requests for one payload share its build, and forkchoice updates are handled one at a time, so a fallback cannot overwrite a newer forkchoice. The witness of derived attributes with an invalid transaction covers the state read up to that transaction, where the fault proof program stops. BREAKING CHANGE: op-reth answers engine_forkchoiceUpdated with -38003 when the transactions of derived attributes make the block invalid. The rollup node must then replace the block with a deposits-only block or drop the batch. op-node does; kona-node needs the matching change, or it retries the attributes and stalls the safe head, so upgrade both together. Downstream crates that call OpEngineApi::new must pass the provider, validator and DerivedPayloads it builds derived payloads with; OpEngineApiBuilder requires the node's pool, provider and EVM to fit op-reth's payload builder. Co-authored-by: Anton Evangelatov Co-Authored-By: Claude Opus 5.5 --- rust/Cargo.lock | 214 +++---- rust/Cargo.toml | 142 ++--- rust/op-reth/crates/node/Cargo.toml | 2 +- rust/op-reth/crates/node/src/rpc.rs | 52 +- .../node/tests/it/derived_attributes.rs | 569 ++++++++++++++++++ rust/op-reth/crates/node/tests/it/main.rs | 2 + rust/op-reth/crates/payload/Cargo.toml | 1 + rust/op-reth/crates/payload/src/builder.rs | 95 ++- .../crates/payload/src/builder/tests.rs | 139 ++++- rust/op-reth/crates/payload/src/lib.rs | 1 + rust/op-reth/crates/rpc/Cargo.toml | 1 + rust/op-reth/crates/rpc/src/engine.rs | 250 +++++++- rust/op-reth/crates/rpc/src/engine/derived.rs | 479 +++++++++++++++ 13 files changed, 1728 insertions(+), 219 deletions(-) create mode 100644 rust/op-reth/crates/node/tests/it/derived_attributes.rs create mode 100644 rust/op-reth/crates/rpc/src/engine/derived.rs diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 3d36f50c212..2f646b4d27b 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -11893,7 +11893,7 @@ checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" [[package]] name = "reth-basic-payload-builder" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -11920,7 +11920,7 @@ dependencies = [ [[package]] name = "reth-chain-state" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -11951,7 +11951,7 @@ dependencies = [ [[package]] name = "reth-chainspec" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-chains", "alloy-consensus 2.4.2", @@ -11971,7 +11971,7 @@ dependencies = [ [[package]] name = "reth-cli" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-genesis", "clap", @@ -11984,7 +11984,7 @@ dependencies = [ [[package]] name = "reth-cli-commands" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-chains", "alloy-consensus 2.4.2", @@ -12073,7 +12073,7 @@ dependencies = [ [[package]] name = "reth-cli-runner" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "reth-tasks", "tokio", @@ -12083,7 +12083,7 @@ dependencies = [ [[package]] name = "reth-cli-util" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -12136,7 +12136,7 @@ dependencies = [ [[package]] name = "reth-config" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "eyre", "humantime-serde", @@ -12153,7 +12153,7 @@ dependencies = [ [[package]] name = "reth-consensus" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eip7928 0.4.5", @@ -12167,7 +12167,7 @@ dependencies = [ [[package]] name = "reth-consensus-common" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12180,7 +12180,7 @@ dependencies = [ [[package]] name = "reth-consensus-debug-client" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12205,7 +12205,7 @@ dependencies = [ [[package]] name = "reth-db" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "derive_more 2.1.1", @@ -12234,7 +12234,7 @@ dependencies = [ [[package]] name = "reth-db-api" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -12260,7 +12260,7 @@ dependencies = [ [[package]] name = "reth-db-common" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-genesis", @@ -12290,7 +12290,7 @@ dependencies = [ [[package]] name = "reth-db-models" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -12305,7 +12305,7 @@ dependencies = [ [[package]] name = "reth-discv4" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -12330,7 +12330,7 @@ dependencies = [ [[package]] name = "reth-discv5" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -12354,7 +12354,7 @@ dependencies = [ [[package]] name = "reth-dns-discovery" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "dashmap", @@ -12378,7 +12378,7 @@ dependencies = [ [[package]] name = "reth-downloaders" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12413,7 +12413,7 @@ dependencies = [ [[package]] name = "reth-e2e-test-utils" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12470,7 +12470,7 @@ dependencies = [ [[package]] name = "reth-ecies" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "aes 0.8.4", "alloy-primitives", @@ -12497,7 +12497,7 @@ dependencies = [ [[package]] name = "reth-engine-local" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -12520,7 +12520,7 @@ dependencies = [ [[package]] name = "reth-engine-primitives" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12547,7 +12547,7 @@ dependencies = [ [[package]] name = "reth-engine-tree" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eip7928 0.4.5", @@ -12603,7 +12603,7 @@ dependencies = [ [[package]] name = "reth-engine-util" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -12633,7 +12633,7 @@ dependencies = [ [[package]] name = "reth-era" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12651,7 +12651,7 @@ dependencies = [ [[package]] name = "reth-era-downloader" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "bytes", @@ -12667,7 +12667,7 @@ dependencies = [ [[package]] name = "reth-era-utils" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -12691,7 +12691,7 @@ dependencies = [ [[package]] name = "reth-errors" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "reth-consensus", "reth-execution-errors", @@ -12702,7 +12702,7 @@ dependencies = [ [[package]] name = "reth-eth-wire" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-chains", "alloy-primitives", @@ -12731,7 +12731,7 @@ dependencies = [ [[package]] name = "reth-eth-wire-types" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-chains", "alloy-consensus 2.4.2", @@ -12757,7 +12757,7 @@ dependencies = [ [[package]] name = "reth-ethereum" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-rpc-types-engine", "alloy-rpc-types-eth 2.4.2", @@ -12798,7 +12798,7 @@ dependencies = [ [[package]] name = "reth-ethereum-cli" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "clap", "eyre", @@ -12821,7 +12821,7 @@ dependencies = [ [[package]] name = "reth-ethereum-consensus" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12837,7 +12837,7 @@ dependencies = [ [[package]] name = "reth-ethereum-engine-primitives" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -12853,7 +12853,7 @@ dependencies = [ [[package]] name = "reth-ethereum-forks" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eip2124", "alloy-hardforks", @@ -12867,7 +12867,7 @@ dependencies = [ [[package]] name = "reth-ethereum-payload-builder" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12897,7 +12897,7 @@ dependencies = [ [[package]] name = "reth-ethereum-primitives" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12911,7 +12911,7 @@ dependencies = [ [[package]] name = "reth-etl" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "rayon", "reth-db-api", @@ -12921,7 +12921,7 @@ dependencies = [ [[package]] name = "reth-evm" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eip7928 0.4.5", @@ -12947,7 +12947,7 @@ dependencies = [ [[package]] name = "reth-evm-ethereum" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -12967,7 +12967,7 @@ dependencies = [ [[package]] name = "reth-execution-cache" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "fixed-cache", @@ -12985,7 +12985,7 @@ dependencies = [ [[package]] name = "reth-execution-errors" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-evm", "alloy-primitives", @@ -12998,7 +12998,7 @@ dependencies = [ [[package]] name = "reth-execution-types" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13017,7 +13017,7 @@ dependencies = [ [[package]] name = "reth-exex" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13055,7 +13055,7 @@ dependencies = [ [[package]] name = "reth-exex-test-utils" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "eyre", @@ -13087,7 +13087,7 @@ dependencies = [ [[package]] name = "reth-exex-types" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -13101,7 +13101,7 @@ dependencies = [ [[package]] name = "reth-fs-util" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "serde", "serde_json", @@ -13111,7 +13111,7 @@ dependencies = [ [[package]] name = "reth-invalid-block-hooks" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -13137,7 +13137,7 @@ dependencies = [ [[package]] name = "reth-ipc" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "bytes", "futures", @@ -13157,7 +13157,7 @@ dependencies = [ [[package]] name = "reth-libmdbx" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "bitflags 2.11.1", "byteorder", @@ -13174,7 +13174,7 @@ dependencies = [ [[package]] name = "reth-mdbx-sys" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "bindgen", "cc", @@ -13183,7 +13183,7 @@ dependencies = [ [[package]] name = "reth-metrics" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "futures", "libc", @@ -13197,7 +13197,7 @@ dependencies = [ [[package]] name = "reth-net-banlist" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "ipnet", @@ -13206,7 +13206,7 @@ dependencies = [ [[package]] name = "reth-net-nat" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "futures-util", "if-addrs 0.14.0", @@ -13220,7 +13220,7 @@ dependencies = [ [[package]] name = "reth-network" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13279,7 +13279,7 @@ dependencies = [ [[package]] name = "reth-network-api" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -13304,7 +13304,7 @@ dependencies = [ [[package]] name = "reth-network-p2p" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eip7928 0.4.5", @@ -13328,7 +13328,7 @@ dependencies = [ [[package]] name = "reth-network-peers" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -13343,7 +13343,7 @@ dependencies = [ [[package]] name = "reth-network-types" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eip2124", "humantime-serde", @@ -13357,7 +13357,7 @@ dependencies = [ [[package]] name = "reth-nippy-jar" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "anyhow", "bincode 1.3.3", @@ -13374,7 +13374,7 @@ dependencies = [ [[package]] name = "reth-node-api" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-rpc-types-engine", "eyre", @@ -13398,7 +13398,7 @@ dependencies = [ [[package]] name = "reth-node-builder" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13466,7 +13466,7 @@ dependencies = [ [[package]] name = "reth-node-core" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13521,7 +13521,7 @@ dependencies = [ [[package]] name = "reth-node-ethereum" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13570,7 +13570,7 @@ dependencies = [ [[package]] name = "reth-node-ethstats" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -13594,7 +13594,7 @@ dependencies = [ [[package]] name = "reth-node-events" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -13618,7 +13618,7 @@ dependencies = [ [[package]] name = "reth-node-metrics" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "bytes", "eyre", @@ -13647,7 +13647,7 @@ dependencies = [ [[package]] name = "reth-node-types" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "reth-chainspec", "reth-db-api", @@ -14017,6 +14017,7 @@ dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", "alloy-evm", + "alloy-op-evm", "alloy-primitives", "alloy-rlp", "alloy-rpc-types-debug", @@ -14151,6 +14152,7 @@ dependencies = [ "reth-optimism-primitives", "reth-optimism-trie", "reth-optimism-txpool", + "reth-payload-builder", "reth-payload-util", "reth-primitives-traits", "reth-provider", @@ -14282,7 +14284,7 @@ dependencies = [ [[package]] name = "reth-payload-builder" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -14306,7 +14308,7 @@ dependencies = [ [[package]] name = "reth-payload-builder-primitives" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "pin-project", "reth-payload-primitives", @@ -14318,7 +14320,7 @@ dependencies = [ [[package]] name = "reth-payload-primitives" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -14341,7 +14343,7 @@ dependencies = [ [[package]] name = "reth-payload-util" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -14351,7 +14353,7 @@ dependencies = [ [[package]] name = "reth-payload-validator" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-rpc-types-engine", @@ -14394,7 +14396,7 @@ dependencies = [ [[package]] name = "reth-provider" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eip7928 0.4.5", @@ -14444,7 +14446,7 @@ dependencies = [ [[package]] name = "reth-prune" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -14471,7 +14473,7 @@ dependencies = [ [[package]] name = "reth-prune-types" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "arbitrary", @@ -14487,7 +14489,7 @@ dependencies = [ [[package]] name = "reth-revm" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -14502,7 +14504,7 @@ dependencies = [ [[package]] name = "reth-rpc" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-dyn-abi", @@ -14578,7 +14580,7 @@ dependencies = [ [[package]] name = "reth-rpc-api" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "alloy-genesis", @@ -14608,7 +14610,7 @@ dependencies = [ [[package]] name = "reth-rpc-builder" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-network 2.4.2", "alloy-provider", @@ -14651,7 +14653,7 @@ dependencies = [ [[package]] name = "reth-rpc-convert" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-evm", @@ -14671,7 +14673,7 @@ dependencies = [ [[package]] name = "reth-rpc-engine-api" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -14702,7 +14704,7 @@ dependencies = [ [[package]] name = "reth-rpc-eth-api" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-dyn-abi", @@ -14749,7 +14751,7 @@ dependencies = [ [[package]] name = "reth-rpc-eth-types" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-chains", "alloy-consensus 2.4.2", @@ -14800,7 +14802,7 @@ dependencies = [ [[package]] name = "reth-rpc-layer" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-rpc-types-engine", "http 1.4.0", @@ -14814,7 +14816,7 @@ dependencies = [ [[package]] name = "reth-rpc-server-types" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -14845,7 +14847,7 @@ dependencies = [ [[package]] name = "reth-stages" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -14896,7 +14898,7 @@ dependencies = [ [[package]] name = "reth-stages-api" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -14924,7 +14926,7 @@ dependencies = [ [[package]] name = "reth-stages-types" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "arbitrary", @@ -14938,7 +14940,7 @@ dependencies = [ [[package]] name = "reth-static-file" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "parking_lot", @@ -14958,7 +14960,7 @@ dependencies = [ [[package]] name = "reth-static-file-types" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "clap", @@ -14973,7 +14975,7 @@ dependencies = [ [[package]] name = "reth-storage-api" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eip7928 0.4.5", @@ -14999,7 +15001,7 @@ dependencies = [ [[package]] name = "reth-storage-errors" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -15016,7 +15018,7 @@ dependencies = [ [[package]] name = "reth-storage-overlay" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-eips 2.5.0", "alloy-primitives", @@ -15043,7 +15045,7 @@ dependencies = [ [[package]] name = "reth-tasks" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "crossbeam-utils", "dashmap", @@ -15064,7 +15066,7 @@ dependencies = [ [[package]] name = "reth-testing-utils" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -15080,7 +15082,7 @@ dependencies = [ [[package]] name = "reth-tokio-util" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "tokio", "tokio-stream", @@ -15090,7 +15092,7 @@ dependencies = [ [[package]] name = "reth-tracing" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "clap", "eyre", @@ -15110,7 +15112,7 @@ dependencies = [ [[package]] name = "reth-tracing-otlp" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "base64 0.22.1", "clap", @@ -15129,7 +15131,7 @@ dependencies = [ [[package]] name = "reth-transaction-pool" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -15174,7 +15176,7 @@ dependencies = [ [[package]] name = "reth-trie" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-eips 2.5.0", @@ -15200,7 +15202,7 @@ dependencies = [ [[package]] name = "reth-trie-common" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-consensus 2.4.2", "alloy-primitives", @@ -15227,7 +15229,7 @@ dependencies = [ [[package]] name = "reth-trie-db" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "reth-db-api", @@ -15243,7 +15245,7 @@ dependencies = [ [[package]] name = "reth-trie-parallel" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-evm", "alloy-primitives", @@ -15267,7 +15269,7 @@ dependencies = [ [[package]] name = "reth-trie-sparse" version = "2.5.2" -source = "git+https://github.com/ethereum-optimism/reth?rev=0fbe428518594611bdd3fdd822eb5968823c8e66#0fbe428518594611bdd3fdd822eb5968823c8e66" +source = "git+https://github.com/ethereum-optimism/reth?rev=0a81846bc30599dfc389540132bc79f810185f12#0a81846bc30599dfc389540132bc79f810185f12" dependencies = [ "alloy-primitives", "alloy-trie", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index e81786662e4..88fdf7afbf1 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -359,77 +359,77 @@ reth-rpc-traits = { version = "0.6.0", default-features = false } reth-zstd-compressors = { version = "0.6.0", default-features = false } # ==================== RETH CRATES (git) ==================== -reth = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-basic-payload-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-chain-state = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-chainspec = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-cli = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-cli-commands = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-cli-runner = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-cli-util = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-consensus = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-consensus-common = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-db = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-db-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-db-common = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-downloaders = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-e2e-test-utils = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-engine-local = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-engine-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-eth-wire = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-eth-wire-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-ethereum-cli = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-ethereum-consensus = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-ethereum-forks = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-ethereum-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-evm = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-evm-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-exex = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-exex-test-utils = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-execution-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-execution-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-fs-util = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-metrics = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-network = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-network-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-network-peers = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-node-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-node-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-node-core = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-node-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-node-events = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-node-metrics = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-payload-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-payload-builder-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-payload-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-payload-util = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-payload-validator = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-provider = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-prune = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-prune-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-revm = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-rpc = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-rpc-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-rpc-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-rpc-engine-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-rpc-eth-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-rpc-eth-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-rpc-server-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-stages = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-stages-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-static-file = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-static-file-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-storage-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-storage-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-storage-overlay = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-tasks = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-tracing = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-transaction-pool = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-trie = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } -reth-trie-common = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66", default-features = false } -reth-trie-db = { git = "https://github.com/ethereum-optimism/reth", rev = "0fbe428518594611bdd3fdd822eb5968823c8e66" } +reth = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-basic-payload-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-chain-state = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-chainspec = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-cli = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-cli-commands = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-cli-runner = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-cli-util = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-consensus = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-consensus-common = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-db = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-db-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-db-common = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-downloaders = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-e2e-test-utils = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-engine-local = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-engine-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-eth-wire = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-eth-wire-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-ethereum-cli = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-ethereum-consensus = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-ethereum-forks = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-ethereum-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-evm = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-evm-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-exex = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-exex-test-utils = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-execution-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-execution-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-fs-util = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-metrics = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-network = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-network-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-network-peers = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-node-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-node-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-node-core = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-node-ethereum = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-node-events = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-node-metrics = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-payload-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-payload-builder-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-payload-primitives = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-payload-util = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-payload-validator = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-provider = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-prune = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-prune-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-revm = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-rpc = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-rpc-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-rpc-builder = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-rpc-engine-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-rpc-eth-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-rpc-eth-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-rpc-server-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-stages = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-stages-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-static-file = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-static-file-types = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-storage-api = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-storage-errors = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-storage-overlay = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-tasks = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-tracing = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-transaction-pool = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-trie = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } +reth-trie-common = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12", default-features = false } +reth-trie-db = { git = "https://github.com/ethereum-optimism/reth", rev = "0a81846bc30599dfc389540132bc79f810185f12" } # ==================== REVM (latest: op-reth versions) ==================== revm = { version = "42.0.1", default-features = false } diff --git a/rust/op-reth/crates/node/Cargo.toml b/rust/op-reth/crates/node/Cargo.toml index 634692d9de3..766ec30a3ae 100644 --- a/rust/op-reth/crates/node/Cargo.toml +++ b/rust/op-reth/crates/node/Cargo.toml @@ -15,6 +15,7 @@ workspace = true reth-chainspec.workspace = true ## ensure secp256k1 recovery with rayon support is activated reth-primitives-traits = { workspace = true, features = ["secp256k1", "rayon"] } +reth-basic-payload-builder.workspace = true reth-payload-builder.workspace = true reth-consensus.workspace = true reth-node-api.workspace = true @@ -89,7 +90,6 @@ alloy-genesis = { workspace = true, optional = true } serde_json = { workspace = true, optional = true } [dev-dependencies] -reth-basic-payload-builder.workspace = true reth-node-metrics.workspace = true reth-optimism-node = { workspace = true, features = ["test-utils"] } reth-db = { workspace = true, features = ["test-utils"] } diff --git a/rust/op-reth/crates/node/src/rpc.rs b/rust/op-reth/crates/node/src/rpc.rs index 4826341105c..de0e7314aee 100644 --- a/rust/op-reth/crates/node/src/rpc.rs +++ b/rust/op-reth/crates/node/src/rpc.rs @@ -91,15 +91,19 @@ pub use reth_optimism_rpc::{OpEngineApi, OpEthApi, OpEthApiBuilder}; use crate::OP_NAME_CLIENT; use alloy_rpc_types_engine::ClientVersionV1; +use reth_basic_payload_builder::{HeaderForPayload, PayloadBuilder}; use reth_chainspec::EthereumHardforks; use reth_node_api::{ - AddOnsContext, EngineApiValidator, EngineTypes, FullNodeComponents, NodeTypes, + AddOnsContext, EngineApiValidator, EngineTypes, FullNodeComponents, NodeTypes, PayloadTypes, + PayloadValidator, }; use reth_node_builder::rpc::{EngineApiBuilder, PayloadValidatorBuilder}; use reth_node_core::version::{CLIENT_CODE, version_metadata}; -use reth_optimism_payload_builder::OpExecData; -use reth_optimism_rpc::engine::OP_ENGINE_CAPABILITIES; +use reth_optimism_payload_builder::{OpExecData, OpPayloadAttrs}; +use reth_optimism_rpc::engine::{DerivedPayloads, OP_ENGINE_CAPABILITIES}; use reth_payload_builder::PayloadStore; +use reth_primitives_traits::Block; +use reth_provider::HeaderProvider; use reth_rpc_engine_api::{EngineApi, EngineCapabilities}; /// Builder for basic [`OpEngineApi`] implementation. @@ -108,16 +112,33 @@ pub struct OpEngineApiBuilder { engine_validator_builder: EV, } +/// The payload type of the node `N`. +type PayloadOf = <::Types as NodeTypes>::Payload; + impl EngineApiBuilder for OpEngineApiBuilder where N: FullNodeComponents< - Types: NodeTypes< - ChainSpec: EthereumHardforks, - Payload: EngineTypes, + Types: NodeTypes< + ChainSpec: EthereumHardforks, + Payload: EngineTypes< + ExecutionData = OpExecData, + PayloadAttributes = OpPayloadAttrs, + >, + >, + Provider: HeaderProvider< + Header = HeaderForPayload< as PayloadTypes>::BuiltPayload>, + >, >, - >, EV: PayloadValidatorBuilder, - EV::Validator: EngineApiValidator<::Payload>, + EV::Validator: EngineApiValidator> + + PayloadValidator< + PayloadOf, + Block: Block
as PayloadTypes>::BuiltPayload>>, + > + Clone, + reth_optimism_payload_builder::OpPayloadBuilder: PayloadBuilder< + Attributes = OpPayloadAttrs, + BuiltPayload = as PayloadTypes>::BuiltPayload, + > + 'static, { type EngineApi = OpEngineApi< N::Provider, @@ -131,6 +152,17 @@ where let Self { engine_validator_builder } = self; let engine_validator = engine_validator_builder.build(ctx).await?; + // The default builder config only shapes transaction-pool selection and SDM production, + // which derived payloads never use. + let derived_payloads = DerivedPayloads::new( + reth_optimism_payload_builder::OpPayloadBuilder::new( + ctx.node.pool().clone(), + ctx.node.provider().clone(), + ctx.node.evm_config().clone(), + ), + ctx.node.payload_builder_handle().clone(), + ctx.node.task_executor().clone(), + ); let client = ClientVersionV1 { code: CLIENT_CODE, name: OP_NAME_CLIENT.to_string(), @@ -146,11 +178,11 @@ where ctx.node.task_executor().clone(), client, EngineCapabilities::new(OP_ENGINE_CAPABILITIES.iter().copied()), - engine_validator, + engine_validator.clone(), ctx.config.engine.accept_execution_requests_hash, ctx.node.network().clone(), ); - Ok(OpEngineApi::new(inner)) + Ok(OpEngineApi::new(inner, ctx.node.provider().clone(), engine_validator, derived_payloads)) } } diff --git a/rust/op-reth/crates/node/tests/it/derived_attributes.rs b/rust/op-reth/crates/node/tests/it/derived_attributes.rs new file mode 100644 index 00000000000..168e51fab02 --- /dev/null +++ b/rust/op-reth/crates/node/tests/it/derived_attributes.rs @@ -0,0 +1,569 @@ +//! Derived (`noTxPool`) attributes are built inside `engine_forkchoiceUpdated`. Transactions that +//! make the payload invalid are rejected there with `-38003`, so the rollup node can replace the +//! block with a deposits-only one, and a valid payload is built exactly once. A build that fails +//! for a node-local reason leaves the attributes to the payload service instead. + +use alloy_consensus::{Sealable, SignableTransaction, TxEip1559}; +use alloy_genesis::Genesis; +use alloy_network::eip2718::Encodable2718; +use alloy_primitives::{Address, B64, B256, Bytes, Signature, TxKind}; +use alloy_rpc_types_engine::{ + ClientCode, ClientVersionV1, ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus, +}; +use jsonrpsee::{ + core::{ClientError, client::ClientT}, + rpc_params, +}; +use op_alloy_consensus::{ + OpTxEnvelope, SDMGasEntry, TxDeposit, build_post_exec_tx, encode_jovian_extra_data, +}; +use op_alloy_rpc_types_engine::{OpExecutionPayloadEnvelopeV3, OpExecutionPayloadEnvelopeV4}; +use reth_chainspec::{BaseFeeParams, EthChainSpec}; +use reth_node_api::{ + AddOnsContext, EngineApiValidator, FullNodeComponents, PayloadBuilderError, PayloadValidator, +}; +use reth_node_builder::{ + Node, NodeBuilder, NodeConfig, + rpc::{EngineApiBuilder, PayloadValidatorBuilder}, +}; +use reth_optimism_chainspec::{OpChainSpec, OpChainSpecBuilder}; +use reth_optimism_forks::OpHardforks; +use reth_optimism_node::{ + OpBuiltPayload, OpEngineTypes, OpEngineValidatorBuilder, OpNode, + utils::optimism_payload_attributes, +}; +use reth_optimism_payload_builder::{OpPayloadAttrs, OpPayloadBuilder, OpPayloadBuilderAttributes}; +use reth_optimism_primitives::{OpBlock, OpTransactionSigned}; +use reth_optimism_rpc::{ + OpEngineApi, + engine::{ + DerivedPayloadBuilder, DerivedPayloads, OP_ENGINE_CAPABILITIES, + builds_at_forkchoice_updated, + }, +}; +use reth_payload_builder::PayloadStore; +use reth_primitives_traits::SealedHeader; +use reth_provider::{HeaderProvider, ProviderError}; +use reth_rpc_api::IntoEngineApiRpcModule; +use reth_rpc_engine_api::{EngineApi, EngineCapabilities}; +use reth_tasks::Runtime; +use std::{ + sync::{Arc, Mutex, mpsc}, + time::Duration, +}; + +const INVALID_PAYLOAD_ATTRIBUTES: i32 = -38003; + +async fn fcu( + client: &impl ClientT, + state: ForkchoiceState, + attrs: &OpPayloadAttrs, +) -> Result { + client.request("engine_forkchoiceUpdatedV3", rpc_params![state, attrs.0.clone()]).await +} + +#[track_caller] +fn assert_invalid_attributes(result: Result, case: &str) { + match result { + Err(ClientError::Call(err)) => { + assert_eq!(err.code(), INVALID_PAYLOAD_ATTRIBUTES, "{case}: unexpected error {err:?}") + } + other => panic!("{case}: expected INVALID_PAYLOAD_ATTRIBUTES, got {other:?}"), + } +} + +/// Transactions shared by the cases: a deposit funding the sender of a 21k-gas transfer. +struct Txs { + deposit: Bytes, + /// Another deposit, for a later block. + next_deposit: Bytes, + /// Valid after `deposit`, which raises the sender's nonce to 1. + transfer: Bytes, + nonce_too_high: Bytes, +} + +impl Txs { + fn new(chain_id: u64) -> eyre::Result { + let transfer = |nonce| { + TxEip1559 { + chain_id, + nonce, + gas_limit: 21_000, + max_fee_per_gas: 1_000_000_000_000, + to: TxKind::Call(Address::with_last_byte(1)), + ..Default::default() + } + .into_signed(Signature::test_signature()) + }; + let from = transfer(1).recover_signer()?; + let deposit = |source| TxDeposit { + source_hash: B256::with_last_byte(source), + from, + to: TxKind::Call(Address::with_last_byte(1)), + mint: 1_000_000_000_000_000_000, + gas_limit: 21_000, + ..Default::default() + }; + let encode = |tx: OpTxEnvelope| -> Bytes { tx.encoded_2718().into() }; + Ok(Self { + deposit: encode(OpTxEnvelope::Deposit(deposit(1).seal_slow())), + next_deposit: encode(OpTxEnvelope::Deposit(deposit(2).seal_slow())), + transfer: encode(OpTxEnvelope::Eip1559(transfer(1))), + nonce_too_high: encode(OpTxEnvelope::Eip1559(transfer(5))), + }) + } +} + +fn post_exec(block_number: u64, entries: Vec) -> Bytes { + OpTxEnvelope::PostExec(build_post_exec_tx(block_number, entries).seal_slow()) + .encoded_2718() + .into() +} + +const fn refund(index: u64, gas_refund: u64) -> SDMGasEntry { + SDMGasEntry { index, gas_refund } +} + +/// Launches a node on `chain_spec`, checks that every invalid case is rejected at FCU, then builds +/// `valid` and a sibling of it, making both canonical in turn, and finally a deposits-only child. +async fn run( + chain_spec: Arc, + invalid: Vec<(&str, Vec)>, + valid: Vec, + deposits_only: Vec, +) -> eyre::Result<()> { + let latest_forks = + chain_spec.is_jovian_active_at_timestamp(chain_spec.genesis_header().timestamp); + let genesis = chain_spec.genesis_header().clone(); + let mut config = NodeConfig::test().map_chain(chain_spec.clone()).with_unused_ports(); + config.network.discovery.discv5_port = Some(0); + config.network.discovery.discv5_port_ipv6 = Some(0); + + let op_node = OpNode::default(); + let node = NodeBuilder::new(config) + .testing_node(Runtime::test()) + .with_types::() + .with_components(op_node.components()) + .with_add_ons(op_node.add_ons()) + .launch() + .await? + .node; + let client = node.auth_server_handle().http_client(); + let memory = node.provider.canonical_in_memory_state(); + let genesis_head = ForkchoiceState::same_hash(chain_spec.genesis_hash()); + + let derived = |transactions: Vec, prev_randao: u8, timestamp: u64| { + let mut attrs = optimism_payload_attributes(timestamp); + attrs.0.payload_attributes.prev_randao = B256::with_last_byte(prev_randao); + attrs.0.no_tx_pool = Some(true); + if latest_forks { + attrs.0.eip_1559_params = Some(B64::ZERO); + attrs.0.min_base_fee = Some(0); + } + attrs.0.transactions = Some(transactions); + attrs + }; + + for (case, transactions) in invalid { + assert_invalid_attributes( + fcu(&client, genesis_head, &derived(transactions, 0, genesis.timestamp + 2)).await, + case, + ); + } + + let mut canonical = genesis_head; + // The second build replaces the first block, so it builds on a canonical ancestor of the tip. + let builds = [(valid.clone(), 1, false), (valid, 2, false), (deposits_only, 3, true)]; + for (transactions, prev_randao, on_tip) in builds { + let (parent, timestamp) = if on_tip { + (canonical, genesis.timestamp + 4) + } else { + (genesis_head, genesis.timestamp + 2) + }; + let attrs = derived(transactions.clone(), prev_randao, timestamp); + let updated = fcu(&client, parent, &attrs).await?; + assert!(updated.payload_status.is_valid(), "derived attributes {prev_randao}: {updated:?}"); + let id = updated.payload_id.expect("valid derived attributes return a payload id"); + let job = node.payload_builder_handle.payload_timestamp(id).await; + if builds_at_forkchoice_updated(&attrs) { + assert!(job.is_none(), "the payload was built at FCU, so no payload job may build it"); + } else { + assert!(job.is_some(), "the payload service builds these attributes"); + } + + let (block, new_payload) = if latest_forks { + let payload: OpExecutionPayloadEnvelopeV4 = + client.request("engine_getPayloadV5", rpc_params![id]).await?; + let block = payload.execution_payload.payload_inner.payload_inner.payload_inner.clone(); + let params = rpc_params![ + payload.execution_payload, + Vec::::new(), + payload.parent_beacon_block_root, + payload.execution_requests + ]; + (block, ("engine_newPayloadV4", params)) + } else { + let payload: OpExecutionPayloadEnvelopeV3 = + client.request("engine_getPayloadV3", rpc_params![id]).await?; + let block = payload.execution_payload.payload_inner.payload_inner.clone(); + let params = rpc_params![ + payload.execution_payload, + Vec::::new(), + payload.parent_beacon_block_root + ]; + (block, ("engine_newPayloadV3", params)) + }; + assert_eq!(block.transactions, transactions, "the block keeps every derived transaction"); + assert_eq!(block.parent_hash, parent.head_block_hash); + + // getPayload hands the executed block to the engine, so newPayload does not execute it + // again. The engine tracks it as the pending block while its parent is the tip. + if parent == canonical { + tokio::time::timeout(Duration::from_secs(10), async { + while memory.pending_block_num_hash().map(|b| b.hash) != Some(block.block_hash) { + tokio::time::sleep(Duration::from_millis(10)).await; + } + }) + .await + .expect("the engine never received the executed block"); + } + + let (method, params) = new_payload; + let status: PayloadStatus = client.request(method, params).await?; + assert!(status.is_valid(), "newPayload of the built block {prev_randao}: {status:?}"); + canonical = ForkchoiceState::same_hash(block.block_hash); + let updated: ForkchoiceUpdated = + client.request("engine_forkchoiceUpdatedV3", rpc_params![canonical]).await?; + assert!(updated.payload_status.is_valid(), "FCU to the built block: {updated:?}"); + } + + Ok(()) +} + +#[tokio::test(flavor = "multi_thread")] +async fn invalid_derived_transactions_are_rejected_at_fcu() -> eyre::Result<()> { + // A Jovian parent must carry Jovian extra data, or no child of it passes validation. + let mut genesis: Genesis = serde_json::from_str(include_str!("../assets/genesis.json"))?; + genesis.extra_data = encode_jovian_extra_data(B64::ZERO, BaseFeeParams::optimism(), 0)?; + genesis.base_fee_per_gas = Some(1_000_000_000); + let chain_spec = Arc::new( + OpChainSpecBuilder::optimism_sepolia().genesis(genesis).lagoon_activated().build(), + ); + let Txs { deposit, next_deposit, transfer, nonce_too_high } = Txs::new(chain_spec.chain_id())?; + let invalid = vec![ + ("nonce too high", vec![deposit.clone(), nonce_too_high]), + ("sender cannot pay", vec![transfer.clone()]), + ( + "two 0x7D", + vec![ + deposit.clone(), + transfer.clone(), + post_exec(1, vec![refund(1, 1)]), + post_exec(1, vec![refund(1, 1)]), + ], + ), + ( + "0x7D anchored to the next block", + vec![deposit.clone(), transfer.clone(), post_exec(2, vec![refund(1, 1)])], + ), + ("empty refund entries", vec![deposit.clone(), transfer.clone(), post_exec(1, vec![])]), + ( + "refund targets a deposit", + vec![deposit.clone(), transfer.clone(), post_exec(1, vec![refund(0, 1)])], + ), + ( + "refund above evmGasUsed", + vec![deposit.clone(), transfer.clone(), post_exec(1, vec![refund(1, 21_001)])], + ), + ( + "refund entry past the last tx", + vec![deposit.clone(), transfer.clone(), post_exec(1, vec![refund(1, 1), refund(5, 1)])], + ), + ( + "0x7D is not the last tx", + vec![deposit.clone(), post_exec(1, vec![refund(1, 1)]), transfer.clone()], + ), + ]; + let valid = vec![deposit, transfer, post_exec(1, vec![refund(1, 1)])]; + run(chain_spec, invalid, valid, vec![next_deposit]).await +} + +#[tokio::test(flavor = "multi_thread")] +async fn invalid_derived_transactions_are_rejected_at_fcu_before_holocene() -> eyre::Result<()> { + let chain_spec = Arc::new(OpChainSpecBuilder::optimism_sepolia().ecotone_activated().build()); + let Txs { deposit, next_deposit, transfer, nonce_too_high } = Txs::new(chain_spec.chain_id())?; + let invalid = vec![ + ("nonce too high", vec![deposit.clone(), nonce_too_high]), + ("sender cannot pay", vec![transfer.clone()]), + ( + "0x7D before SDM", + vec![deposit.clone(), transfer.clone(), post_exec(1, vec![refund(1, 1)])], + ), + ]; + run(chain_spec, invalid, vec![deposit, transfer], vec![next_deposit]).await +} + +/// How the derived builder of [`FailingEngineApi`] fails. +#[derive(Clone)] +enum Failure { + /// The parent's state is unavailable. + MissingState, + Panic, + /// Signals `entered`, then waits for `release` before failing like `MissingState`. + Held { + entered: mpsc::Sender<()>, + release: Arc>>, + }, +} + +impl DerivedPayloadBuilder for Failure { + fn build_derived_payload( + &self, + parent: SealedHeader, + _attributes: OpPayloadAttrs, + _id: PayloadId, + ) -> Result { + match self { + Self::MissingState => {} + Self::Panic => panic!("derived build panicked"), + Self::Held { entered, release } => { + entered.send(()).unwrap(); + release.lock().unwrap().recv().unwrap(); + } + } + Err(ProviderError::StateForHashNotFound(parent.hash()).into()) + } +} + +/// [`reth_optimism_node::OpEngineApiBuilder`], with a derived builder that fails. +#[derive(Clone)] +struct FailingEngineApi(Failure); + +type Validator = >::Validator; + +impl EngineApiBuilder for FailingEngineApi +where + N: FullNodeComponents, + OpEngineValidatorBuilder: PayloadValidatorBuilder, + Validator: EngineApiValidator + + PayloadValidator + + Clone, + OpEngineApi, OpChainSpec>: + IntoEngineApiRpcModule + Send + Sync + 'static, +{ + type EngineApi = OpEngineApi, OpChainSpec>; + + async fn build_engine_api(self, ctx: &AddOnsContext<'_, N>) -> eyre::Result { + let validator = OpEngineValidatorBuilder::default().build(ctx).await?; + let inner = EngineApi::new( + ctx.node.provider().clone(), + ctx.config.chain.clone(), + ctx.beacon_engine_handle.clone(), + PayloadStore::new(ctx.node.payload_builder_handle().clone()), + ctx.node.pool().clone(), + ctx.node.task_executor().clone(), + ClientVersionV1 { + code: ClientCode::RH, + name: "op-reth".to_string(), + version: String::new(), + commit: String::new(), + }, + EngineCapabilities::new(OP_ENGINE_CAPABILITIES.iter().copied()), + validator.clone(), + ctx.config.engine.accept_execution_requests_hash, + ctx.node.network().clone(), + ); + let payloads = DerivedPayloads::new( + self.0, + ctx.node.payload_builder_handle().clone(), + ctx.node.task_executor().clone(), + ); + Ok(OpEngineApi::new(inner, ctx.node.provider().clone(), validator, payloads)) + } +} + +/// Derived attributes on an Ecotone chain, whose payload the payload service can build. +fn ecotone_derived() -> eyre::Result<(Arc, OpPayloadAttrs)> { + let chain_spec = Arc::new(OpChainSpecBuilder::optimism_sepolia().ecotone_activated().build()); + let Txs { deposit, transfer, .. } = Txs::new(chain_spec.chain_id())?; + let mut attrs = optimism_payload_attributes(chain_spec.genesis_header().timestamp + 2); + attrs.0.no_tx_pool = Some(true); + attrs.0.transactions = Some(vec![deposit, transfer]); + Ok((chain_spec, attrs)) +} + +/// `debug_executePayload` gives the fault proof program the witness of a derived block up to its +/// invalid transaction, where the program stops executing it. +#[tokio::test(flavor = "multi_thread")] +async fn witness_covers_a_derived_block_up_to_its_invalid_transaction() -> eyre::Result<()> { + let chain_spec = Arc::new(OpChainSpecBuilder::optimism_sepolia().ecotone_activated().build()); + let Txs { deposit, nonce_too_high, .. } = Txs::new(chain_spec.chain_id())?; + let mut config = NodeConfig::test().map_chain(chain_spec.clone()).with_unused_ports(); + config.network.discovery.discv5_port = Some(0); + config.network.discovery.discv5_port_ipv6 = Some(0); + let op_node = OpNode::default(); + let node = NodeBuilder::new(config) + .testing_node(Runtime::test()) + .with_types::() + .with_components(op_node.components()) + .with_add_ons(op_node.add_ons()) + .launch() + .await? + .node; + + let parent = node.provider.sealed_header_by_hash(chain_spec.genesis_hash())?.unwrap(); + let mut attrs = optimism_payload_attributes(parent.timestamp + 2); + attrs.0.no_tx_pool = Some(true); + attrs.0.transactions = Some(vec![deposit, nonce_too_high]); + let builder = + OpPayloadBuilder::<_, _, _, (), OpPayloadBuilderAttributes>::new( + node.pool.clone(), + node.provider.clone(), + node.evm_config, + ); + + let witness = builder.payload_witness(parent, attrs.0)?; + assert!(!witness.state.is_empty(), "the deposit's state is in the witness"); + Ok(()) +} + +/// Derived attributes that reth rejects, or that come with an unknown head, get reth's own +/// response, the one it gives the same attributes without `noTxPool`. +#[tokio::test(flavor = "multi_thread")] +async fn derived_attributes_get_reths_response_when_not_built() -> eyre::Result<()> { + let (chain_spec, attrs) = ecotone_derived()?; + let mut config = NodeConfig::test().map_chain(chain_spec.clone()).with_unused_ports(); + config.network.discovery.discv5_port = Some(0); + config.network.discovery.discv5_port_ipv6 = Some(0); + let op_node = OpNode::default(); + let node = NodeBuilder::new(config) + .testing_node(Runtime::test()) + .with_types::() + .with_components(op_node.components()) + .with_add_ons(op_node.add_ons()) + .launch() + .await? + .node; + let client = node.auth_server_handle().http_client(); + let genesis = ForkchoiceState::same_hash(chain_spec.genesis_hash()); + + let mut not_after_parent = attrs.clone(); + not_after_parent.0.payload_attributes.timestamp = chain_spec.genesis_header().timestamp; + let mut no_beacon_root = attrs.clone(); + no_beacon_root.0.payload_attributes.parent_beacon_block_root = None; + let unknown_head = ForkchoiceState::same_hash(B256::repeat_byte(0xab)); + let cases = [ + ("timestamp not after the parent", genesis, not_after_parent), + ("no parent beacon block root", genesis, no_beacon_root), + ("unknown head", unknown_head, attrs), + ]; + + for (case, state, derived) in cases { + assert!(builds_at_forkchoice_updated(&derived), "{case}"); + let mut sequenced = derived.clone(); + sequenced.0.no_tx_pool = None; + let expected = format!("{:?}", fcu(&client, state, &sequenced).await); + let actual = format!("{:?}", fcu(&client, state, &derived).await); + assert_eq!(actual, expected, "{case}"); + } + Ok(()) +} + +#[tokio::test(flavor = "multi_thread")] +async fn node_local_build_failures_fall_back_to_the_payload_service() -> eyre::Result<()> { + let (chain_spec, attrs) = ecotone_derived()?; + assert!(builds_at_forkchoice_updated(&attrs)); + let head = ForkchoiceState::same_hash(chain_spec.genesis_hash()); + + for failure in [Failure::MissingState, Failure::Panic] { + let mut config = NodeConfig::test().map_chain(chain_spec.clone()).with_unused_ports(); + config.network.discovery.discv5_port = Some(0); + config.network.discovery.discv5_port_ipv6 = Some(0); + let op_node = OpNode::default(); + let node = NodeBuilder::new(config) + .testing_node(Runtime::test()) + .with_types::() + .with_components(op_node.components()) + .with_add_ons(op_node.add_ons().with_engine_api(FailingEngineApi(failure))) + .launch() + .await? + .node; + let client = node.auth_server_handle().http_client(); + + let updated = fcu(&client, head, &attrs).await?; + assert!(updated.payload_status.is_valid(), "{updated:?}"); + let id = updated.payload_id.expect("the payload service builds the attributes"); + assert!(node.payload_builder_handle.payload_timestamp(id).await.is_some()); + + let payload: OpExecutionPayloadEnvelopeV3 = + client.request("engine_getPayloadV3", rpc_params![id]).await?; + assert_eq!( + Some(&payload.execution_payload.payload_inner.payload_inner.transactions), + attrs.0.transactions.as_ref(), + ); + let status: PayloadStatus = client + .request( + "engine_newPayloadV3", + rpc_params![ + payload.execution_payload, + Vec::::new(), + payload.parent_beacon_block_root + ], + ) + .await?; + assert!(status.is_valid(), "{status:?}"); + } + Ok(()) +} + +/// A forkchoice update waits until a derived build and its fallback are done, so the fallback +/// cannot overwrite it. +#[tokio::test(flavor = "multi_thread")] +async fn forkchoice_updates_wait_for_a_derived_build() -> eyre::Result<()> { + let (chain_spec, attrs) = ecotone_derived()?; + let (entered_tx, entered) = mpsc::channel(); + let (release, release_rx) = mpsc::channel(); + let failure = Failure::Held { entered: entered_tx, release: Arc::new(Mutex::new(release_rx)) }; + + let mut config = NodeConfig::test().map_chain(chain_spec.clone()).with_unused_ports(); + config.network.discovery.discv5_port = Some(0); + config.network.discovery.discv5_port_ipv6 = Some(0); + let op_node = OpNode::default(); + let node = NodeBuilder::new(config) + .testing_node(Runtime::test()) + .with_types::() + .with_components(op_node.components()) + .with_add_ons(op_node.add_ons().with_engine_api(FailingEngineApi(failure))) + .launch() + .await? + .node; + let client = node.auth_server_handle().http_client(); + let head = ForkchoiceState::same_hash(chain_spec.genesis_hash()); + + let derived = tokio::spawn({ + let client = client.clone(); + async move { fcu(&client, head, &attrs).await } + }); + tokio::task::spawn_blocking(move || entered.recv()).await??; + let mut plain = tokio::spawn({ + let client = client.clone(); + async move { + client + .request::("engine_forkchoiceUpdatedV3", rpc_params![head]) + .await + } + }); + assert!( + tokio::time::timeout(Duration::from_millis(500), &mut plain).await.is_err(), + "a forkchoice update must not run while a derived build is in progress", + ); + + release.send(())?; + let updated = derived.await??; + assert!(plain.await??.payload_status.is_valid()); + // Resolving the payload job lets its build finish before the node shuts down. + let id = updated.payload_id.expect("the payload service builds the attributes"); + let _: OpExecutionPayloadEnvelopeV3 = + client.request("engine_getPayloadV3", rpc_params![id]).await?; + Ok(()) +} diff --git a/rust/op-reth/crates/node/tests/it/main.rs b/rust/op-reth/crates/node/tests/it/main.rs index ae2d4c4c9d4..16980aea6a2 100644 --- a/rust/op-reth/crates/node/tests/it/main.rs +++ b/rust/op-reth/crates/node/tests/it/main.rs @@ -22,4 +22,6 @@ mod p2p_version; mod payload_handoff; +mod derived_attributes; + const fn main() {} diff --git a/rust/op-reth/crates/payload/Cargo.toml b/rust/op-reth/crates/payload/Cargo.toml index 973e0658a26..832c946a104 100644 --- a/rust/op-reth/crates/payload/Cargo.toml +++ b/rust/op-reth/crates/payload/Cargo.toml @@ -45,6 +45,7 @@ alloy-rpc-types-engine.workspace = true alloy-rpc-types-debug.workspace = true alloy-consensus.workspace = true alloy-evm.workspace = true +alloy-op-evm.workspace = true # misc derive_more.workspace = true diff --git a/rust/op-reth/crates/payload/src/builder.rs b/rust/op-reth/crates/payload/src/builder.rs index 7522d964722..7ae3614fb1d 100644 --- a/rust/op-reth/crates/payload/src/builder.rs +++ b/rust/op-reth/crates/payload/src/builder.rs @@ -6,12 +6,13 @@ use crate::{ use alloy_consensus::{BlockHeader, Sealable, Transaction, Typed2718, transaction::Recovered}; use alloy_eips::eip2718::Encodable2718; use alloy_evm::Evm as AlloyEvm; +use alloy_op_evm::block::OpBlockExecutionError; use alloy_primitives::{Address, B256, Sealed, U256}; use alloy_rpc_types_debug::ExecutionWitness; use alloy_rpc_types_engine::PayloadId; use op_alloy_consensus::{ - ParsedPostExecPayload, SDMGasEntry, TxPostExec, build_post_exec_tx, - parse_post_exec_payload_from_transactions, total_gas_refund, + ParsedPostExecPayload, PostExecPayloadValidationError, SDMGasEntry, TxPostExec, + build_post_exec_tx, parse_post_exec_payload_from_transactions, total_gas_refund, }; use op_revm::{L1BlockInfo, constants::L1_BLOCK_CONTRACT}; use reth_basic_payload_builder::*; @@ -484,9 +485,10 @@ impl OpBuilder<'_, Txs> { let mut builder = ctx.block_builder_with_mode(&mut db, post_exec_mode)?; // 1. apply pre-execution changes - builder.apply_pre_execution_changes().map_err(|err| { + // Propagated as an execution error, so that `is_invalid_derived_payload_error` classifies + // an invalid `0x7D`, which is rejected here, as invalid attributes. + builder.apply_pre_execution_changes().inspect_err(|err| { warn!(target: "payload_builder", %err, "failed to apply pre-execution changes"); - PayloadBuilderError::Internal(err.into()) })?; // 2. execute sequencer transactions @@ -570,6 +572,9 @@ impl OpBuilder<'_, Txs> { } /// Builds the payload and returns its [`ExecutionWitness`] based on the state after execution. + /// + /// If a transaction makes a derived payload invalid, the witness covers the state read up to + /// that transaction. pub fn witness( self, state_provider: impl StateProvider, @@ -592,11 +597,22 @@ impl OpBuilder<'_, Txs> { .with_database(StateProviderDatabase::new(&state_provider)) .with_bundle_update() .build(); - let mut builder = ctx.block_builder(&mut db)?; - - builder.apply_pre_execution_changes()?; - ctx.execute_sequencer_transactions(&mut builder, None)?; - builder.into_executor().apply_post_execution_changes()?; + let executed = (|| { + let mut builder = ctx.block_builder(&mut db)?; + builder.apply_pre_execution_changes()?; + ctx.execute_sequencer_transactions(&mut builder, None)?; + builder.into_executor().apply_post_execution_changes()?; + Ok::<_, PayloadBuilderError>(()) + })(); + match executed { + Ok(()) => {} + // The fault proof program stops executing a derived block at its first invalid + // transaction, so it needs the state read up to there. + Err(err) if is_invalid_derived_payload_error(&err) => { + debug!(target: "payload_builder", %err, "witness covers the payload up to its invalid transaction"); + } + Err(err) => return Err(err), + } if ctx.chain_spec.is_isthmus_active_at_timestamp(ctx.attributes().timestamp()) { // force load `L2ToL1MessagePasser.sol` so l2 withdrawals root can be computed even if @@ -613,6 +629,64 @@ impl OpBuilder<'_, Txs> { } } +/// Returns whether building a derived (`noTxPool`) payload failed because of its transactions. +/// +/// Only these failures may be reported as invalid payload attributes, which makes the rollup node +/// replace the block with a deposits-only one. A node-local failure reported that way would derive +/// a wrong block, so every other error must stay retryable. +pub fn is_invalid_derived_payload_error(err: &PayloadBuilderError) -> bool { + match err { + PayloadBuilderError::EvmExecutionError(e) => { + e.downcast_ref::().is_some_and(is_invalid_payload_error) + } + // An undecodable, blob or unrecoverable transaction, or a malformed `0x7D`. + PayloadBuilderError::Other(e) => { + e.is::() || + e.is::() || + e.downcast_ref::() + .is_some_and(is_invalid_op_payload_error) + } + _ => false, + } +} + +fn is_invalid_payload_error(err: &BlockExecutionError) -> bool { + match err { + BlockExecutionError::Validation( + BlockValidationError::InvalidTx { .. } | + BlockValidationError::TransactionGasLimitMoreThanAvailableBlockGas { .. } | + BlockValidationError::BlockGasExceeded, + ) => true, + BlockExecutionError::Validation(BlockValidationError::Other(e)) => { + e.downcast_ref::().is_some_and(is_invalid_op_execution_error) + } + _ => false, + } +} + +// Exhaustive, like `is_invalid_op_execution_error`, so a new variant must be classified: one that +// defaults to node-local would stall derivation on every node. +const fn is_invalid_op_payload_error(err: &OpPayloadBuilderError) -> bool { + match err { + OpPayloadBuilderError::TransactionEcRecoverFailed | + OpPayloadBuilderError::BlobTransactionRejected => true, + OpPayloadBuilderError::L1BlockInfoParseFailed | + OpPayloadBuilderError::AccountLoadFailed(_) | + OpPayloadBuilderError::ForceCreate2DeployerFail => false, + } +} + +const fn is_invalid_op_execution_error(err: &OpBlockExecutionError) -> bool { + match err { + OpBlockExecutionError::TransactionDaFootprintAboveGasLimit { .. } | + OpBlockExecutionError::UnexpectedNonDepositTxInForkActivationBlock | + OpBlockExecutionError::InvalidPostExecPayload(_) | + OpBlockExecutionError::PostExecSettlementUnderflow { .. } => true, + OpBlockExecutionError::LoadCacheAccount | + OpBlockExecutionError::GetJovianDaFootprintScalar(_) => false, + } +} + /// The gas a committed transaction used, in both of the senses a block builder needs. /// /// Both are reported because which one is correct depends on the question being asked: @@ -1008,10 +1082,11 @@ where let gas_used = match builder.execute_transaction(sequencer_tx.clone()) { Ok(gas_used) => gas_used, + // A derived block must be reproduced exactly, so an invalid transaction fails it. Err(BlockExecutionError::Validation(BlockValidationError::InvalidTx { error, .. - })) => { + })) if !self.force_empty() => { trace!(target: "payload_builder", %error, ?sequencer_tx, "Error in sequencer transaction, skipping."); continue; } diff --git a/rust/op-reth/crates/payload/src/builder/tests.rs b/rust/op-reth/crates/payload/src/builder/tests.rs index 1e32e8c398a..0f4ea754f4c 100644 --- a/rust/op-reth/crates/payload/src/builder/tests.rs +++ b/rust/op-reth/crates/payload/src/builder/tests.rs @@ -1,8 +1,9 @@ use super::{ CommittedTxGas, ExecutionInfo, OpPayloadBuilderCtx, PayloadTransactionsWithCommitHook, - RethPayloadTransactions, build_post_exec_recovered_tx, try_include_post_exec_tx, + RethPayloadTransactions, build_post_exec_recovered_tx, is_invalid_derived_payload_error, + try_include_post_exec_tx, }; -use crate::{OpPayloadBuilderAttributes, config::OpBuilderConfig}; +use crate::{OpPayloadBuilderAttributes, config::OpBuilderConfig, error::OpPayloadBuilderError}; use alloy_consensus::{ Header, Sealable, SignableTransaction, Transaction, TxEip1559, Typed2718, transaction::{Recovered, TxHashRef}, @@ -12,15 +13,17 @@ use alloy_eips::{ eip2930::{AccessList, AccessListItem}, eip7702::SignedAuthorization, }; -use alloy_evm::RecoveredTx; +use alloy_evm::{RecoveredTx, block::BlockExecutionError as AlloyBlockExecutionError}; +use alloy_op_evm::block::OpBlockExecutionError; use alloy_primitives::{Address, B64, B256, Bytes, Signature, TxHash, TxKind, U256}; use alloy_rpc_types_eth::erc4337::TransactionConditional; use op_alloy_consensus::{ - POST_EXEC_PAYLOAD_VERSION, PostExecPayload, SDMGasEntry, TxDeposit, build_post_exec_tx, + POST_EXEC_PAYLOAD_VERSION, PostExecPayload, PostExecPayloadValidationError, SDMGasEntry, + TxDeposit, build_post_exec_tx, }; use reth_basic_payload_builder::PayloadConfig; use reth_chainspec::MIN_TRANSACTION_GAS; -use reth_evm::execute::{BlockBuilder, BlockExecutionError}; +use reth_evm::execute::{BlockBuilder, BlockExecutionError, BlockValidationError}; use reth_optimism_chainspec::{OpChainSpec, OpChainSpecBuilder}; use reth_optimism_evm::{OpEvmConfig, PostExecMode, PreRefundGasUsed}; use reth_optimism_primitives::{OpPrimitives, OpTransactionSigned}; @@ -35,7 +38,9 @@ use reth_payload_builder_primitives::PayloadBuilderError; use reth_payload_util::PayloadTransactionsFixed; use reth_primitives_traits::{Account, InMemorySize, SealedHeader}; use reth_revm::{database::StateProviderDatabase, db::State, test_utils::StateProviderTest}; +use reth_storage_api::errors::ProviderError; use reth_transaction_pool::PoolTransaction; +use revm::context::result::{EVMError, InvalidTransaction}; use std::{borrow::Cow, cell::Cell, sync::Arc}; fn entries(specs: &[(u64, u64)]) -> Vec { @@ -988,3 +993,127 @@ fn execute_best_transactions_excludes_interop_txs_when_failsafe_active() { failsafe.set(false); assert_eq!(build(&failsafe), vec![normal_hash, interop_hash]); } + +/// Only errors caused by the payload's transactions may be classified as invalid: a state-access +/// error reported as invalid would make the rollup node derive a wrong deposit-only block. +#[test] +fn derived_payload_error_classification() { + let validation = + |err: BlockValidationError| PayloadBuilderError::from(BlockExecutionError::from(err)); + let op_execution = + |err: OpBlockExecutionError| validation(BlockValidationError::Other(Box::new(err))); + let op_payload = PayloadBuilderError::other::; + let invalid_post_exec = || OpBlockExecutionError::InvalidPostExecPayload("x".into()); + let cases = [ + ( + validation(BlockValidationError::InvalidTx { + hash: B256::ZERO, + error: Box::new(InvalidTransaction::NonceTooHigh { tx: 5, state: 0 }), + }), + true, + ), + (validation(BlockValidationError::BlockGasExceeded), true), + ( + validation(BlockValidationError::TransactionGasLimitMoreThanAvailableBlockGas { + transaction_gas_limit: 2, + block_available_gas: 1, + }), + true, + ), + (op_execution(invalid_post_exec()), true), + ( + op_execution(OpBlockExecutionError::TransactionDaFootprintAboveGasLimit { + transaction_da_footprint: 2, + available_block_da_footprint: 1, + }), + true, + ), + (op_execution(OpBlockExecutionError::UnexpectedNonDepositTxInForkActivationBlock), true), + ( + op_execution(OpBlockExecutionError::PostExecSettlementUnderflow { + address: Address::ZERO, + delta: U256::from(1), + }), + true, + ), + (op_execution(OpBlockExecutionError::LoadCacheAccount), false), + (op_execution(OpBlockExecutionError::GetJovianDaFootprintScalar("x".into())), false), + (PayloadBuilderError::other(alloy_rlp::Error::UnexpectedLength), true), + ( + PayloadBuilderError::other(PostExecPayloadValidationError::UnexpectedPostExecTx { + tx_index: 0, + }), + true, + ), + (op_payload(OpPayloadBuilderError::TransactionEcRecoverFailed), true), + (op_payload(OpPayloadBuilderError::BlobTransactionRejected), true), + (op_payload(OpPayloadBuilderError::L1BlockInfoParseFailed), false), + (op_payload(OpPayloadBuilderError::AccountLoadFailed(Address::ZERO)), false), + (op_payload(OpPayloadBuilderError::ForceCreate2DeployerFail), false), + (PayloadBuilderError::MissingParentHeader(B256::ZERO), false), + // Pins only the classifier. The node test's "empty refund entries" case, rejected during + // pre-execution, is what catches `OpBuilder::build` reporting that error as `Internal`. + ( + PayloadBuilderError::Internal( + BlockExecutionError::from(BlockValidationError::Other(Box::new( + invalid_post_exec(), + ))) + .into(), + ), + false, + ), + // The parent's state is unavailable. + (ProviderError::StateForHashNotFound(B256::ZERO).into(), false), + (BlockExecutionError::other(ProviderError::StateForHashNotFound(B256::ZERO)).into(), false), + // A state read fails while a transaction executes. + ( + PayloadBuilderError::from(AlloyBlockExecutionError::evm( + EVMError::::Database( + ProviderError::StateForHashNotFound(B256::ZERO), + ), + B256::ZERO, + )), + false, + ), + ]; + + for (err, expected) in cases { + assert_eq!(is_invalid_derived_payload_error(&err), expected, "{err:?}"); + } +} + +/// A derived block must be reproduced exactly, so an invalid transaction in its attributes fails +/// the rebuild. A sequencer's own block skips it instead. +#[test] +fn invalid_forced_transaction_fails_only_a_derived_rebuild() { + let tx = TxEip1559 { + chain_id: 10, + nonce: 5, + gas_limit: MIN_TRANSACTION_GAS, + max_fee_per_gas: 1, + to: TxKind::Call(Address::ZERO), + ..Default::default() + }; + let tx = OpTransactionSigned::Eip1559(tx.into_signed(Signature::test_signature())); + let invalid = WithEncoded::new(Bytes::from(tx.encoded_2718()), tx); + + for no_tx_pool in [false, true] { + let mut ctx = interop_ctx(no_tx_pool, false, None); + ctx.config.attributes.transactions = vec![deposit_with_encoded(), invalid.clone()]; + let state_provider = StateProviderTest::default(); + let mut db = State::builder() + .with_database(StateProviderDatabase::new(&state_provider)) + .with_bundle_update() + .build(); + let mut builder = ctx.block_builder(&mut db).expect("block builder can be created"); + + let result = ctx.execute_sequencer_transactions(&mut builder, None); + + if no_tx_pool { + let err = result.expect_err("a derived rebuild must fail on an invalid transaction"); + assert!(is_invalid_derived_payload_error(&err), "{err:?}"); + } else { + assert!(result.is_ok(), "a sequencer skips an invalid forced transaction: {result:?}"); + } + } +} diff --git a/rust/op-reth/crates/payload/src/lib.rs b/rust/op-reth/crates/payload/src/lib.rs index 3b1e5a6ddc2..ea638be4537 100644 --- a/rust/op-reth/crates/payload/src/lib.rs +++ b/rust/op-reth/crates/payload/src/lib.rs @@ -14,6 +14,7 @@ extern crate alloc; pub mod builder; pub use builder::{ CommittedTxGas, OpPayloadBuilder, PayloadTransactionsWithCommitHook, RethPayloadTransactions, + is_invalid_derived_payload_error, }; pub mod error; pub mod payload; diff --git a/rust/op-reth/crates/rpc/Cargo.toml b/rust/op-reth/crates/rpc/Cargo.toml index 1a59c2078cf..5e8687eef14 100644 --- a/rust/op-reth/crates/rpc/Cargo.toml +++ b/rust/op-reth/crates/rpc/Cargo.toml @@ -31,6 +31,7 @@ reth-chainspec.workspace = true reth-chain-state.workspace = true reth-rpc-engine-api.workspace = true reth-payload-util.workspace = true +reth-payload-builder.workspace = true reth-provider.workspace = true # op-reth diff --git a/rust/op-reth/crates/rpc/src/engine.rs b/rust/op-reth/crates/rpc/src/engine.rs index 5d835449215..e381d27fe31 100644 --- a/rust/op-reth/crates/rpc/src/engine.rs +++ b/rust/op-reth/crates/rpc/src/engine.rs @@ -1,25 +1,38 @@ //! Implements the Optimism engine API RPC methods. +mod derived; +pub use derived::{ + DerivedBuild, DerivedPayloadBuilder, DerivedPayloads, builds_at_forkchoice_updated, +}; + +use alloy_consensus::BlockHeader; use alloy_eips::eip7685::Requests; use alloy_primitives::{B256, BlockHash, U64}; use alloy_rpc_types_engine::{ ClientVersionV1, ExecutionPayloadBodiesV1, ExecutionPayloadInputV2, ExecutionPayloadV3, - ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus, + ForkchoiceState, ForkchoiceUpdated, INVALID_PAYLOAD_ATTRIBUTES_ERROR, + INVALID_PAYLOAD_ATTRIBUTES_ERROR_MSG, PayloadId, PayloadStatus, }; -use derive_more::Constructor; use jsonrpsee::proc_macros::rpc; use jsonrpsee_core::{RpcResult, server::RpcModule}; +use jsonrpsee_types::ErrorObject; use op_alloy_rpc_types_engine::OpExecutionPayloadV4; +use reth_basic_payload_builder::HeaderForPayload; use reth_chainspec::EthereumHardforks; -use reth_node_api::{EngineApiValidator, EngineTypes}; -use reth_optimism_payload_builder::OpExecData; +use reth_node_api::{ + BuiltPayload, EngineApiMessageVersion, EngineApiValidator, EngineTypes, MessageValidationKind, + PayloadAttributes, PayloadValidator, validate_payload_timestamp, +}; +use reth_optimism_payload_builder::{OpExecData, OpPayloadAttrs}; +use reth_primitives_traits::Block; use reth_rpc_api::IntoEngineApiRpcModule; -use reth_rpc_engine_api::EngineApi; +use reth_rpc_engine_api::{EngineApi, EngineApiError, EngineApiResult}; use reth_storage_api::{BalProvider, BlockReader, HeaderProvider, StateProviderFactory}; use reth_transaction_pool::TransactionPool; -use tracing::{debug, trace}; +use std::{fmt, sync::Arc}; +use tracing::{debug, trace, warn}; -/// UPSTREAM-MIRROR(set): reth@rev:0fbe428 `reth_rpc_engine_api::capabilities::CAPABILITIES` +/// UPSTREAM-MIRROR(set): reth@rev:0a81846 `reth_rpc_engine_api::capabilities::CAPABILITIES` /// /// Advertised capabilities must stay in step with the methods declared on [`OpEngineApi`]. /// The list of all supported Engine capabilities available over the engine endpoint. @@ -50,7 +63,7 @@ pub const OP_ENGINE_CAPABILITIES: &[&str] = &[ /// #[cfg_attr(not(feature = "client"), rpc(server, namespace = "engine"), server_bounds(Engine::PayloadAttributes: jsonrpsee::core::DeserializeOwned))] #[cfg_attr(feature = "client", rpc(server, client, namespace = "engine", client_bounds(Engine::PayloadAttributes: jsonrpsee::core::Serialize + Clone), server_bounds(Engine::PayloadAttributes: jsonrpsee::core::DeserializeOwned)))] -/// UPSTREAM-MIRROR(set): reth@rev:0fbe428 `reth_rpc_api::EngineApi` +/// UPSTREAM-MIRROR(set): reth@rev:0a81846 `reth_rpc_api::EngineApi` /// /// Re-declares the engine RPC surface rather than extending upstream's trait. A method added /// upstream produces no diff here, so compare the method sets on each bump and update @@ -253,9 +266,50 @@ pub trait OpEngineApi { /// The Engine API implementation that grants the Consensus layer access to data and /// functions in the Execution layer that are crucial for the consensus process. -#[derive(Debug, Constructor)] +/// +/// It builds the payload of derived attributes (see [`builds_at_forkchoice_updated`]) while +/// answering `engine_forkchoiceUpdated`, so that it can reject transactions that make the payload +/// invalid with `-38003` (invalid payload attributes), and serves that payload from +/// `engine_getPayload`. Everything else goes to reth's [`EngineApi`]. +#[derive(Debug)] pub struct OpEngineApi { inner: EngineApi, + derived: Arc>, +} + +/// What [`OpEngineApi`] needs to build derived payloads. +struct Derived { + provider: Provider, + validator: Validator, + payloads: DerivedPayloads, + /// Held for the whole of an `engine_forkchoiceUpdated` call. A derived build and the + /// forkchoice update that may follow it then act as one step, as in reth's engine, so a + /// newer forkchoice update can never be overwritten by an older one. + forkchoice: tokio::sync::Mutex<()>, +} + +impl fmt::Debug + for Derived +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Derived").field("payloads", &self.payloads).finish_non_exhaustive() + } +} + +impl + OpEngineApi +{ + /// Creates a new instance that delegates to `inner`, and builds derived payloads on top of + /// `provider`'s state after validating their attributes with `validator`. + pub fn new( + inner: EngineApi, + provider: Provider, + validator: Validator, + payloads: DerivedPayloads, + ) -> Self { + let forkchoice = Default::default(); + Self { inner, derived: Arc::new(Derived { provider, validator, payloads, forkchoice }) } + } } impl Clone @@ -264,7 +318,147 @@ where PayloadT: EngineTypes, { fn clone(&self) -> Self { - Self { inner: self.inner.clone() } + Self { inner: self.inner.clone(), derived: self.derived.clone() } + } +} + +impl + OpEngineApi +where + Provider: HeaderProvider
> + + BlockReader + + StateProviderFactory + + BalProvider + + 'static, + EngineT: EngineTypes, + Pool: TransactionPool + 'static, + Validator: EngineApiValidator + + PayloadValidator>, + ChainSpec: EthereumHardforks + Send + Sync + 'static, +{ + async fn inner_fork_choice_updated( + &self, + version: EngineApiMessageVersion, + state: ForkchoiceState, + attrs: Option, + ) -> EngineApiResult { + match version { + EngineApiMessageVersion::V1 => { + self.inner.fork_choice_updated_v1_metered(state, attrs).await + } + EngineApiMessageVersion::V2 => { + self.inner.fork_choice_updated_v2_metered(state, attrs).await + } + // The OP engine API ends at engine_forkchoiceUpdatedV3. + _ => self.inner.fork_choice_updated_v3_metered(state, attrs).await, + } + } + + /// Updates the forkchoice. Builds the payload of derived attributes before answering, and + /// leaves any other attributes to the payload service. + async fn fork_choice_updated( + &self, + version: EngineApiMessageVersion, + state: ForkchoiceState, + attrs: Option, + ) -> EngineApiResult { + let _forkchoice = self.derived.forkchoice.lock().await; + let attrs = match attrs { + Some(attrs) if builds_at_forkchoice_updated(&attrs) => attrs, + attrs => return self.inner_fork_choice_updated(version, state, attrs).await, + }; + match self.build_derived(version, state, &attrs).await { + Some(updated) => updated, + None => self.inner_fork_choice_updated(version, state, Some(attrs)).await, + } + } + + /// Updates the forkchoice to `state` and builds the payload of the derived `attrs` on top of + /// its head. + /// + /// Returns `None` if reth has to answer instead: when it rejects the attributes, so its exact + /// response is kept, and when the build fails for a node-local reason, so the payload service + /// builds them and the rollup node can retry. + /// + /// UPSTREAM-MIRROR(copy): reth@rev:0a81846 + /// `reth_rpc_engine_api::EngineApi::validate_and_execute_forkchoice` + /// + /// Runs the attribute checks reth makes before it starts a payload job, in its order: the + /// well-formedness check here, then the engine tree's check against the head + /// (`process_payload_attributes`), and computes the payload id as the tree does. A check + /// added upstream must be added here too. The `-38003` for invalid transactions has reth's + /// code and message, with the build error as data. + async fn build_derived( + &self, + version: EngineApiMessageVersion, + state: ForkchoiceState, + attrs: &OpPayloadAttrs, + ) -> Option> { + let derived = &self.derived; + // The checks reth runs on attributes before it starts a payload job. + derived.validator.ensure_well_formed_attributes(version, attrs).ok()?; + let updated = match self.inner_fork_choice_updated(version, state, None).await { + Ok(updated) if updated.is_valid() => updated, + result => return Some(result), + }; + let parent_hash = state.head_block_hash; + let parent = match derived.provider.sealed_header_by_hash(parent_hash) { + Ok(Some(parent)) => parent, + result => { + warn!(target: "rpc::engine", %parent_hash, ?result, "Missing parent of derived payload, building it in the payload service"); + return None; + } + }; + derived + .validator + .validate_payload_attributes_against_header(attrs, parent.header()) + .ok()?; + + let id = attrs.payload_id(&parent_hash); + match derived.payloads.build(parent, attrs.clone(), id).await { + DerivedBuild::Built => Some(Ok(ForkchoiceUpdated { payload_id: Some(id), ..updated })), + DerivedBuild::Invalid(err) => { + warn!(target: "rpc::engine", %err, %parent_hash, %id, "Derived attributes make the payload invalid"); + Some(Err(EngineApiError::other(ErrorObject::owned( + INVALID_PAYLOAD_ATTRIBUTES_ERROR, + INVALID_PAYLOAD_ATTRIBUTES_ERROR_MSG, + Some(serde_json::json!({ "err": err })), + )))) + } + DerivedBuild::Failed(err) => { + warn!(target: "rpc::engine", %err, %parent_hash, %id, "Failed to build derived payload, building it in the payload service"); + None + } + } + } + + /// Returns the derived payload `id` as the envelope of `version`, if it was built at + /// `engine_forkchoiceUpdated`, and hands its executed block to the engine. + /// + /// UPSTREAM-MIRROR(copy): reth@rev:0a81846 `reth_rpc_engine_api::EngineApi::get_payload_inner` + /// + /// Checks the payload's fork against the method version and publishes the payload like a + /// resolved payload job before converting it. + fn derived_payload( + &self, + id: PayloadId, + version: EngineApiMessageVersion, + ) -> EngineApiResult> + where + EngineT::BuiltPayload: TryInto, + { + let Some(payload) = self.derived.payloads.get(id) else { return Ok(None) }; + validate_payload_timestamp( + self.inner.chain_spec(), + version, + payload.block().timestamp(), + MessageValidationKind::GetPayload, + )?; + self.derived.payloads.publish(payload.clone()); + payload.try_into().map(Some).map_err(|_| { + warn!(target: "rpc::engine", ?version, "could not transform built payload"); + EngineApiError::UnknownPayload + }) } } @@ -272,10 +466,15 @@ where impl OpEngineApiServer for OpEngineApi where - Provider: HeaderProvider + BlockReader + StateProviderFactory + BalProvider + 'static, - EngineT: EngineTypes, + Provider: HeaderProvider
> + + BlockReader + + StateProviderFactory + + BalProvider + + 'static, + EngineT: EngineTypes, Pool: TransactionPool + 'static, - Validator: EngineApiValidator, + Validator: EngineApiValidator + + PayloadValidator>, ChainSpec: EthereumHardforks + Send + Sync + 'static, { async fn new_payload_v2(&self, payload: ExecutionPayloadInputV2) -> RpcResult { @@ -323,7 +522,10 @@ where fork_choice_state: ForkchoiceState, payload_attributes: Option, ) -> RpcResult { - Ok(self.inner.fork_choice_updated_v1_metered(fork_choice_state, payload_attributes).await?) + trace!(target: "rpc::engine", "Serving engine_forkchoiceUpdatedV1"); + Ok(self + .fork_choice_updated(EngineApiMessageVersion::V1, fork_choice_state, payload_attributes) + .await?) } async fn fork_choice_updated_v2( @@ -332,7 +534,9 @@ where payload_attributes: Option, ) -> RpcResult { trace!(target: "rpc::engine", "Serving engine_forkchoiceUpdatedV2"); - Ok(self.inner.fork_choice_updated_v2_metered(fork_choice_state, payload_attributes).await?) + Ok(self + .fork_choice_updated(EngineApiMessageVersion::V2, fork_choice_state, payload_attributes) + .await?) } async fn fork_choice_updated_v3( @@ -341,7 +545,9 @@ where payload_attributes: Option, ) -> RpcResult { trace!(target: "rpc::engine", "Serving engine_forkchoiceUpdatedV3"); - Ok(self.inner.fork_choice_updated_v3_metered(fork_choice_state, payload_attributes).await?) + Ok(self + .fork_choice_updated(EngineApiMessageVersion::V3, fork_choice_state, payload_attributes) + .await?) } async fn get_payload_v2( @@ -349,6 +555,9 @@ where payload_id: PayloadId, ) -> RpcResult { debug!(target: "rpc::engine", id = %payload_id, "Serving engine_getPayloadV2"); + if let Some(payload) = self.derived_payload(payload_id, EngineApiMessageVersion::V2)? { + return Ok(payload); + } Ok(self.inner.get_payload_v2_metered(payload_id).await?) } @@ -357,6 +566,9 @@ where payload_id: PayloadId, ) -> RpcResult { trace!(target: "rpc::engine", "Serving engine_getPayloadV3"); + if let Some(payload) = self.derived_payload(payload_id, EngineApiMessageVersion::V3)? { + return Ok(payload); + } Ok(self.inner.get_payload_v3_metered(payload_id).await?) } @@ -365,6 +577,9 @@ where payload_id: PayloadId, ) -> RpcResult { trace!(target: "rpc::engine", "Serving engine_getPayloadV4"); + if let Some(payload) = self.derived_payload(payload_id, EngineApiMessageVersion::V4)? { + return Ok(payload); + } Ok(self.inner.get_payload_v4_metered(payload_id).await?) } @@ -373,6 +588,9 @@ where payload_id: PayloadId, ) -> RpcResult { trace!(target: "rpc::engine", "Serving engine_getPayloadV5"); + if let Some(payload) = self.derived_payload(payload_id, EngineApiMessageVersion::V5)? { + return Ok(payload); + } Ok(self.inner.get_payload_v5_metered(payload_id).await?) } diff --git a/rust/op-reth/crates/rpc/src/engine/derived.rs b/rust/op-reth/crates/rpc/src/engine/derived.rs new file mode 100644 index 00000000000..977683c8709 --- /dev/null +++ b/rust/op-reth/crates/rpc/src/engine/derived.rs @@ -0,0 +1,479 @@ +//! Builds derived (`noTxPool`) payloads inside `engine_forkchoiceUpdated`. + +use alloy_rpc_types_engine::PayloadId; +use futures::{ + FutureExt, + future::{BoxFuture, Shared}, +}; +use metrics::{Counter, Histogram}; +use op_alloy_consensus::DEPOSIT_TX_TYPE_ID; +use reth_basic_payload_builder::{BuildArguments, HeaderForPayload, PayloadBuilder, PayloadConfig}; +use reth_metrics::Metrics; +use reth_node_api::{PayloadBuilderError, PayloadTypes}; +use reth_optimism_payload_builder::{OpPayloadAttrs, is_invalid_derived_payload_error}; +use reth_payload_builder::PayloadBuilderHandle; +use reth_primitives_traits::SealedHeader; +use reth_tasks::Runtime; +use std::{ + collections::{HashMap, VecDeque}, + fmt, + sync::{Arc, Mutex, MutexGuard}, + time::Instant, +}; +use tokio::sync::oneshot; + +/// Number of built derived payloads kept for `engine_getPayload`. +const BUILT_PAYLOADS: usize = 4; + +/// Whether `engine_forkchoiceUpdated` builds derived attributes that carry only deposits, too. +/// +/// Deposits cannot make a payload invalid, so the payload service can build these. +const BUILDS_DEPOSIT_ONLY_ATTRIBUTES: bool = false; + +/// Returns whether `engine_forkchoiceUpdated` builds the payload of `attributes` itself, instead +/// of leaving it to the payload service. +/// +/// These are derived (`noTxPool`) attributes, except those that carry only deposits (see +/// `BUILDS_DEPOSIT_ONLY_ATTRIBUTES`). Any other transaction can make the payload invalid, which +/// the engine must report in its `engine_forkchoiceUpdated` response. +pub fn builds_at_forkchoice_updated(attributes: &OpPayloadAttrs) -> bool { + attributes.no_tx_pool == Some(true) && + (BUILDS_DEPOSIT_ONLY_ATTRIBUTES || has_non_deposit_transaction(attributes)) +} + +fn has_non_deposit_transaction(attributes: &OpPayloadAttrs) -> bool { + attributes.transactions.iter().flatten().any(|tx| tx.first() != Some(&DEPOSIT_TX_TYPE_ID)) +} + +/// Builds the payload of derived attributes on top of a parent block. +pub trait DerivedPayloadBuilder: Send + Sync + 'static { + /// Builds the payload `id` for `attributes` on top of `parent`. + fn build_derived_payload( + &self, + parent: SealedHeader>, + attributes: T::PayloadAttributes, + id: PayloadId, + ) -> Result; +} + +impl DerivedPayloadBuilder for B +where + T: PayloadTypes, + B: PayloadBuilder + 'static, +{ + fn build_derived_payload( + &self, + parent: SealedHeader>, + attributes: T::PayloadAttributes, + id: PayloadId, + ) -> Result { + let config = PayloadConfig::new(Arc::new(parent), attributes, id); + let args = + BuildArguments::new(Default::default(), None, None, config, Default::default(), None); + self.try_build(args)?.into_payload().ok_or(PayloadBuilderError::MissingPayload) + } +} + +/// How building derived attributes ended. +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum DerivedBuild { + /// The payload was built and is kept for `engine_getPayload`. + Built, + /// The attributes' transactions make the payload invalid. + Invalid(Arc), + /// The build failed for a reason local to this node, so it says nothing about the + /// attributes. + Failed(Arc), +} + +/// Metrics of payloads built at `engine_forkchoiceUpdated`. +#[derive(Metrics, Clone)] +#[metrics(scope = "optimism_rpc.engine.derived_payloads")] +struct DerivedPayloadMetrics { + /// Duration of a derived payload build, including the state root. + build_duration: Histogram, + /// Derived payloads built. + built: Counter, + /// Derived attributes rejected because their transactions make the payload invalid. + invalid: Counter, + /// Derived builds that failed for a node-local reason. + failed: Counter, +} + +type SharedBuild = Shared>; + +/// Builds derived payloads and keeps the most recent ones for `engine_getPayload`. +/// +/// Builds run detached from the caller, and at most one runs per payload: a request for a +/// payload that is being built waits for that build, and one for a built payload returns at once. +/// A rollup node that retries after a timeout therefore never starts a second build. Payloads are +/// matched by id and attributes, so attributes whose ids collide are still built. +pub struct DerivedPayloads(Arc>); + +struct Inner { + builder: Box>, + payload_service: PayloadBuilderHandle, + runtime: Runtime, + state: Mutex>, + metrics: DerivedPayloadMetrics, +} + +/// A derived payload kept for `engine_getPayload`. +struct Built { + id: PayloadId, + attributes: T::PayloadAttributes, + payload: T::BuiltPayload, +} + +struct State { + building: HashMap, + built: VecDeque>, +} + +impl DerivedPayloads +where + T: PayloadTypes, +{ + /// Creates a new instance that builds with `builder` on `runtime`. + /// + /// A payload served by `engine_getPayload` is published to `payload_service`, whose + /// subscribers include the engine: it inserts the executed block, so `engine_newPayload` of + /// that block does not execute it again. + pub fn new( + builder: impl DerivedPayloadBuilder, + payload_service: PayloadBuilderHandle, + runtime: Runtime, + ) -> Self { + Self(Arc::new(Inner { + builder: Box::new(builder), + payload_service, + runtime, + state: Mutex::new(State { + building: HashMap::new(), + built: VecDeque::with_capacity(BUILT_PAYLOADS), + }), + metrics: DerivedPayloadMetrics::default(), + })) + } + + /// Builds the payload `id` for `attributes` on top of `parent`, unless it is built or being + /// built already. + pub async fn build( + &self, + parent: SealedHeader>, + attributes: T::PayloadAttributes, + id: PayloadId, + ) -> DerivedBuild { + let build = { + let mut state = self.0.state(); + if state.built.iter().any(|built| built.id == id && built.attributes == attributes) { + return DerivedBuild::Built; + } + match state.building.get(&id) { + Some((building, build)) if *building == attributes => build.clone(), + _ => { + let build = self.spawn_build(parent, attributes.clone(), id); + state.building.insert(id, (attributes, build.clone())); + build + } + } + }; + build.await + } + + fn spawn_build( + &self, + parent: SealedHeader>, + attributes: T::PayloadAttributes, + id: PayloadId, + ) -> SharedBuild { + let (tx, rx) = oneshot::channel(); + let inner = self.0.clone(); + self.0.runtime.spawn_task(async move { + let start = Instant::now(); + let builder = inner.clone(); + let built = attributes.clone(); + let result = inner + .runtime + .spawn_blocking(move || { + builder.builder.build_derived_payload(parent, attributes, id) + }) + .await; + inner.metrics.build_duration.record(start.elapsed()); + let _ = tx.send(inner.finish(id, built, result)); + }); + rx.map(|outcome| { + outcome.unwrap_or_else(|_| DerivedBuild::Failed("derived payload build dropped".into())) + }) + .boxed() + .shared() + } + + /// Returns the derived payload built for `id`. + pub fn get(&self, id: PayloadId) -> Option { + let state = self.0.state(); + state.built.iter().find(|built| built.id == id).map(|built| built.payload.clone()) + } + + /// Hands `payload` to the subscribers of the payload service, like a resolved payload job. + pub fn publish(&self, payload: T::BuiltPayload) { + self.0.payload_service.publish_built_payload(payload); + } +} + +impl Inner +where + T: PayloadTypes, +{ + fn state(&self) -> MutexGuard<'_, State> { + self.state.lock().unwrap_or_else(|e| e.into_inner()) + } + + /// Records the result of building `id` for `attributes`. A panic in the build counts as a + /// node-local failure. + fn finish( + &self, + id: PayloadId, + attributes: T::PayloadAttributes, + result: Result, tokio::task::JoinError>, + ) -> DerivedBuild { + let mut state = self.state(); + if state.building.get(&id).is_some_and(|(building, _)| *building == attributes) { + state.building.remove(&id); + } + match result { + Ok(Ok(payload)) => { + self.metrics.built.increment(1); + state.built.retain(|built| built.id != id); + if state.built.len() == BUILT_PAYLOADS { + state.built.pop_front(); + } + state.built.push_back(Built { id, attributes, payload }); + DerivedBuild::Built + } + Ok(Err(err)) if is_invalid_derived_payload_error(&err) => { + self.metrics.invalid.increment(1); + DerivedBuild::Invalid(err.to_string().into()) + } + Ok(Err(err)) => { + self.metrics.failed.increment(1); + DerivedBuild::Failed(err.to_string().into()) + } + Err(err) => { + self.metrics.failed.increment(1); + DerivedBuild::Failed(err.to_string().into()) + } + } + } +} + +impl Clone for DerivedPayloads { + fn clone(&self) -> Self { + Self(self.0.clone()) + } +} + +impl fmt::Debug for DerivedPayloads { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("DerivedPayloads").finish_non_exhaustive() + } +} + +#[cfg(test)] +mod tests { + use super::*; + use alloy_consensus::Header; + use alloy_primitives::{B256, Bytes, U256}; + use op_alloy_rpc_types_engine::OpPayloadAttributes; + use reth_evm::execute::{BlockExecutionError, BlockValidationError}; + use reth_optimism_payload_builder::{OpBuiltPayload, OpPayloadTypes}; + use reth_optimism_primitives::OpBlock; + use reth_primitives_traits::SealedBlock; + use reth_storage_api::errors::ProviderError; + use revm::context::result::InvalidTransaction; + use std::{ + sync::{ + atomic::{AtomicUsize, Ordering}, + mpsc, + }, + time::Duration, + }; + + type Outcome = fn(PayloadId) -> Result; + + /// Counts its builds, and holds the first one until the test releases it. + struct TestBuilder { + builds: Arc, + gate: Mutex>>, + outcome: Outcome, + } + + impl DerivedPayloadBuilder for TestBuilder { + fn build_derived_payload( + &self, + _parent: SealedHeader, + _attributes: OpPayloadAttrs, + id: PayloadId, + ) -> Result { + self.builds.fetch_add(1, Ordering::SeqCst); + if let Some(gate) = self.gate.lock().unwrap().take() { + gate.recv().unwrap(); + } + (self.outcome)(id) + } + } + + fn built(id: PayloadId) -> Result { + Ok(OpBuiltPayload::new( + id, + Arc::new(SealedBlock::seal_slow(OpBlock::default())), + U256::ZERO, + None, + )) + } + + /// Returns the payloads, the number of builds so far, and the sender releasing the first + /// build, if `gated`. + fn derived_payloads( + gated: bool, + outcome: Outcome, + ) -> (DerivedPayloads, Arc, Option>) { + let builds = Arc::new(AtomicUsize::new(0)); + let (release, gate) = mpsc::channel(); + let builder = TestBuilder { + builds: builds.clone(), + gate: Mutex::new(gated.then_some(gate)), + outcome, + }; + let payloads = DerivedPayloads::new(builder, PayloadBuilderHandle::noop(), Runtime::test()); + (payloads, builds, gated.then_some(release)) + } + + async fn build(payloads: &DerivedPayloads, id: PayloadId) -> DerivedBuild { + let attributes = OpPayloadAttrs(Default::default()); + payloads.build(SealedHeader::seal_slow(Header::default()), attributes, id).await + } + + async fn until(condition: impl Fn() -> bool) { + tokio::time::timeout(Duration::from_secs(10), async { + while !condition() { + tokio::time::sleep(Duration::from_millis(1)).await; + } + }) + .await + .unwrap(); + } + + #[tokio::test(flavor = "multi_thread")] + async fn requests_for_one_payload_share_its_build() { + let (payloads, builds, release) = derived_payloads(true, built); + let id = PayloadId::new([1; 8]); + + let first = tokio::spawn({ + let payloads = payloads.clone(); + async move { build(&payloads, id).await } + }); + until(|| builds.load(Ordering::SeqCst) == 1).await; + // Polled once while the first build is held, so it joins that build. + let mut retry = Box::pin(build(&payloads, id)); + assert!(futures::poll!(&mut retry).is_pending()); + release.unwrap().send(()).unwrap(); + + assert_eq!(first.await.unwrap(), DerivedBuild::Built); + assert_eq!(retry.await, DerivedBuild::Built); + assert_eq!(build(&payloads, id).await, DerivedBuild::Built); + assert_eq!(builds.load(Ordering::SeqCst), 1); + assert!(payloads.get(id).is_some()); + } + + #[tokio::test(flavor = "multi_thread")] + async fn dropped_request_does_not_cancel_its_build() { + let (payloads, builds, release) = derived_payloads(true, built); + let id = PayloadId::new([1; 8]); + + tokio::time::timeout(Duration::from_millis(10), build(&payloads, id)).await.unwrap_err(); + release.unwrap().send(()).unwrap(); + until(|| payloads.get(id).is_some()).await; + + assert_eq!(build(&payloads, id).await, DerivedBuild::Built); + assert_eq!(builds.load(Ordering::SeqCst), 1); + } + + #[tokio::test(flavor = "multi_thread")] + async fn only_invalid_transactions_reject_the_attributes() { + let missing_state: Outcome = + |_| Err(ProviderError::StateForHashNotFound(B256::ZERO).into()); + let panics: Outcome = |_| panic!("build panicked"); + let invalid_tx: Outcome = |_| { + Err(BlockExecutionError::Validation(BlockValidationError::InvalidTx { + hash: B256::ZERO, + error: Box::new(InvalidTransaction::NonceTooHigh { tx: 5, state: 0 }), + }) + .into()) + }; + let id = PayloadId::new([1; 8]); + + for outcome in [missing_state, panics] { + let (payloads, builds, _) = derived_payloads(false, outcome); + assert!(matches!(build(&payloads, id).await, DerivedBuild::Failed(_))); + // A failed build is not kept, so the next request builds again. + assert!(matches!(build(&payloads, id).await, DerivedBuild::Failed(_))); + assert_eq!(builds.load(Ordering::SeqCst), 2); + assert!(payloads.get(id).is_none()); + } + let (payloads, _, _) = derived_payloads(false, invalid_tx); + assert!(matches!(build(&payloads, id).await, DerivedBuild::Invalid(_))); + } + + #[tokio::test(flavor = "multi_thread")] + async fn other_attributes_with_the_same_id_are_built() { + let (payloads, builds, _) = derived_payloads(false, built); + let id = PayloadId::new([1; 8]); + let other = + OpPayloadAttrs(OpPayloadAttributes { gas_limit: Some(1), ..Default::default() }); + + assert_eq!(build(&payloads, id).await, DerivedBuild::Built); + let parent = SealedHeader::seal_slow(Header::default()); + assert_eq!(payloads.build(parent, other, id).await, DerivedBuild::Built); + assert_eq!(builds.load(Ordering::SeqCst), 2); + } + + #[tokio::test(flavor = "multi_thread")] + async fn keeps_the_most_recent_payloads() { + let (payloads, _, _) = derived_payloads(false, built); + for i in 0..=BUILT_PAYLOADS as u8 { + assert_eq!(build(&payloads, PayloadId::new([i; 8])).await, DerivedBuild::Built); + } + assert!(payloads.get(PayloadId::new([0; 8])).is_none()); + assert!(payloads.get(PayloadId::new([BUILT_PAYLOADS as u8; 8])).is_some()); + } + + fn attributes(no_tx_pool: Option, transactions: &[&[u8]]) -> OpPayloadAttrs { + OpPayloadAttrs(OpPayloadAttributes { + transactions: Some(transactions.iter().map(|tx| Bytes::copy_from_slice(tx)).collect()), + no_tx_pool, + ..Default::default() + }) + } + + #[test] + fn builds_derived_attributes_with_a_non_deposit_transaction() { + let deposit: &[u8] = &[DEPOSIT_TX_TYPE_ID, 0x01]; + let eip1559: &[u8] = &[0x02, 0x01]; + let legacy: &[u8] = &[0xf8, 0x01]; + + assert!(builds_at_forkchoice_updated(&attributes(Some(true), &[deposit, eip1559]))); + assert!(builds_at_forkchoice_updated(&attributes(Some(true), &[deposit, legacy]))); + assert!(builds_at_forkchoice_updated(&attributes(Some(true), &[&[]]))); + assert_eq!( + builds_at_forkchoice_updated(&attributes(Some(true), &[deposit, deposit])), + BUILDS_DEPOSIT_ONLY_ATTRIBUTES + ); + assert_eq!( + builds_at_forkchoice_updated(&attributes(Some(true), &[])), + BUILDS_DEPOSIT_ONLY_ATTRIBUTES + ); + assert!(!builds_at_forkchoice_updated(&attributes(Some(false), &[deposit, eip1559]))); + assert!(!builds_at_forkchoice_updated(&attributes(None, &[deposit, eip1559]))); + } +} From 082304079b1f28635f0e69affd1ee7356d3d5878 Mon Sep 17 00:00:00 2001 From: Sebastian Stammler Date: Thu, 15 Oct 2026 14:21:47 +0200 Subject: [PATCH 2/3] kona-node: replace derived blocks rejected at forkchoiceUpdated When the execution layer rejects derived attributes at forkchoiceUpdated with -38003 (invalid payload attributes), kona-node builds the deposits-only replacement under Holocene, as op-node does, instead of retrying the attributes forever. The engine queue drops a task that ends in a flush rather than retrying it, since retrying would replace the block again. The forkchoiceUpdated and newPayload rejections share one deposits-only replacement, which now logs why a failed replacement is critical. Co-authored-by: Anton Evangelatov Co-Authored-By: Claude Opus 5.5 --- .../crates/node/engine/src/task_queue/core.rs | 106 ++++++++++++++- .../src/task_queue/tasks/build/error.rs | 15 ++- .../src/task_queue/tasks/consolidate/task.rs | 126 +++++++++++++++++- .../node/engine/src/task_queue/tasks/mod.rs | 2 +- .../engine/src/task_queue/tasks/seal/task.rs | 22 +-- .../node/engine/src/task_queue/tasks/util.rs | 28 ++++ .../engine/src/test_utils/engine_client.rs | 37 ++++- .../node/service/src/actors/engine/actor.rs | 9 +- 8 files changed, 306 insertions(+), 39 deletions(-) diff --git a/rust/kona/crates/node/engine/src/task_queue/core.rs b/rust/kona/crates/node/engine/src/task_queue/core.rs index 8babca32b1d..8e62147a248 100644 --- a/rust/kona/crates/node/engine/src/task_queue/core.rs +++ b/rust/kona/crates/node/engine/src/task_queue/core.rs @@ -48,7 +48,8 @@ impl Ord for QueuedTask { /// /// Tasks within the queue are also considered fallible. If they fail with a temporary error, /// they are not popped from the queue, the error is returned, and they are retried on the -/// next call to [`Engine::drain`]. +/// next call to [`Engine::drain`]. A task that fails with a flush error has already replaced its +/// block, so it is popped before the error is returned. #[derive(Debug)] pub struct Engine { /// The state of the engine. @@ -153,8 +154,8 @@ impl Engine { } /// Attempts to drain the queue by executing all [`EngineTask`]s in-order. If any task returns - /// an error along the way, it is not popped from the queue (in case it must be retried) and - /// the error is returned. + /// an error along the way, the error is returned and the task is not popped from the queue (in + /// case it must be retried), unless it is a flush error. pub async fn drain(&mut self) -> Result<(), EngineTaskErrors> { // Drain tasks in order of priority, halting on errors for a retry to be attempted. loop { @@ -162,10 +163,21 @@ impl Engine { self.active = self.tasks.pop().map(|queued| queued.task); } let Some(task) = &self.active else { break }; - task.execute(&mut self.state).await?; + let result = task.execute(&mut self.state).await; + + // A flush reports that the task replaced its block with a deposits-only block, so the + // task is done; retrying it would replace that block again. + if let Err(err) = &result && + err.severity() != EngineTaskErrorSeverity::Flush + { + return result; + } + self.state_sender.send_replace(self.state); self.active = None; self.task_queue_length.send_replace(self.len()); + + result?; } Ok(()) @@ -197,11 +209,17 @@ impl EngineResetError { #[cfg(test)] mod recovery_tests { use super::*; - use crate::{InsertTask, NoopBlockSink, test_utils::MockEngineClient}; + use crate::{ + ConsolidateInput, ConsolidateTask, InsertTask, NoopBlockSink, + test_utils::{ + MockEngineClient, TestAttributesBuilder, TestEngineStateBuilder, test_block_info, + }, + }; use alloy_rpc_types_engine::{ - ExecutionPayloadV1, ForkchoiceUpdated, PayloadStatus, PayloadStatusEnum, + BlobsBundleV1, ExecutionPayloadV1, ExecutionPayloadV3, ForkchoiceUpdated, PayloadId, + PayloadStatus, PayloadStatusEnum, }; - use op_alloy_rpc_types_engine::OpExecutionPayloadEnvelope; + use op_alloy_rpc_types_engine::{OpExecutionPayloadEnvelope, OpExecutionPayloadEnvelopeV3}; #[tokio::test] async fn temporary_failure_returns_with_task_retained_for_recovery() { @@ -263,4 +281,78 @@ mod recovery_tests { assert_eq!(*queue_rx.borrow(), 0); assert_eq!(engine.state().sync_state.unsafe_head().block_info.number, 3); } + + // A flush means the task already replaced its block with a deposits-only block. Keeping it + // would rebuild that replacement on every later drain. + #[tokio::test] + async fn flushed_task_is_dropped_not_retried() { + let parent = test_block_info(10); + let deposit = alloy_primitives::Bytes::from(vec![op_alloy_consensus::DEPOSIT_TX_TYPE_ID]); + let attributes = TestAttributesBuilder::new() + .with_parent(parent) + .with_transactions(vec![deposit, alloy_primitives::Bytes::from(vec![0x02])]) + .build(); + + // The deposits-only block the engine builds. It is genesis, so its block info needs no + // L1-info deposit. + let mut block = alloy_consensus::Block::::default(); + block.header.number = parent.block_info.number + 1; + let replacement = OpExecutionPayloadEnvelopeV3 { + execution_payload: ExecutionPayloadV3::from_block_slow(&block), + block_value: Default::default(), + blobs_bundle: BlobsBundleV1::default(), + should_override_builder: false, + parent_beacon_block_root: Default::default(), + }; + let imported: op_alloy_consensus::OpBlock = OpExecutionPayloadEnvelope::V3 { + payload: replacement.execution_payload.clone(), + parent_beacon_block_root: replacement.parent_beacon_block_root, + } + .try_into_block() + .unwrap(); + let mut config = RollupConfig::default(); + config.hardforks.ecotone_time = Some(0); + config.hardforks.holocene_time = Some(0); + config.genesis.l2.number = imported.header.number; + config.genesis.l2.hash = imported.header.hash_slow(); + let config = Arc::new(config); + + let valid = PayloadStatus::from_status(PayloadStatusEnum::Valid); + let client = Arc::new( + MockEngineClient::builder() + .with_config(config.clone()) + .with_fork_choice_updated_v3_rejecting_non_deposit_attributes() + .with_fork_choice_updated_v3_response(ForkchoiceUpdated { + payload_status: valid.clone(), + payload_id: Some(PayloadId::new([1; 8])), + }) + .with_execution_payload_v3(replacement) + .with_new_payload_v3_response(valid) + .build(), + ); + // The safe head is at the unsafe head, so the task builds the attributes instead of + // consolidating them against an unsafe block. + let state = TestEngineStateBuilder::new().with_unsafe_head(parent).build(); + let (state_tx, state_rx) = tokio::sync::watch::channel(EngineState::default()); + let (queue_tx, queue_rx) = tokio::sync::watch::channel(0); + let mut engine = Engine::new(state, state_tx, queue_tx); + engine.enqueue(EngineTask::Consolidate(Box::new(ConsolidateTask::new( + client.clone(), + config, + ConsolidateInput::Attributes(Box::new(attributes)), + Arc::new(NoopBlockSink), + )))); + + let error = engine.drain().await.unwrap_err(); + assert_eq!(error.severity(), EngineTaskErrorSeverity::Flush, "got {error:?}"); + let builds = client.fork_choice_updated_v3_attributes().await.iter().flatten().count(); + assert_eq!(builds, 2, "one build for the batch, one for its replacement"); + assert!(engine.is_empty()); + assert_eq!(*queue_rx.borrow(), 0); + // The task updates `engine.state()` itself; only drain publishes it. + assert_eq!( + state_rx.borrow().sync_state.safe_head().block_info.hash, + imported.header.hash_slow() + ); + } } diff --git a/rust/kona/crates/node/engine/src/task_queue/tasks/build/error.rs b/rust/kona/crates/node/engine/src/task_queue/tasks/build/error.rs index 0448da7a26a..44fb758678f 100644 --- a/rust/kona/crates/node/engine/src/task_queue/tasks/build/error.rs +++ b/rust/kona/crates/node/engine/src/task_queue/tasks/build/error.rs @@ -1,7 +1,7 @@ //! Contains error types for the [`crate::SynchronizeTask`]. use crate::{EngineTaskError, task_queue::tasks::task::EngineTaskErrorSeverity}; -use alloy_rpc_types_engine::{PayloadId, PayloadStatusEnum}; +use alloy_rpc_types_engine::{INVALID_PAYLOAD_ATTRIBUTES_ERROR, PayloadId, PayloadStatusEnum}; use alloy_transport::{RpcError, TransportErrorKind}; use thiserror::Error; use tokio::sync::mpsc; @@ -53,6 +53,19 @@ pub enum BuildTaskError { MpscSend(#[from] Box>), } +impl BuildTaskError { + /// Whether forkchoiceUpdated rejected the attributes with -38003 or INVALID. + pub fn is_invalid_attributes(&self) -> bool { + match self { + Self::EngineBuildError(EngineBuildError::AttributesInsertionFailed(err)) => err + .as_error_resp() + .is_some_and(|resp| resp.code == i64::from(INVALID_PAYLOAD_ATTRIBUTES_ERROR)), + Self::EngineBuildError(EngineBuildError::InvalidPayload(_)) => true, + _ => false, + } + } +} + impl EngineTaskError for BuildTaskError { fn severity(&self) -> EngineTaskErrorSeverity { match self { diff --git a/rust/kona/crates/node/engine/src/task_queue/tasks/consolidate/task.rs b/rust/kona/crates/node/engine/src/task_queue/tasks/consolidate/task.rs index c8dc3aeb92a..6aa0932dadd 100644 --- a/rust/kona/crates/node/engine/src/task_queue/tasks/consolidate/task.rs +++ b/rust/kona/crates/node/engine/src/task_queue/tasks/consolidate/task.rs @@ -2,7 +2,9 @@ use crate::{ ConsolidateTaskError, EngineClient, EngineState, EngineTaskExt, ImportedBlockSink, - SynchronizeTask, state::EngineSyncStateUpdate, task_queue::build_and_seal, + SealTaskError, SynchronizeTask, + state::EngineSyncStateUpdate, + task_queue::{BuildAndSealError, build_and_seal, replace_with_deposits_only}, }; use alloy_rpc_types_eth::Block; use async_trait::async_trait; @@ -92,7 +94,7 @@ impl ConsolidateTask { state: &mut EngineState, attributes: &OpAttributesWithParent, ) -> Result<(), ConsolidateTaskError> { - build_and_seal( + match build_and_seal( state, self.client.clone(), self.cfg.clone(), @@ -100,9 +102,34 @@ impl ConsolidateTask { true, self.block_sink.clone(), ) - .await?; - - Ok(()) + .await + { + Err(BuildAndSealError::Build(err)) + if err.is_invalid_attributes() && attributes.is_deposits_only() => + { + error!(target: "engine", %err, "Critical: deposits-only attributes rejected at forkchoiceUpdated"); + Err(SealTaskError::DepositOnlyPayloadFailed.into()) + } + Err(BuildAndSealError::Build(err)) + if err.is_invalid_attributes() && + self.cfg.is_holocene_active( + attributes.attributes().payload_attributes.timestamp, + ) => + { + warn!(target: "engine", %err, "Derived attributes rejected at forkchoiceUpdated"); + Err(replace_with_deposits_only( + state, + self.client.clone(), + self.cfg.clone(), + attributes, + true, + self.block_sink.clone(), + ) + .await + .into()) + } + result => result.map_err(Into::into), + } } /// This provides symmetric fallback behavior to with `build_and_seal`. @@ -314,7 +341,7 @@ impl EngineTaskExt for ConsolidateTask Arc { + let mut cfg = RollupConfig::default(); + cfg.hardforks.ecotone_time = Some(0); + cfg.hardforks.holocene_time = Some(0); + Arc::new(cfg) + } + + fn derived(transactions: Vec) -> OpAttributesWithParent { + crate::test_utils::TestAttributesBuilder::new() + .with_parent(crate::test_utils::test_block_info(10)) + .with_transactions(transactions) + .build() + } + + async fn build_derived( + client: Arc, + attributes: &OpAttributesWithParent, + ) -> ConsolidateTaskError { + let mut state = crate::test_utils::TestEngineStateBuilder::new() + .with_unsafe_head(attributes.parent) + .build(); + let task = ConsolidateTask::new( + client, + holocene_cfg(), + ConsolidateInput::Attributes(Box::new(attributes.clone())), + Arc::new(crate::NoopBlockSink), + ); + task.execute_build_and_seal_tasks(&mut state, attributes) + .await + .expect_err("the mock never completes a seal") + } + + // An FCU rejection with -38003 (invalid payload attributes) triggers deposits-only recovery. + #[tokio::test] + async fn attributes_rejected_at_fcu_are_replaced_with_deposits_only() { + let deposit = alloy_primitives::Bytes::from(vec![DEPOSIT, 0x01]); + let attributes = derived(vec![deposit.clone(), alloy_primitives::Bytes::from(vec![0x02])]); + let client = Arc::new( + crate::test_utils::test_engine_client_builder() + .with_fork_choice_updated_v3_rejecting_non_deposit_attributes() + .with_fork_choice_updated_v3_response(alloy_rpc_types_engine::ForkchoiceUpdated { + payload_status: alloy_rpc_types_engine::PayloadStatus::from_status( + alloy_rpc_types_engine::PayloadStatusEnum::Valid, + ), + payload_id: Some(alloy_rpc_types_engine::PayloadId::new([1; 8])), + }) + .build(), + ); + + let err = build_derived(client.clone(), &attributes).await; + + let calls = client.fork_choice_updated_v3_attributes().await; + assert_eq!(calls.len(), 2, "one fcU for the batch, one for its deposits-only replacement"); + assert_eq!( + calls[1].as_ref().and_then(|attrs| attrs.transactions.clone()), + Some(vec![deposit]), + "the replacement keeps only the deposits", + ); + // The mock fails the replacement's getPayload. + assert!( + matches!( + err, + ConsolidateTaskError::SealTaskFailed( + SealTaskError::DepositOnlyPayloadReattemptFailed + ) + ), + "got {err:?}", + ); + } + + #[tokio::test] + async fn transport_failure_at_fcu_is_retried_not_replaced() { + let attributes = derived(vec![ + alloy_primitives::Bytes::from(vec![DEPOSIT, 0x01]), + alloy_primitives::Bytes::from(vec![0x02]), + ]); + let client = Arc::new(crate::test_utils::test_engine_client_builder().build()); + + let err = build_derived(client.clone(), &attributes).await; + + assert_eq!(client.fork_choice_updated_v3_attributes().await.len(), 1); + assert!(matches!(err, ConsolidateTaskError::BuildTaskFailed(_)), "got {err:?}"); + assert_eq!(err.severity(), crate::EngineTaskErrorSeverity::Temporary); + } } diff --git a/rust/kona/crates/node/engine/src/task_queue/tasks/mod.rs b/rust/kona/crates/node/engine/src/task_queue/tasks/mod.rs index c2376fa30ed..83c204e6d9e 100644 --- a/rust/kona/crates/node/engine/src/task_queue/tasks/mod.rs +++ b/rust/kona/crates/node/engine/src/task_queue/tasks/mod.rs @@ -24,4 +24,4 @@ mod finalize; pub use finalize::{FinalizeBlockId, FinalizeTask, FinalizeTaskError}; mod util; -pub(super) use util::{BuildAndSealError, build_and_seal}; +pub(super) use util::{BuildAndSealError, build_and_seal, replace_with_deposits_only}; diff --git a/rust/kona/crates/node/engine/src/task_queue/tasks/seal/task.rs b/rust/kona/crates/node/engine/src/task_queue/tasks/seal/task.rs index cbfc99d0d56..665c4fdadc9 100644 --- a/rust/kona/crates/node/engine/src/task_queue/tasks/seal/task.rs +++ b/rust/kona/crates/node/engine/src/task_queue/tasks/seal/task.rs @@ -4,7 +4,7 @@ use crate::{ EngineClient, EngineGetPayloadVersion, EngineState, EngineTaskExt, ImportedBlockSink, InsertTask, InsertTaskError::{self}, - task_queue::build_and_seal, + task_queue::replace_with_deposits_only, }; use alloy_rpc_types_engine::{ExecutionPayload, PayloadId}; use async_trait::async_trait; @@ -147,7 +147,7 @@ impl SealTask { /// This function handles: /// 1. Executing the `InsertTask` to import the payload /// 2. Handling deposits-only payload failures - /// 3. Holocene fallback via `build_and_seal` if needed + /// 3. Holocene fallback via `replace_with_deposits_only` if needed /// /// Returns the inserted block information, or an error if insertion fails. async fn insert_payload( @@ -178,27 +178,15 @@ impl SealTask { ) => { warn!(target: "engine", error = ?e, "Re-attempting payload import with deposits only."); - - // HOLOCENE: Re-attempt payload import with deposits only - // First build the deposits-only payload, then seal it - let deposits_only_attrs = self.attributes.as_deposits_only(); - - return match build_and_seal( + return Err(replace_with_deposits_only( state, self.engine.clone(), self.cfg.clone(), - deposits_only_attrs.clone(), + &self.attributes, self.is_attributes_derived, self.block_sink.clone(), ) - .await - { - Ok(_) => { - info!(target: "engine", "Successfully imported deposits-only payload"); - Err(SealTaskError::HoloceneInvalidFlush) - } - Err(_) => Err(SealTaskError::DepositOnlyPayloadReattemptFailed), - }; + .await); } Err(e) => { error!(target: "engine", "Payload import failed: {e}"); diff --git a/rust/kona/crates/node/engine/src/task_queue/tasks/util.rs b/rust/kona/crates/node/engine/src/task_queue/tasks/util.rs index 08471cf2507..84545841966 100644 --- a/rust/kona/crates/node/engine/src/task_queue/tasks/util.rs +++ b/rust/kona/crates/node/engine/src/task_queue/tasks/util.rs @@ -68,3 +68,31 @@ pub(in crate::task_queue) async fn build_and_seal( Ok(()) } + +/// Replaces a derived block the engine rejected with the deposits-only block of the same +/// `attributes`, as Holocene requires. +/// +/// Returns the error that ends the task: [`SealTaskError::HoloceneInvalidFlush`] once the +/// replacement is sealed, which flushes the rest of the channel, or +/// [`SealTaskError::DepositOnlyPayloadReattemptFailed`] if the replacement fails. +pub(in crate::task_queue) async fn replace_with_deposits_only( + state: &mut EngineState, + engine: Arc, + cfg: Arc, + attributes: &OpAttributesWithParent, + is_attributes_derived: bool, + block_sink: Arc, +) -> SealTaskError { + let deposits_only = attributes.as_deposits_only(); + match build_and_seal(state, engine, cfg, deposits_only, is_attributes_derived, block_sink).await + { + Ok(()) => { + info!(target: "engine", "Successfully imported deposits-only payload"); + SealTaskError::HoloceneInvalidFlush + } + Err(err) => { + error!(target: "engine", %err, "Critical: deposits-only replacement failed"); + SealTaskError::DepositOnlyPayloadReattemptFailed + } + } +} diff --git a/rust/kona/crates/node/engine/src/test_utils/engine_client.rs b/rust/kona/crates/node/engine/src/test_utils/engine_client.rs index ce869c36c39..6bcd964dcdc 100644 --- a/rust/kona/crates/node/engine/src/test_utils/engine_client.rs +++ b/rust/kona/crates/node/engine/src/test_utils/engine_client.rs @@ -7,7 +7,8 @@ use alloy_primitives::{Address, B256, BlockHash, StorageKey}; use alloy_provider::{EthGetBlock, ProviderCall, RpcWithBlock}; use alloy_rpc_types_engine::{ ClientVersionV1, ExecutionPayloadBodiesV1, ExecutionPayloadEnvelopeV2, ExecutionPayloadInputV2, - ExecutionPayloadV1, ExecutionPayloadV3, ForkchoiceState, ForkchoiceUpdated, PayloadId, + ExecutionPayloadV1, ExecutionPayloadV3, ForkchoiceState, ForkchoiceUpdated, + INVALID_PAYLOAD_ATTRIBUTES_ERROR, INVALID_PAYLOAD_ATTRIBUTES_ERROR_MSG, PayloadId, PayloadStatus, }; use alloy_rpc_types_eth::{Block, EIP1186AccountProofResponse, Transaction as EthTransaction}; @@ -15,6 +16,7 @@ use alloy_transport::{TransportError, TransportErrorKind, TransportResult}; use alloy_transport_http::Http; use async_trait::async_trait; use kona_genesis::RollupConfig; +use op_alloy_consensus::DEPOSIT_TX_TYPE_ID; use op_alloy_network::Optimism; use op_alloy_provider::ext::engine::OpEngineApi; use op_alloy_rpc_types::Transaction as OpTransaction; @@ -62,6 +64,11 @@ pub struct MockEngineStorage { pub fork_choice_updated_v2_response: Option, /// Storage for `fork_choice_updated_v3` responses. pub fork_choice_updated_v3_response: Option, + /// When set, `fork_choice_updated_v3` rejects attributes carrying a non-deposit transaction + /// with `-38003`, as an execution layer does for invalid derived attributes. + pub fork_choice_updated_v3_rejects_non_deposit_attributes: bool, + /// Payload attributes received by `fork_choice_updated_v3`, in call order. + pub fork_choice_updated_v3_attributes: Vec>, // Version-specific get_payload responses /// Storage for execution payload envelope v2 responses. @@ -178,6 +185,13 @@ impl MockEngineClientBuilder { self } + /// Makes `fork_choice_updated_v3` reject attributes carrying a non-deposit transaction with + /// `-38003`, while deposit-only attributes get the configured response. + pub const fn with_fork_choice_updated_v3_rejecting_non_deposit_attributes(mut self) -> Self { + self.storage.fork_choice_updated_v3_rejects_non_deposit_attributes = true; + self + } + /// Sets the execution payload v2 response. pub fn with_execution_payload_v2(mut self, payload: ExecutionPayloadEnvelopeV2) -> Self { self.storage.execution_payload_v2 = Some(payload); @@ -334,6 +348,11 @@ impl MockEngineClient { self.storage.write().await.fork_choice_updated_v3_response = Some(response); } + /// Returns the payload attributes received by `fork_choice_updated_v3`, in call order. + pub async fn fork_choice_updated_v3_attributes(&self) -> Vec> { + self.storage.read().await.fork_choice_updated_v3_attributes.clone() + } + /// Sets the execution payload v2 response. pub async fn set_execution_payload_v2(&self, payload: ExecutionPayloadEnvelopeV2) { self.storage.write().await.execution_payload_v2 = Some(payload); @@ -547,9 +566,21 @@ impl OpEngineApi> for MockEngineClient { async fn fork_choice_updated_v3( &self, _fork_choice_state: ForkchoiceState, - _payload_attributes: Option, + payload_attributes: Option, ) -> TransportResult { - let storage = self.storage.read().await; + let mut storage = self.storage.write().await; + let has_non_deposit_tx = payload_attributes.as_ref().is_some_and(|attrs| { + attrs.transactions.iter().flatten().any(|tx| tx.first() != Some(&DEPOSIT_TX_TYPE_ID)) + }); + storage.fork_choice_updated_v3_attributes.push(payload_attributes); + if storage.fork_choice_updated_v3_rejects_non_deposit_attributes && has_non_deposit_tx { + let payload = serde_json::from_value(serde_json::json!({ + "code": INVALID_PAYLOAD_ATTRIBUTES_ERROR, + "message": INVALID_PAYLOAD_ATTRIBUTES_ERROR_MSG, + })) + .expect("valid JSON-RPC error payload"); + return Err(TransportError::ErrorResp(payload)); + } storage.fork_choice_updated_v3_response.clone().ok_or_else(|| { TransportError::from(TransportErrorKind::custom_str( "fork_choice_updated_v3 was called but no v3 response configured. \ diff --git a/rust/kona/crates/node/service/src/actors/engine/actor.rs b/rust/kona/crates/node/service/src/actors/engine/actor.rs index ff5c06accd3..832b4a4561b 100644 --- a/rust/kona/crates/node/service/src/actors/engine/actor.rs +++ b/rust/kona/crates/node/service/src/actors/engine/actor.rs @@ -185,10 +185,11 @@ where return Ok(()); } EngineTaskErrorSeverity::Flush => { - // This error is encountered when the payload is marked INVALID - // by the engine api. Post-holocene, the payload is replaced by - // a "deposits-only" block and re-executed. At the same time, - // the channel and any remaining buffered batches are flushed. + // This error is encountered when the engine API rejects a derived + // payload: its attributes at forkchoiceUpdated, or the payload at + // newPayload. Post-holocene, the payload is replaced by a + // "deposits-only" block. At the same time, the channel and any + // remaining buffered batches are flushed. warn!(target: "engine", ?err, "Invalid payload, Flushing derivation pipeline."); match self.derivation_client.send_signal(Signal::FlushChannel).await { Ok(_) => { From 6d585372a9d8694681d77dadd7cbe627dd2947f0 Mon Sep 17 00:00:00 2001 From: Sebastian Stammler Date: Thu, 15 Oct 2026 14:21:47 +0200 Subject: [PATCH 3/3] op-acceptance-tests: replace an invalid SDM batch with deposits-only Posts a batch whose 0x7D over-refunds a transaction and checks that the sequencer and the verifier both replace the block with the same deposits-only block, and that the safe head keeps advancing. Co-authored-by: Anton Evangelatov Co-Authored-By: Claude Opus 5.5 --- .../tests/sdm/invalid_batch_test.go | 87 +++++++++++++++++++ .../tests/sdm/sdmtest/batch.go | 57 ++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 op-acceptance-tests/tests/sdm/invalid_batch_test.go create mode 100644 op-acceptance-tests/tests/sdm/sdmtest/batch.go diff --git a/op-acceptance-tests/tests/sdm/invalid_batch_test.go b/op-acceptance-tests/tests/sdm/invalid_batch_test.go new file mode 100644 index 00000000000..121732101e2 --- /dev/null +++ b/op-acceptance-tests/tests/sdm/invalid_batch_test.go @@ -0,0 +1,87 @@ +package sdm + +import ( + "slices" + "testing" + + "github.com/ethereum-optimism/optimism/op-acceptance-tests/tests/sdm/sdmtest" + optypes "github.com/ethereum-optimism/optimism/op-core/types" + "github.com/ethereum-optimism/optimism/op-devstack/devtest" + "github.com/ethereum-optimism/optimism/op-devstack/dsl" + "github.com/ethereum-optimism/optimism/op-service/eth" + "github.com/ethereum-optimism/optimism/op-service/eth/safety" + "github.com/ethereum/go-ethereum/common" + gethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/rlp" +) + +// TestSDMInvalidPostExecIsReplacedWithDepositsOnly checks that a batched block whose 0x7D fails +// verification is replaced by a deposits-only block, as the fault-proof program does. +func TestSDMInvalidPostExecIsReplacedWithDepositsOnly(gt *testing.T) { + t := devtest.ParallelT(gt) + sys := newFixedPolicySDMRethSystem(t) + sdmtest.VerifyOpReth(t, sys.L2EL) + sdmtest.VerifyOpReth(t, sys.L2ELVerifier) + + block, receipt := submitFixtureProbe(t, sys) + target := uint64(block.Number) + honest := sys.L2EL.BlockRefByNumber(target) + // The verifier holds the honest block as unsafe, so derivation must reorg it out. + sys.L2ELVerifier.Reached(eth.Unsafe, target, 60) + + from := min(sys.L2CL.SafeL2BlockRef().Number, sys.L2CLVerifier.SafeL2BlockRef().Number) + 1 + sdmtest.PostTamperedSingularBatches(t, sys, from, target, func(txs []eth.Data) []eth.Data { + return overRefundPostExec(t, receipt, txs) + }) + + dsl.CheckAll(t, + sys.L2CL.ReachedFn(safety.CrossSafe, target, 120), + sys.L2CLVerifier.ReachedFn(safety.CrossSafe, target, 120), + sys.L2EL.ReachedFn(eth.Safe, target, 120), + sys.L2ELVerifier.ReachedFn(eth.Safe, target, 120), + ) + replacement := sdmtest.GetBlockWithTxs(t, sys.L2ELVerifier, target) + t.Require().NotEqual(block.Hash, replacement.Hash, "the invalid block must be replaced") + t.Require().Equal(honest.ParentHash, sys.L2ELVerifier.BlockRefByNumber(target).ParentHash, + "only the tampered block may be replaced") + var wantDeposits, gotTxs []common.Hash + for _, tx := range block.Transactions { + if uint64(tx.Type) == optypes.DepositTxType { + wantDeposits = append(wantDeposits, tx.Hash) + } + } + for _, tx := range replacement.Transactions { + gotTxs = append(gotTxs, tx.Hash) + } + t.Require().Equal(wantDeposits, gotTxs, "the replacement must hold exactly the tampered block's deposits") + t.Require().Equal(replacement.Hash, sdmtest.GetBlockWithTxs(t, sys.L2EL, target).Hash, + "the sequencer must derive the same replacement") + + // The batcher resumes on top of the replacement. + sys.L2Batcher.Start() + dsl.CheckAll(t, + sys.L2CL.ReachedFn(safety.CrossSafe, target+3, 120), + sys.L2CLVerifier.ReachedFn(safety.CrossSafe, target+3, 120), + ) +} + +// overRefundPostExec raises the probe tx's refund one gas above the gas it used before the refund. +func overRefundPostExec(t devtest.T, probe *gethtypes.Receipt, txs []eth.Data) []eth.Data { + last := len(txs) - 1 + postExecTx, err := optypes.UnmarshalPostExecTx(txs[last]) + t.Require().NoError(err, "the probe block must end with a 0x7D") + payload, err := optypes.DecodePostExecPayload(postExecTx.Data) + t.Require().NoError(err, "the probe 0x7D payload must decode") + entry := slices.IndexFunc(payload.GasRefundEntries, func(e optypes.SDMGasEntry) bool { + return e.Index == uint64(probe.TransactionIndex) + }) + t.Require().GreaterOrEqual(entry, 0, "the 0x7D must refund the probe tx") + // The receipt reports gas after the refund. + evmGasUsed := probe.GasUsed + payload.GasRefundEntries[entry].GasRefund + payload.GasRefundEntries[entry].GasRefund = evmGasUsed + 1 + postExecTx.Data, err = rlp.EncodeToBytes(payload) + t.Require().NoError(err, "the tampered 0x7D payload must encode") + txs[last], err = postExecTx.MarshalBinary() + t.Require().NoError(err, "the tampered 0x7D must encode") + return txs +} diff --git a/op-acceptance-tests/tests/sdm/sdmtest/batch.go b/op-acceptance-tests/tests/sdm/sdmtest/batch.go new file mode 100644 index 00000000000..9ed8c47cba2 --- /dev/null +++ b/op-acceptance-tests/tests/sdm/sdmtest/batch.go @@ -0,0 +1,57 @@ +package sdmtest + +import ( + "bytes" + "io" + "slices" + + "github.com/ethereum-optimism/optimism/op-batcher/compressor" + "github.com/ethereum-optimism/optimism/op-chain-ops/devkeys" + "github.com/ethereum-optimism/optimism/op-devstack/devtest" + "github.com/ethereum-optimism/optimism/op-devstack/dsl" + "github.com/ethereum-optimism/optimism/op-node/rollup" + "github.com/ethereum-optimism/optimism/op-node/rollup/derive" + "github.com/ethereum-optimism/optimism/op-node/rollup/derive/params" + "github.com/ethereum-optimism/optimism/op-service/eth" + "github.com/ethereum-optimism/optimism/op-service/txplan" +) + +// maxBatchFrameSize keeps the hand-built channel in a single calldata frame. +const maxBatchFrameSize = 120_000 + +// PostTamperedSingularBatches stands in for a malicious batcher: it posts the sequencer's blocks +// [from, to] to L1 as one singular-batch channel signed with the batcher key, after tamper has +// rewritten the raw transactions of block `to`. The real batcher must be stopped. +func PostTamperedSingularBatches(t devtest.T, sys *RethSystem, from, to uint64, tamper func([]eth.Data) []eth.Data) { + rollupCfg := sys.L2Network.Escape().RollupConfig() + comp, err := compressor.NewNonCompressor(compressor.Config{ + TargetOutputSize: maxBatchFrameSize, + CompressionAlgo: derive.Zlib, + }) + t.Require().NoError(err) + channel, err := derive.NewSingularChannelOut(comp, rollup.NewChainSpec(rollupCfg)) + t.Require().NoError(err) + + for number := from; number <= to; number++ { + payload := *sys.L2EL.PayloadByNumber(number).ExecutionPayload + if number == to { + // The client caches fetched payloads, so tamper with a copy. + payload.Transactions = tamper(slices.Clone(payload.Transactions)) + } + _, err := channel.AddBlock(rollupCfg, &payload) + t.Require().NoError(err, "block %d must fit in the channel", number) + } + t.Require().NoError(channel.Close()) + + data := bytes.NewBuffer([]byte{params.DerivationVersion0}) + _, err = channel.OutputFrame(data, maxBatchFrameSize) + t.Require().ErrorIs(err, io.EOF, "the channel must fit in one frame") + + batcherKey := sys.L2Network.Escape().Keys().Secret(devkeys.BatcherRole.Key(rollupCfg.L2ChainID)) + batcher := dsl.NewEOA(dsl.NewKey(t, batcherKey), sys.L1EL) + batcher.Transact( + batcher.Plan(), + txplan.WithTo(&rollupCfg.BatchInboxAddress), + txplan.WithData(data.Bytes()), + ) +}