diff --git a/op-acceptance-tests/tests/sync/elsync/gap_elp2p/sync_test.go b/op-acceptance-tests/tests/sync/elsync/gap_elp2p/sync_test.go index 55c2ac6828e..4252ebc1643 100644 --- a/op-acceptance-tests/tests/sync/elsync/gap_elp2p/sync_test.go +++ b/op-acceptance-tests/tests/sync/elsync/gap_elp2p/sync_test.go @@ -4,248 +4,12 @@ import ( "testing" "github.com/ethereum-optimism/optimism/op-devstack/devtest" - "github.com/ethereum-optimism/optimism/op-devstack/sysgo" "github.com/ethereum-optimism/optimism/op-service/eth" safety "github.com/ethereum-optimism/optimism/op-service/eth/safety" - "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" ) -// TestL2ELP2PCanonicalChainAdvancedByFCU verifies the interaction between NewPayload, -// ForkchoiceUpdate (FCU), and ELP2P/EL sync in a multi-node L2 test network. -// -// Scenario -// - Start a single-chain, multi-node system without ELP2P connectivity for L2ELB. -// - Advance the reference node (L2EL) so it is ahead of L2ELB. -// -// Expectations covered by this test -// -// NewPayload without parents present: -// - Does NOT trigger EL sync. -// - Returns SYNCING for future blocks (startNum+3/5/4/6). -// -// NewPayload on a non canonical chain with available state: -// - Can extend a non canonical chain (startNum+1 then +2) and returns VALID. -// - These non canonical chain blocks are retrievable by hash but remain non-canonical -// (BlockRefByNumber returns NotFound) until FCU marks them valid. -// -// FCU promoting non canonical chain to canonical: -// - FCU to startNum+2 marks the previously imported non canonical blocks valid -// and advances L2ELB canonical head to startNum+2. -// -// FCU targeting a block that cannot yet be validated (missing ancestors): -// - Triggers EL sync on L2EL (skeleton/backfill logs), returns SYNCING, -// and does not advance the head while ELP2P is still unavailable. -// -// Enabling ELP2P and eventual validation: -// - After peering L2ELB with L2EL, FCU to startNum+4 eventually becomes VALID -// once EL sync completes; the test waits for canonicalization and confirms head advances. -// - Subsequent gaps (to startNum+6, then +8) are resolved by FCU with -// WaitUntilValid, advancing the canonical head each time. -// -// NewPayload still does not initiate EL sync: -// - A NewPayload to startNum+10 returns SYNCING and the block remains unknown by number -// until an FCU is issued, which initially returns SYNCING. -// -// Insights -// - NewPayload alone never initiates EL sync, but can build a non canonical chain if state exists. -// - FCU is the mechanism that (a) promotes non canonical chain blocks to canonical when they are -// already fully validated, and (b) triggers EL sync when ancestors are missing. -// - Previously submitted NewPayloads that returned SYNCING are not retained to automatically -// assemble a non canonical chain later. -// - With ELP2P enabled, repeated FCU attempts eventually validate and advance the canonical chain. -func TestL2ELP2PCanonicalChainAdvancedByFCU(gt *testing.T) { - t := devtest.ParallelT(gt) - // Example error with op-reth: - // - // assertions.go:387: ERROR[03-31|09:58:15.522] - // assertions.go:387: Error Trace: /optimism/op-devstack/dsl/l2_el.go:64 - // assertions.go:387: /optimism/op-acceptance-tests/tests/sync/elsync/gap_elp2p/sync_test.go:111 - // assertions.go:387: Error: Received unexpected error: - // assertions.go:387: failed to determine block-hash of hash 0x8b94830f261ef4568bc2ba248f52b27f9a7c366e8157794c93bdd05ca4735564, could not get payload: not found - // assertions.go:387: Test: TestL2ELP2PCanonicalChainAdvancedByFCU - // assertions.go:387: Messages: block not found using block hash - // assertions.go:387: - sysgo.SkipOnOpReth(t, "not supported") - sys := newGapELP2PSystem(t) - require := t.Require() - logger := t.Logger() - - // Advance few blocks to make sure reference node advanced - sys.L2CL.Advanced(safety.LocalUnsafe, 10, 30) - - sys.L2CLB.Stop() - - // At this point, L2ELB has no ELP2P, and L2CL connection - startNum := sys.L2ELB.BlockRefByLabel(eth.Unsafe).Number - - // NewPayload does not trigger the EL Sync - // Example logs from L2EL(geth) - // New skeleton head announced - // Ignoring payload with missing parent - targetNum := startNum + 3 - sys.L2ELB.NewPayload(sys.L2EL, targetNum).IsSyncing() - - // NewPayload does not trigger the EL Sync - // Example logs from L2EL(geth) - // New skeleton head announced - // Ignoring payload with missing parent - targetNum = startNum + 5 - sys.L2ELB.NewPayload(sys.L2EL, targetNum).IsSyncing() - - // NewPayload does not trigger the EL Sync - // Example logs from L2EL(geth) - // New skeleton head announced - // Ignoring payload with missing parent - targetNum = startNum + 4 - sys.L2ELB.NewPayload(sys.L2EL, targetNum).IsSyncing() - - // NewPayload can extend non canonical chain because L2EL has state for startNum and can validate payload - // Example logs from L2EL(geth) - // Inserting block without sethead - // Persisted trie from memory database - // Imported new potential chain segment - targetNum = startNum + 1 - sys.L2ELB.NewPayload(sys.L2EL, targetNum).IsValid() - logger.Info("Non canonical chain advanced", "number", targetNum) - - // NewPayload can extend non canonical chain because L2EL has state for startNum+1 and can validate payload - // Example logs from L2EL(geth) - // Inserting block without sethead - // Persisted trie from memory database - // Imported new potential chain segment - targetNum = startNum + 2 - sys.L2ELB.NewPayload(sys.L2EL, targetNum).IsValid() - logger.Info("Non canonical chain advanced", "number", targetNum) - - // Non canonical chain can be fetched via blockhash - blockRef := sys.L2EL.BlockRefByNumber(targetNum) - nonCan := sys.L2ELB.BlockRefByHash(blockRef.Hash) - require.Equal(uint64(targetNum), nonCan.Number) - require.Equal(blockRef.Hash, nonCan.Hash) - // Still targetNum block is non canonicalized - _, err := sys.L2ELB.Escape().L2EthClient().BlockRefByNumber(t.Ctx(), targetNum) - require.ErrorIs(err, ethereum.NotFound) - - // Previously inserted payloads are not used to make non-canonical chain automatically - blockRef = sys.L2EL.BlockRefByNumber(startNum + 3) - _, err = sys.L2ELB.Escape().EthClient().BlockRefByHash(t.Ctx(), blockRef.Hash) - require.ErrorIs(err, ethereum.NotFound) - blockRef = sys.L2EL.BlockRefByNumber(startNum + 5) - _, err = sys.L2ELB.Escape().EthClient().BlockRefByHash(t.Ctx(), blockRef.Hash) - require.ErrorIs(err, ethereum.NotFound) - - // No FCU yet so head not advanced yet - require.Equal(startNum, sys.L2ELB.BlockRefByLabel(eth.Unsafe).Number) - - // NewPayload does not trigger the EL Sync - // Example logs from L2EL(geth) - // New skeleton head announced - // Ignoring payload with missing parent - targetNum = startNum + 6 - sys.L2ELB.NewPayload(sys.L2EL, targetNum).IsSyncing() - - // FCU marks startNum + 2 as valid, promoting non canonical blocks to canonical blocks - // Example logs from L2EL(geth) - // Extend chain - // Chain head was updated - targetNum = startNum + 2 - sys.L2ELB.ForkchoiceUpdate(sys.L2EL, targetNum, 0, 0, nil).IsValid() - logger.Info("Canonical chain advanced", "number", targetNum) - - // Head advanced, canonical head bumped - require.Equal(uint64(targetNum), sys.L2ELB.BlockRefByLabel(eth.Unsafe).Number) - - // FCU to target block which cannot be validated, triggers EL Sync but ELP2P not yet available - // Example logs from L2EL(geth) - // New skeleton head announced - // created initial skeleton subchain - // Starting reverse header sync cycle - // Block synchronisation started - // Backfilling with the network - targetNum = startNum + 3 - sys.L2ELB.ForkchoiceUpdate(sys.L2EL, targetNum, 0, 0, nil).IsSyncing() - - // head not advanced - require.Equal(uint64(startNum+2), sys.L2ELB.BlockRefByLabel(eth.Unsafe).Number) - - // FCU to target block which cannot be validated - // Example logs from L2EL(geth) - // New skeleton head announced - sys.L2ELB.ForkchoiceUpdate(sys.L2EL, targetNum, 0, 0, nil).IsSyncing() - - // head not advanced - require.Equal(uint64(startNum+2), sys.L2ELB.BlockRefByLabel(eth.Unsafe).Number) - - // FCU to target block which cannot be validated - // Example logs from L2EL(geth) - // New skeleton head announced - targetNum = startNum + 4 - sys.L2ELB.ForkchoiceUpdate(sys.L2EL, targetNum, 0, 0, nil).IsSyncing() - - // head not advanced - require.Equal(uint64(startNum+2), sys.L2ELB.BlockRefByLabel(eth.Unsafe).Number) - - // Finally peer for enabling ELP2P - sys.L2ELB.PeerWith(sys.L2EL) - - // We do NOT need to resend the same FCU just because peers have connected; - // the EL continues syncing toward the last forkchoice target asynchronously. - // - // Once the EL has downloaded and validated the required data, - // a subsequent FCU call (even with the same target) may immediately return VALID. - // - // In practice, after peers are established, one or two FCU calls - // typically observe VALID — though this depends on the EL’s sync progress - // and network conditions. - attempts := 3 - - // Retry a few times until the first EL Sync is complete - sys.L2ELB.FinishedELSync(sys.L2EL, targetNum, 0, 0) - - // Wait until L2EL finishes EL Sync and canonicalizes until targetNum - sys.L2ELB.Reached(eth.Unsafe, targetNum, 3) - - sys.L2ELB.ForkchoiceUpdate(sys.L2EL, targetNum, 0, 0, nil).WaitUntilValid(attempts) - logger.Info("Canonical chain advanced", "number", targetNum) - - // head advanced - require.Equal(uint64(targetNum), sys.L2ELB.BlockRefByLabel(eth.Unsafe).Number) - - // FCU to target block which can be eventually validated, because ELP2P enabled - // Example logs from L2EL(geth) - // "Restarting sync cycle" reason="chain gapped, head: 4, newHead: 6" - targetNum = startNum + 6 - sys.L2ELB.ForkchoiceUpdate(sys.L2EL, targetNum, 0, 0, nil).WaitUntilValid(attempts) - logger.Info("Canonical chain advanced", "number", targetNum) - - // head advanced - require.Equal(uint64(targetNum), sys.L2ELB.BlockRefByLabel(eth.Unsafe).Number) - - // FCU to target block which can be eventually validated, because ELP2P enabled - // Example logs from L2EL(geth) - // "Restarting sync cycle" reason="chain gapped, head: 6, newHead: 8" - targetNum = startNum + 8 - sys.L2ELB.ForkchoiceUpdate(sys.L2EL, targetNum, 0, 0, nil).WaitUntilValid(attempts) - logger.Info("Canonical chain advanced", "number", targetNum) - - // head advanced - require.Equal(uint64(targetNum), sys.L2ELB.BlockRefByLabel(eth.Unsafe).Number) - - // NewPayload does not trigger EL Sync - targetNum = startNum + 10 - sys.L2ELB.NewPayload(sys.L2EL, targetNum).IsSyncing() - _, err = sys.L2ELB.Escape().L2EthClient().BlockRefByNumber(t.Ctx(), targetNum) - require.ErrorIs(err, ethereum.NotFound) - sys.L2ELB.ForkchoiceUpdate(sys.L2EL, targetNum, 0, 0, nil).IsSyncing() - - t.Cleanup(func() { - sys.L2CLB.Start() - sys.L2ELB.DisconnectPeerWith(sys.L2EL) - }) -} - // TestELP2PFCUUnavailableHash verifies that when an Execution Layer (EL) client // receives a Forkchoice Update (FCU) with an unknown head hash (invalid or // non-existent) during EL syncing, it remains in the "SYNCING" state and does diff --git a/op-acceptance-tests/tests/sync/manual/sync_test.go b/op-acceptance-tests/tests/sync/manual/sync_test.go index 0c48a807b9d..c564a0f50cb 100644 --- a/op-acceptance-tests/tests/sync/manual/sync_test.go +++ b/op-acceptance-tests/tests/sync/manual/sync_test.go @@ -15,17 +15,6 @@ import ( func TestVerifierManualSync(gt *testing.T) { t := devtest.ParallelT(gt) - // Example error using op-reth: - // - // assertions.go:387: ERROR[03-31|10:02:09.740] - // assertions.go:387: Error Trace: /optimism/op-devstack/dsl/l2_el.go:64 - // assertions.go:387: /optimism/op-acceptance-tests/tests/sync/manual/sync_test.go:53 - // assertions.go:387: Error: Received unexpected error: - // assertions.go:387: failed to determine block-hash of hash 0x2f6324eaff3942802eff5ddd47872544aa02182c222bf90042d5f715dfa72308, could not get payload: not found - // assertions.go:387: Test: TestVerifierManualSync - // assertions.go:387: Messages: block not found using block hash - sysgo.SkipOnOpReth(t, "not supported") - // Disable ELP2P and Batcher sys := presets.NewSingleChainMultiNodeWithoutP2PWithoutCheck(t, presets.WithBatcherOption(func(_ sysgo.ComponentTarget, cfg *bss.CLIConfig) { @@ -60,8 +49,6 @@ func TestVerifierManualSync(gt *testing.T) { // Payload valid but not canonicalized. Cannot fetch block by number _, err = sys.L2ELB.Escape().EthClient().BlockRefByNumber(t.Ctx(), blockNum) require.Error(err, ethereum.NotFound) - // Now fetchable by hash - require.Equal(blockNum, sys.L2ELB.BlockRefByHash(block.Hash).Number) // FCU logger.Info("ForkchoiceUpdate", "target", blockNum) diff --git a/op-acceptance-tests/tests/sync_tester/sync_tester_hfs/sync_tester_hfs_test.go b/op-acceptance-tests/tests/sync_tester/sync_tester_hfs/sync_tester_hfs_test.go index c1ffa2cfdab..f8693459e1c 100644 --- a/op-acceptance-tests/tests/sync_tester/sync_tester_hfs/sync_tester_hfs_test.go +++ b/op-acceptance-tests/tests/sync_tester/sync_tester_hfs/sync_tester_hfs_test.go @@ -36,16 +36,6 @@ func simpleWithSyncTesterOpts() []presets.Option { func TestSyncTesterHardforks(gt *testing.T) { t := devtest.ParallelT(gt) - // Example error with op-reth: - // - // assertions.go:387: ERROR[03-31|10:08:04.055] - // assertions.go:387: Error Trace: /optimism/op-devstack/dsl/check.go:26 - // assertions.go:387: /optimism/op-acceptance-tests/tests/sync_tester/sync_tester_hfs/sync_tester_hfs_test.go:54 - // assertions.go:387: Error: Received unexpected error: - // assertions.go:387: operation failed permanently after 42 attempts: expected head to advance: unsafe - // assertions.go:387: Test: TestSyncTesterHardforks - sysgo.SkipOnOpReth(t, "not supported") - sys := presets.NewSimpleWithSyncTester(t, simpleWithSyncTesterOpts()...) require := t.Require() logger := t.Logger() diff --git a/op-devstack/dsl/l2_el.go b/op-devstack/dsl/l2_el.go index a940ac0fb06..5d6d99ff4d6 100644 --- a/op-devstack/dsl/l2_el.go +++ b/op-devstack/dsl/l2_el.go @@ -2,7 +2,6 @@ package dsl import ( "context" - "errors" "fmt" "strings" "time" @@ -599,24 +598,6 @@ func (el *L2ELNode) ForkchoiceUpdateRaw(unsafe, safe, finalized common.Hash, att return result } -func (el *L2ELNode) FinishedELSync(refNode *L2ELNode, unsafe, safe, finalized uint64) { - el.log.Info("Trigger EL Sync", "unsafe", unsafe, "safe", safe, "finalized", finalized) - trial := 1 - el.require.NoError(retry.Do0(el.ctx, 5, &retry.FixedStrategy{Dur: 2 * time.Second}, func() error { - el.log.Info("FCU to trigger EL Sync", "trial", trial) - res := el.ForkchoiceUpdate(refNode, unsafe, safe, finalized, nil) - // If EL Sync triggered, Example logs from L2EL(geth) - // New skeleton head announced - // Backfilling with the network - if res.Result.PayloadStatus.Status == eth.ExecutionValid { - el.log.Info("Finished EL Sync") - return nil - } - trial += 1 - return errors.New("EL Sync not finished") - })) -} - func (el *L2ELNode) ChainSyncStatus(chainID eth.ChainID, lvl safety.Level) eth.BlockID { el.require.Equal(chainID, el.inner.ChainID(), "chain ID mismatch") var blockRef eth.L2BlockRef diff --git a/rust/kona/crates/node/engine/src/client.rs b/rust/kona/crates/node/engine/src/client.rs index 1496a114682..d1423fbc9d4 100644 --- a/rust/kona/crates/node/engine/src/client.rs +++ b/rust/kona/crates/node/engine/src/client.rs @@ -5,13 +5,11 @@ use alloy_eips::{BlockId, eip1898::BlockNumberOrTag}; use alloy_json_rpc::{RequestPacket, ResponsePacket}; use alloy_network::{Ethereum, Network}; use alloy_primitives::Bytes; -use alloy_provider::{EthGetBlock, Provider, RootProvider, ext::EngineApi}; +use alloy_provider::{EthGetBlock, Provider, RootProvider}; use alloy_rpc_client::ClientBuilder; -use alloy_rpc_types_engine::{ExecutionPayloadV1, JwtSecret, PayloadStatus}; +use alloy_rpc_types_engine::JwtSecret; use alloy_rpc_types_eth::Block; -use alloy_transport::{ - RpcError, TransportError, TransportErrorKind, TransportFut, TransportResult, -}; +use alloy_transport::{RpcError, TransportError, TransportErrorKind, TransportFut}; use alloy_transport_http::{ AuthLayer, Http, HyperClient, hyper_util::{client::legacy::Client, rt::TokioExecutor}, @@ -200,14 +198,6 @@ impl EngineClient { self.engine.get_block(block) } - /// Submits a Paris payload, whose method is provided by Alloy's Ethereum Engine API extension. - pub async fn new_payload_v1( - &self, - payload: ExecutionPayloadV1, - ) -> TransportResult { - self.engine.new_payload_v1(payload).await - } - /// Fetches an L2 block with full transactions. pub async fn l2_block_by_label( &self, @@ -380,7 +370,9 @@ mod request_observability_tests { BuildTask, ExecutableEngineTask, test_utils::{RpcMock, TestAttributesBuilder, TestEngineStateBuilder, test_block_info}, }; - use alloy_rpc_types_engine::{ForkchoiceUpdated, PayloadId, PayloadStatusEnum}; + use alloy_rpc_types_engine::{ + ForkchoiceUpdated, PayloadId, PayloadStatus, PayloadStatusEnum, + }; let logs = LogWriter::default(); let writer = logs.clone(); 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 816c8d0519e..1a9c150c0a4 100644 --- a/rust/kona/crates/node/engine/src/task_queue/core.rs +++ b/rust/kona/crates/node/engine/src/task_queue/core.rs @@ -217,7 +217,7 @@ mod recovery_tests { let config = Arc::new(config); let (client, l1, l2) = test_engine_client(config.clone()); let client = Arc::new(client); - l2.expect_error("engine_newPayloadV1"); + l2.expect_error("engine_newPayloadV2"); let (state_tx, _state_rx) = tokio::sync::watch::channel(EngineState::default()); let mut engine = Engine::new(EngineState::default(), state_tx); engine.enqueue(EngineTask::Insert(Box::new(InsertTask::new( @@ -254,7 +254,7 @@ mod recovery_tests { )))); } for _ in 0..4 { - l2.expect("engine_newPayloadV1", PayloadStatus::from_status(PayloadStatusEnum::Valid)); + l2.expect("engine_newPayloadV2", PayloadStatus::from_status(PayloadStatusEnum::Valid)); l2.expect( "engine_forkchoiceUpdatedV3", ForkchoiceUpdated::new(PayloadStatus::from_status(PayloadStatusEnum::Valid)), diff --git a/rust/kona/crates/node/engine/src/task_queue/tasks/canonicalize_test.rs b/rust/kona/crates/node/engine/src/task_queue/tasks/canonicalize_test.rs index 9da42da2fe8..3708197d465 100644 --- a/rust/kona/crates/node/engine/src/task_queue/tasks/canonicalize_test.rs +++ b/rust/kona/crates/node/engine/src/task_queue/tasks/canonicalize_test.rs @@ -63,7 +63,7 @@ async fn failed_forkchoice_update_is_relayed_and_retry_imports_the_same_payload( let PayloadFixture { payload, cfg } = payload_fixture(); let valid = || PayloadStatus::from_status(PayloadStatusEnum::Valid); let (client, l1, l2) = test_engine_client(cfg.clone()); - l2.expect("engine_newPayloadV1", valid()); + l2.expect("engine_newPayloadV2", valid()); l2.expect_error("engine_forkchoiceUpdatedV3"); let client = Arc::new(client); let sink = Arc::new(RecordingSink::default()); @@ -87,7 +87,7 @@ async fn failed_forkchoice_update_is_relayed_and_retry_imports_the_same_payload( assert_eq!(state, original); assert!(sink.0.lock().unwrap().is_empty()); - l2.expect("engine_newPayloadV1", valid()); + l2.expect("engine_newPayloadV2", valid()); l2.expect("engine_forkchoiceUpdatedV3", ForkchoiceUpdated::new(valid())); task.execute(&mut state).await.unwrap(); rx.recv().await.unwrap().unwrap(); @@ -120,7 +120,7 @@ async fn invalid_committed_payload_does_not_build_an_uncommitted_replacement( let payload = OpExecutionPayloadEnvelope::V1(payload_v1.clone()); let (client, l1, l2) = test_engine_client(cfg.clone()); l2.expect_params( - "engine_newPayloadV1", + "engine_newPayloadV2", serde_json::json!([payload_v1]), PayloadStatus::from_status(PayloadStatusEnum::Invalid { validation_error: "invalid transaction".into(), @@ -162,7 +162,7 @@ async fn unsafe_head_is_published_before_the_canonicalization_response() { let PayloadFixture { payload, cfg } = payload_fixture(); let valid = || PayloadStatus::from_status(PayloadStatusEnum::Valid); let (client, l1, l2) = test_engine_client(cfg.clone()); - l2.expect("engine_newPayloadV1", valid()); + l2.expect("engine_newPayloadV2", valid()); l2.expect("engine_forkchoiceUpdatedV3", ForkchoiceUpdated::new(valid())); let client = Arc::new(client); let (tx, mut rx) = mpsc::channel(1); @@ -196,7 +196,7 @@ async fn unsafe_head_is_published_before_the_canonicalization_response() { async fn invalid_forkchoice_state_is_relayed_as_a_reset_error() { let PayloadFixture { payload, cfg } = payload_fixture(); let (client, l1, l2) = test_engine_client(cfg.clone()); - l2.expect("engine_newPayloadV1", PayloadStatus::from_status(PayloadStatusEnum::Valid)); + l2.expect("engine_newPayloadV2", PayloadStatus::from_status(PayloadStatusEnum::Valid)); l2.expect_error_code("engine_forkchoiceUpdatedV3", -38002); let (tx, mut rx) = mpsc::channel(1); let mut state = EngineState::default(); diff --git a/rust/kona/crates/node/engine/src/task_queue/tasks/insert/task.rs b/rust/kona/crates/node/engine/src/task_queue/tasks/insert/task.rs index 54d2d380709..00e5d13b016 100644 --- a/rust/kona/crates/node/engine/src/task_queue/tasks/insert/task.rs +++ b/rust/kona/crates/node/engine/src/task_queue/tasks/insert/task.rs @@ -89,7 +89,13 @@ pub(in crate::task_queue) async fn insert_payload( // Insert the new payload. // Form the new unsafe block ref from the execution payload. let response = match payload.clone() { - OpExecutionPayloadEnvelope::V1(payload) => client.new_payload_v1(payload).await, + // A V1 envelope has no withdrawals, so it is a pre-Canyon payload. It goes through + // engine_newPayloadV2, which accepts a V1 payload; op-reth serves no engine_newPayloadV1. + OpExecutionPayloadEnvelope::V1(payload) => { + let payload_input = + ExecutionPayloadInputV2 { execution_payload: payload, withdrawals: None }; + client.new_payload_v2(payload_input).await + } OpExecutionPayloadEnvelope::V2(payload) => { let payload_input = ExecutionPayloadInputV2 { execution_payload: payload.payload_inner, diff --git a/rust/kona/crates/node/engine/src/task_queue/tasks/task.rs b/rust/kona/crates/node/engine/src/task_queue/tasks/task.rs index ee976a02201..b2778b82aed 100644 --- a/rust/kona/crates/node/engine/src/task_queue/tasks/task.rs +++ b/rust/kona/crates/node/engine/src/task_queue/tasks/task.rs @@ -243,8 +243,9 @@ mod tests { use super::*; use crate::{EngineBuildError, SynchronizeTaskError, test_utils::test_engine_client}; use alloy_consensus::Block; - use alloy_primitives::Bytes; - use alloy_rpc_types_engine::{ExecutionPayloadV1, PayloadStatus}; + use alloy_eips::eip4895::Withdrawal; + use alloy_primitives::{Address, Bytes}; + use alloy_rpc_types_engine::{ExecutionPayloadV1, ExecutionPayloadV2, PayloadStatus}; use kona_genesis::RollupConfig; use op_alloy_consensus::OpTxEnvelope; use op_alloy_rpc_types_engine::OpExecutionPayloadEnvelope; @@ -310,7 +311,7 @@ mod tests { }); let valid = || PayloadStatus::from_status(PayloadStatusEnum::Valid); let (client, l1, l2) = test_engine_client(config.clone()); - l2.expect("engine_newPayloadV1", valid()); + l2.expect("engine_newPayloadV2", valid()); l2.expect( "engine_forkchoiceUpdatedV3", alloy_rpc_types_engine::ForkchoiceUpdated::new(valid()), @@ -342,7 +343,7 @@ mod tests { let config = Arc::new(RollupConfig::default()); let (client, l1, l2) = test_engine_client(config.clone()); l2.expect( - "engine_newPayloadV1", + "engine_newPayloadV2", PayloadStatus::from_status(PayloadStatusEnum::Invalid { validation_error: "invalid transaction".into(), }), @@ -365,4 +366,37 @@ mod tests { l1.assert_finished(); l2.assert_finished(); } + + #[tokio::test] + async fn canyon_payload_insert_carries_its_withdrawals() { + let config = Arc::new(RollupConfig::default()); + let (client, l1, l2) = test_engine_client(config.clone()); + let payload = ExecutionPayloadV2 { + payload_inner: ExecutionPayloadV1::from_block_slow(&Block::::default()), + withdrawals: vec![Withdrawal { + index: 1, + validator_index: 2, + address: Address::repeat_byte(0x11), + amount: 3, + }], + }; + l2.expect_params( + "engine_newPayloadV2", + serde_json::json!([payload]), + PayloadStatus::from_status(PayloadStatusEnum::Invalid { + validation_error: "invalid block".into(), + }), + ); + let task = EngineTask::Insert(Box::new(InsertTask::new( + Arc::new(client), + config, + OpExecutionPayloadEnvelope::V2(payload), + false, + Arc::new(crate::NoopBlockSink), + ))); + + task.execute(&mut EngineState::default()).await.unwrap(); + l1.assert_finished(); + l2.assert_finished(); + } } 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 b6473cde98d..b5bec1b52f3 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 @@ -309,7 +309,7 @@ mod tests { validation_error: "invalid".into(), }) }; - l2.expect("engine_newPayloadV1", invalid()); + l2.expect("engine_newPayloadV2", invalid()); if matches!(fallback, Fallback::ReplacementRejected) { l2.expect( "engine_forkchoiceUpdatedV3", @@ -401,7 +401,7 @@ mod tests { block_value: Default::default(), }, ); - l2.expect("engine_newPayloadV1", valid()); + l2.expect("engine_newPayloadV2", valid()); l2.expect("engine_forkchoiceUpdatedV3", ForkchoiceUpdated::new(valid())); let sink = RecordingSink::default(); let mut state = EngineState::default(); diff --git a/rust/kona/crates/node/service/src/actors/engine/queue_tests.rs b/rust/kona/crates/node/service/src/actors/engine/queue_tests.rs index 49e30d84f94..2facc33360c 100644 --- a/rust/kona/crates/node/service/src/actors/engine/queue_tests.rs +++ b/rust/kona/crates/node/service/src/actors/engine/queue_tests.rs @@ -51,7 +51,7 @@ async fn healthy_unsafe_imports_keep_engine_queue_bounded() { .unwrap(), ); l2.expect_params( - "engine_newPayloadV1", + "engine_newPayloadV2", serde_json::json!([payload]), PayloadStatus::from_status(PayloadStatusEnum::Valid), );