From fa5819d527efc38a754f94e4ca63818778e3a1cd Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 3 Jan 2025 14:01:19 +0100 Subject: [PATCH] chore: remove redundant payload fn --- crates/rpc/rpc-builder/tests/it/auth.rs | 22 ++++++++++++++----- .../rpc-types-compat/src/engine/payload.rs | 10 +-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/crates/rpc/rpc-builder/tests/it/auth.rs b/crates/rpc/rpc-builder/tests/it/auth.rs index 390ea7d6ba40..ca5db0494e66 100644 --- a/crates/rpc/rpc-builder/tests/it/auth.rs +++ b/crates/rpc/rpc-builder/tests/it/auth.rs @@ -2,15 +2,16 @@ use crate::utils::launch_auth; use alloy_primitives::U64; -use alloy_rpc_types_engine::{ForkchoiceState, PayloadId, TransitionConfiguration}; +use alloy_rpc_types_engine::{ + ExecutionPayloadInputV2, ExecutionPayloadV1, ForkchoiceState, PayloadId, + TransitionConfiguration, +}; use jsonrpsee::core::client::{ClientT, SubscriptionClientT}; use reth_ethereum_engine_primitives::EthEngineTypes; -use reth_primitives::{Block, BlockExt}; +use reth_primitives::{Block, BlockExt, TransactionSigned}; use reth_rpc_api::clients::EngineApiClient; use reth_rpc_layer::JwtSecret; -use reth_rpc_types_compat::engine::payload::{ - block_to_payload_v1, convert_block_to_payload_input_v2, -}; +use reth_rpc_types_compat::engine::payload::block_to_payload_v1; #[allow(unused_must_use)] async fn test_basic_engine_calls(client: &C) where @@ -18,7 +19,16 @@ where { let block = Block::default().seal_slow(); EngineApiClient::new_payload_v1(client, block_to_payload_v1(block.clone())).await; - EngineApiClient::new_payload_v2(client, convert_block_to_payload_input_v2(block)).await; + EngineApiClient::new_payload_v2( + client, + ExecutionPayloadInputV2 { + execution_payload: ExecutionPayloadV1::from_block_slow::( + &block.unseal(), + ), + withdrawals: None, + }, + ) + .await; EngineApiClient::fork_choice_updated_v1(client, ForkchoiceState::default(), None).await; EngineApiClient::get_payload_v1(client, PayloadId::new([0, 0, 0, 0, 0, 0, 0, 0])).await; EngineApiClient::get_payload_v2(client, PayloadId::new([0, 0, 0, 0, 0, 0, 0, 0])).await; diff --git a/crates/rpc/rpc-types-compat/src/engine/payload.rs b/crates/rpc/rpc-types-compat/src/engine/payload.rs index 6e2e18b19e09..4b5e6ee11e80 100644 --- a/crates/rpc/rpc-types-compat/src/engine/payload.rs +++ b/crates/rpc/rpc-types-compat/src/engine/payload.rs @@ -5,7 +5,7 @@ use alloy_consensus::Header; use alloy_eips::{eip2718::Encodable2718, eip4895::Withdrawals, eip7685::RequestsOrHash}; use alloy_primitives::U256; use alloy_rpc_types_engine::{ - payload::{ExecutionPayloadBodyV1, ExecutionPayloadFieldV2, ExecutionPayloadInputV2}, + payload::{ExecutionPayloadBodyV1, ExecutionPayloadFieldV2}, CancunPayloadFields, ExecutionPayload, ExecutionPayloadSidecar, ExecutionPayloadV1, ExecutionPayloadV2, ExecutionPayloadV3, PraguePayloadFields, }; @@ -106,14 +106,6 @@ pub fn convert_block_to_payload_field_v2( } } -/// Converts [`SealedBlock`] to [`ExecutionPayloadInputV2`] -pub fn convert_block_to_payload_input_v2(value: SealedBlock) -> ExecutionPayloadInputV2 { - ExecutionPayloadInputV2 { - withdrawals: value.body.withdrawals.clone().map(Withdrawals::into_inner), - execution_payload: block_to_payload_v1(value), - } -} - /// Converts a [`reth_primitives_traits::Block`] to [`ExecutionPayloadBodyV1`] pub fn convert_to_payload_body_v1( value: impl reth_primitives_traits::Block,