Skip to content

Commit 1abccba

Browse files
committed
feat: remove unused payload validator dependency and streamline engine imports
1 parent 652a469 commit 1abccba

File tree

12 files changed

+27
-148
lines changed

12 files changed

+27
-148
lines changed

Cargo.lock

+1-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/engine/primitives/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mod error;
1313
use core::fmt;
1414

1515
use alloy_consensus::BlockHeader;
16-
use alloy_rpc_types_engine::{ExecutionPayload, ExecutionPayloadSidecar, PayloadError};
16+
use alloy_rpc_types_engine::{ExecutionPayloadSidecar, PayloadError};
1717
pub use error::BeaconOnNewPayloadError;
1818

1919
mod forkchoice;

crates/engine/primitives/src/message.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::{BeaconOnNewPayloadError, EngineApiMessageVersion, EngineTypes, ForkchoiceStatus};
22
use alloy_rpc_types_engine::{
3-
ExecutionPayload, ExecutionPayloadSidecar, ForkChoiceUpdateResult, ForkchoiceState,
4-
ForkchoiceUpdateError, ForkchoiceUpdated, PayloadId, PayloadStatus, PayloadStatusEnum,
3+
ExecutionPayloadSidecar, ForkChoiceUpdateResult, ForkchoiceState, ForkchoiceUpdateError,
4+
ForkchoiceUpdated, PayloadId, PayloadStatus, PayloadStatusEnum,
55
};
66
use futures::{future::Either, FutureExt};
77
use reth_errors::RethResult;
@@ -160,6 +160,7 @@ pub enum BeaconEngineMessage<Engine: EngineTypes> {
160160
version: EngineApiMessageVersion,
161161
/// The sender for returning forkchoice updated result.
162162
tx: oneshot::Sender<RethResult<OnForkChoiceUpdated>>,
163+
/// Debug mode flag.
163164
debug: bool,
164165
},
165166
/// Message with exchanged transition configuration.

crates/ethereum/engine-primitives/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
mod payload;
1212
use std::sync::Arc;
1313

14-
use alloy_rpc_types_engine::{ExecutionPayload, ExecutionPayloadSidecar, PayloadError};
1514
pub use alloy_rpc_types_engine::{
1615
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,
1716
ExecutionPayloadV1, PayloadAttributes as EthPayloadAttributes,
1817
};
18+
use alloy_rpc_types_engine::{ExecutionPayloadSidecar, PayloadError};
1919
pub use payload::{EthBuiltPayload, EthPayloadBuilderAttributes};
2020
use reth_chainspec::ChainSpec;
2121
use reth_engine_primitives::{EngineTypes, EngineValidator, PayloadValidator};

crates/node/builder/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ reth-node-core.workspace = true
4141
reth-node-events.workspace = true
4242
reth-node-metrics.workspace = true
4343
reth-payload-builder.workspace = true
44-
reth-payload-validator.workspace = true
4544
reth-primitives.workspace = true
4645
reth-provider.workspace = true
4746
reth-prune.workspace = true

crates/payload/primitives/src/payload.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::{MessageValidationKind, PayloadAttributes};
22
use alloy_eips::eip4895::Withdrawal;
33
use alloy_primitives::B256;
4-
use alloy_rpc_types_engine::ExecutionPayload;
54
use reth_taiko_engine_types::TaikoExecutionPayload;
65

76
/// Either an [`ExecutionPayload`] or a types that implements the [`PayloadAttributes`] trait.

crates/payload/primitives/src/traits.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use alloy_primitives::{Address, B256, U256};
66
use alloy_rpc_types_engine::{PayloadAttributes as EthPayloadAttributes, PayloadId};
77
use reth_chain_state::ExecutedBlock;
88
use reth_primitives::SealedBlock;
9+
use reth_taiko_engine_types::TaikoPayloadAttributes;
910

1011
/// Represents a built payload type that contains a built [`SealedBlock`] and can be converted into
1112
/// engine API execution payloads.
@@ -100,19 +101,19 @@ impl PayloadAttributes for EthPayloadAttributes {
100101
}
101102
}
102103

103-
// impl PayloadAttributes for TaikoPayloadAttributes {
104-
// fn timestamp(&self) -> u64 {
105-
// self.payload_attributes.timestamp()
106-
// }
104+
impl PayloadAttributes for TaikoPayloadAttributes {
105+
fn timestamp(&self) -> u64 {
106+
self.payload_attributes.timestamp()
107+
}
107108

108-
// fn withdrawals(&self) -> Option<&Vec<Withdrawal>> {
109-
// self.payload_attributes.withdrawals()
110-
// }
109+
fn withdrawals(&self) -> Option<&Vec<Withdrawal>> {
110+
self.payload_attributes.withdrawals()
111+
}
111112

112-
// fn parent_beacon_block_root(&self) -> Option<B256> {
113-
// self.payload_attributes.parent_beacon_block_root()
114-
// }
115-
// }
113+
fn parent_beacon_block_root(&self) -> Option<B256> {
114+
self.payload_attributes.parent_beacon_block_root()
115+
}
116+
}
116117

117118
#[cfg(feature = "op")]
118119
impl PayloadAttributes for op_alloy_rpc_types_engine::OpPayloadAttributes {

crates/payload/validator/src/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
99
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
1010

11-
use alloy_rpc_types::engine::{
12-
ExecutionPayload, ExecutionPayloadSidecar, MaybeCancunPayloadFields, PayloadError,
13-
};
11+
use alloy_rpc_types::engine::{ExecutionPayloadSidecar, MaybeCancunPayloadFields, PayloadError};
1412
use reth_chainspec::EthereumHardforks;
1513
use reth_primitives::{BlockExt, SealedBlock};
1614
use reth_rpc_types_compat::engine::payload::try_into_block;

crates/taiko/engine/primitives/Cargo.toml

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,19 @@ workspace = true
1414
# reth
1515
reth-rpc-types-compat.workspace = true
1616
reth-payload-primitives.workspace = true
17-
reth-primitives.workspace = true
18-
reth-chain-state.workspace = true
1917
alloy-rpc-types-engine.workspace = true
2018
alloy-primitives.workspace = true
2119
alloy-eips.workspace = true
2220

2321
# taiko
2422
reth-taiko-primitives.workspace = true
23+
reth-taiko-engine-types.workspace = true
2524

2625
# ethereum
2726
reth-ethereum-engine-primitives.workspace = true
2827

2928
# misc
3029
serde.workspace = true
31-
serde_with.workspace = true
32-
alloy-serde = "0.1.3"
3330
alloy-rlp.workspace = true
3431
sha2.workspace = true
3532

crates/taiko/engine/primitives/src/lib.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@ pub use alloy_rpc_types_engine::{
1414
ExecutionPayloadEnvelopeV2, ExecutionPayloadEnvelopeV3, ExecutionPayloadEnvelopeV4,
1515
ExecutionPayloadV1, PayloadAttributes as EthPayloadAttributes,
1616
};
17-
pub use payload::{
18-
TaikoExecutionPayload, TaikoExecutionPayloadEnvelopeV2, TaikoPayloadAttributes,
19-
TaikoPayloadBuilderAttributes,
20-
};
17+
pub use payload::{TaikoExecutionPayloadEnvelopeV2, TaikoPayloadBuilderAttributes};

crates/taiko/engine/primitives/src/payload.rs

+5-114
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,17 @@
11
//! Payload related types
22
3-
use alloy_eips::eip4895::{Withdrawal, Withdrawals};
4-
use alloy_primitives::{Address, Bytes, B256, U256};
5-
use alloy_rlp::{Encodable, RlpDecodable, RlpEncodable};
6-
use alloy_rpc_types_engine::{ExecutionPayload, ExecutionPayloadV2, PayloadAttributes, PayloadId};
3+
use alloy_eips::eip4895::Withdrawals;
4+
use alloy_primitives::{Address, B256, U256};
5+
use alloy_rlp::Encodable;
6+
use alloy_rpc_types_engine::{ExecutionPayloadV2, PayloadId};
77
use reth_ethereum_engine_primitives::{EthBuiltPayload, EthPayloadBuilderAttributes};
88
use reth_payload_primitives::PayloadBuilderAttributes;
99
use reth_rpc_types_compat::engine::payload::block_to_payload_v2;
10+
use reth_taiko_engine_types::{BlockMetadata, TaikoPayloadAttributes};
1011
use reth_taiko_primitives::L1Origin;
1112
use serde::{Deserialize, Serialize};
12-
use serde_with::{base64::Base64, serde_as};
1313
use std::convert::Infallible;
1414

15-
/// Taiko Payload Attributes
16-
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
17-
#[serde(rename_all = "camelCase")]
18-
pub struct TaikoPayloadAttributes {
19-
/// The payload attributes
20-
#[serde(flatten)]
21-
pub payload_attributes: PayloadAttributes,
22-
/// EIP1559 base fee
23-
pub base_fee_per_gas: U256,
24-
/// Data from l1 contract
25-
pub block_metadata: BlockMetadata,
26-
/// l1 anchor information
27-
pub l1_origin: L1Origin,
28-
}
29-
30-
impl reth_payload_primitives::PayloadAttributes for TaikoPayloadAttributes {
31-
fn timestamp(&self) -> u64 {
32-
self.payload_attributes.timestamp()
33-
}
34-
35-
fn withdrawals(&self) -> Option<&Vec<Withdrawal>> {
36-
self.payload_attributes.withdrawals()
37-
}
38-
39-
fn parent_beacon_block_root(&self) -> Option<B256> {
40-
self.payload_attributes.parent_beacon_block_root()
41-
}
42-
}
43-
44-
/// This structure contains the information from l1 contract storage
45-
#[serde_as]
46-
#[derive(
47-
Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, RlpDecodable, RlpEncodable,
48-
)]
49-
#[serde(rename_all = "camelCase")]
50-
pub struct BlockMetadata {
51-
/// The Keccak 256-bit hash of the parent
52-
/// block’s header, in its entirety; formally Hp.
53-
pub beneficiary: Address,
54-
/// A scalar value equal to the current limit of gas expenditure per block; formally Hl.
55-
pub gas_limit: u64,
56-
/// Timestamp in l1
57-
#[serde(with = "alloy_serde::quantity")]
58-
pub timestamp: u64,
59-
/// A 256-bit hash which, combined with the
60-
/// nonce, proves that a sufficient amount of computation has been carried out on this block;
61-
/// formally Hm.
62-
pub mix_hash: B256,
63-
/// The origin transactions data
64-
pub tx_list: Bytes,
65-
/// An arbitrary byte array containing data relevant to this block. This must be 32 bytes or
66-
/// fewer; formally Hx.
67-
#[serde_as(as = "Base64")]
68-
pub extra_data: Vec<u8>,
69-
}
70-
7115
/// Taiko Payload Builder Attributes
7216
#[derive(Debug, Clone, PartialEq, Eq)]
7317
pub struct TaikoPayloadBuilderAttributes {
@@ -191,59 +135,6 @@ impl From<EthBuiltPayload> for TaikoExecutionPayloadEnvelopeV2 {
191135
}
192136
}
193137

194-
/// An tiako execution payload
195-
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
196-
#[serde(rename_all = "camelCase")]
197-
pub struct TaikoExecutionPayload {
198-
/// Inner V3 payload
199-
#[serde(flatten)]
200-
pub payload_inner: ExecutionPayload,
201-
202-
/// Allow passing txHash directly instead of transactions list
203-
pub tx_hash: B256,
204-
/// Allow passing `WithdrawalsHash` directly instead of withdrawals
205-
pub withdrawals_hash: B256,
206-
}
207-
208-
impl TaikoExecutionPayload {
209-
/// Returns the block hash
210-
pub const fn block_hash(&self) -> B256 {
211-
self.payload_inner.block_hash()
212-
}
213-
214-
/// Returns the block number
215-
pub const fn block_number(&self) -> u64 {
216-
self.payload_inner.block_number()
217-
}
218-
219-
/// Returns the parent hash
220-
pub const fn parent_hash(&self) -> B256 {
221-
self.payload_inner.parent_hash()
222-
}
223-
224-
/// Returns the withdrawals
225-
pub const fn withdrawals(&self) -> Option<&Vec<Withdrawal>> {
226-
self.payload_inner.withdrawals()
227-
}
228-
229-
/// Returns the timestamp
230-
pub const fn timestamp(&self) -> u64 {
231-
self.payload_inner.timestamp()
232-
}
233-
}
234-
235-
impl From<(ExecutionPayload, B256, B256)> for TaikoExecutionPayload {
236-
fn from((payload_inner, tx_hash, withdrawals_hash): (ExecutionPayload, B256, B256)) -> Self {
237-
Self { payload_inner, tx_hash, withdrawals_hash }
238-
}
239-
}
240-
241-
impl From<ExecutionPayload> for TaikoExecutionPayload {
242-
fn from(value: ExecutionPayload) -> Self {
243-
Self { payload_inner: value, tx_hash: B256::default(), withdrawals_hash: B256::default() }
244-
}
245-
}
246-
247138
/// Generates the payload id for the configured payload from the [`PayloadAttributes`].
248139
///
249140
/// Returns an 8-byte identifier by hashing the payload components with sha256 hash.

crates/taiko/engine/types/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
mod payload;
1212

1313
pub use payload::{
14-
ExecutionPayloadInputV2, TaikoExecutionPayload, TaikoExecutionPayloadEnvelopeV2,
14+
BlockMetadata, ExecutionPayloadInputV2, TaikoExecutionPayload, TaikoExecutionPayloadEnvelopeV2,
1515
TaikoExecutionPayloadInputV2, TaikoPayloadAttributes,
1616
};

0 commit comments

Comments
 (0)