Skip to content

Commit

Permalink
chore: rm another payload conversion fn (#13637)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 3, 2025
1 parent dbff11a commit 9b44e2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
11 changes: 6 additions & 5 deletions crates/rpc/rpc-engine-api/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,9 +1029,8 @@ mod tests {
use reth_engine_primitives::BeaconEngineMessage;
use reth_ethereum_engine_primitives::{EthEngineTypes, EthereumEngineValidator};
use reth_payload_builder::test_utils::spawn_test_payload_service;
use reth_primitives::{Block, SealedBlock};
use reth_primitives::{Block, TransactionSigned};
use reth_provider::test_utils::MockEthProvider;
use reth_rpc_types_compat::engine::payload::execution_payload_from_sealed_block;
use reth_tasks::TokioTaskExecutor;
use reth_testing_utils::generators::random_block;
use reth_transaction_pool::noop::NoopTransactionPool;
Expand Down Expand Up @@ -1098,9 +1097,11 @@ mod tests {
let (mut handle, api) = setup_engine_api();

tokio::spawn(async move {
api.new_payload_v1(execution_payload_from_sealed_block(SealedBlock::default()))
.await
.unwrap();
api.new_payload_v1(ExecutionPayloadV1::from_block_slow(
&Block::<TransactionSigned>::default(),
))
.await
.unwrap();
});
assert_matches!(handle.from_api.recv().await, Some(BeaconEngineMessage::NewPayload { .. }));
}
Expand Down
21 changes: 0 additions & 21 deletions crates/rpc/rpc-types-compat/src/engine/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,6 @@ pub fn convert_to_payload_body_v1(
}
}

/// Transforms a [`SealedBlock`] into a [`ExecutionPayloadV1`]
pub fn execution_payload_from_sealed_block(value: SealedBlock) -> ExecutionPayloadV1 {
let transactions = value.encoded_2718_transactions();
ExecutionPayloadV1 {
parent_hash: value.parent_hash,
fee_recipient: value.beneficiary,
state_root: value.state_root,
receipts_root: value.receipts_root,
logs_bloom: value.logs_bloom,
prev_randao: value.mix_hash,
block_number: value.number,
gas_limit: value.gas_limit,
gas_used: value.gas_used,
timestamp: value.timestamp,
extra_data: value.extra_data.clone(),
base_fee_per_gas: U256::from(value.base_fee_per_gas.unwrap_or_default()),
block_hash: value.hash(),
transactions,
}
}

#[cfg(test)]
mod tests {
use super::block_to_payload_v3;
Expand Down

0 comments on commit 9b44e2a

Please sign in to comment.