Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove redundant payload fn #13624

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions crates/rpc/rpc-builder/tests/it/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,33 @@

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<C>(client: &C)
where
C: ClientT + SubscriptionClientT + Sync + EngineApiClient<EthEngineTypes>,
{
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::<TransactionSigned>(
&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;
Expand Down
10 changes: 1 addition & 9 deletions crates/rpc/rpc-types-compat/src/engine/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -106,14 +106,6 @@ pub fn convert_block_to_payload_field_v2<T: Encodable2718>(
}
}

/// 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,
Expand Down
Loading