diff --git a/Cargo.lock b/Cargo.lock index 82f42b07b16f..b3a39cb58748 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6417,6 +6417,7 @@ dependencies = [ name = "reth-beacon-consensus" version = "1.1.0" dependencies = [ + "alloy-eips", "alloy-genesis", "alloy-primitives", "alloy-rpc-types-engine", @@ -7217,6 +7218,7 @@ name = "reth-engine-util" version = "1.1.0" dependencies = [ "alloy-consensus", + "alloy-eips", "alloy-primitives", "alloy-rpc-types-engine", "eyre", @@ -8400,7 +8402,6 @@ name = "reth-payload-validator" version = "1.1.0" dependencies = [ "alloy-eips", - "alloy-primitives", "alloy-rpc-types", "reth-chainspec", "reth-primitives", diff --git a/crates/consensus/beacon/Cargo.toml b/crates/consensus/beacon/Cargo.toml index f1366812608c..192ae2b93df7 100644 --- a/crates/consensus/beacon/Cargo.toml +++ b/crates/consensus/beacon/Cargo.toml @@ -31,6 +31,7 @@ reth-node-types.workspace = true reth-chainspec = { workspace = true, optional = true } # ethereum +alloy-eips.workspace = true alloy-primitives.workspace = true alloy-rpc-types-engine.workspace = true diff --git a/crates/consensus/beacon/src/engine/handle.rs b/crates/consensus/beacon/src/engine/handle.rs index 1f4445901645..bb5c4dee174c 100644 --- a/crates/consensus/beacon/src/engine/handle.rs +++ b/crates/consensus/beacon/src/engine/handle.rs @@ -4,7 +4,7 @@ use crate::{ engine::message::OnForkChoiceUpdated, BeaconConsensusEngineEvent, BeaconEngineMessage, BeaconForkChoiceUpdateError, BeaconOnNewPayloadError, }; -use alloy_primitives::Bytes; +use alloy_eips::eip7685::Requests; use alloy_rpc_types_engine::{ CancunPayloadFields, ExecutionPayload, ForkchoiceState, ForkchoiceUpdated, PayloadStatus, }; @@ -48,7 +48,7 @@ where &self, payload: ExecutionPayload, cancun_fields: Option, - execution_requests: Option>, + execution_requests: Option, ) -> Result { let (tx, rx) = oneshot::channel(); // HACK(onbjerg): We should have a pectra payload fields struct, this is just a temporary diff --git a/crates/consensus/beacon/src/engine/message.rs b/crates/consensus/beacon/src/engine/message.rs index 45d0c57f45ed..56328f03db0b 100644 --- a/crates/consensus/beacon/src/engine/message.rs +++ b/crates/consensus/beacon/src/engine/message.rs @@ -1,5 +1,5 @@ use crate::engine::{error::BeaconOnNewPayloadError, forkchoice::ForkchoiceStatus}; -use alloy_primitives::Bytes; +use alloy_eips::eip7685::Requests; use alloy_rpc_types_engine::{ CancunPayloadFields, ExecutionPayload, ForkChoiceUpdateResult, ForkchoiceState, ForkchoiceUpdateError, ForkchoiceUpdated, PayloadId, PayloadStatus, PayloadStatusEnum, @@ -150,7 +150,7 @@ pub enum BeaconEngineMessage { // HACK(onbjerg): We should have a pectra payload fields struct, this is just a temporary // workaround. /// The pectra EIP-7685 execution requests. - execution_requests: Option>, + execution_requests: Option, /// The sender for returning payload status result. tx: oneshot::Sender>, }, diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index edd3d6db3239..cff648b2843b 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -1,4 +1,5 @@ -use alloy_primitives::{BlockNumber, Bytes, B256}; +use alloy_eips::eip7685::Requests; +use alloy_primitives::{BlockNumber, B256}; use alloy_rpc_types_engine::{ CancunPayloadFields, ExecutionPayload, ForkchoiceState, PayloadStatus, PayloadStatusEnum, PayloadValidationError, @@ -1087,7 +1088,7 @@ where cancun_fields: Option, // HACK(onbjerg): We should have a pectra payload fields struct, this is just a temporary // workaround. - execution_requests: Option>, + execution_requests: Option, ) -> Result, BeaconOnNewPayloadError> { self.metrics.new_payload_messages.increment(1); diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index 02802dff66cb..a2abd3f531df 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -7,7 +7,7 @@ use crate::{ use alloy_eips::BlockNumHash; use alloy_primitives::{ map::{HashMap, HashSet}, - BlockNumber, Bytes, B256, U256, + BlockNumber, B256, U256, }; use alloy_rpc_types_engine::{ CancunPayloadFields, ExecutionPayload, ForkchoiceState, PayloadStatus, PayloadStatusEnum, @@ -70,6 +70,7 @@ use crate::{ engine::{EngineApiKind, EngineApiRequest}, tree::metrics::EngineApiMetrics, }; +use alloy_eips::eip7685::Requests; pub use config::TreeConfig; pub use invalid_block_hook::{InvalidBlockHooks, NoopInvalidBlockHook}; pub use persistence_state::PersistenceState; @@ -721,7 +722,7 @@ where &mut self, payload: ExecutionPayload, cancun_fields: Option, - execution_requests: Option>, + execution_requests: Option, ) -> Result, InsertBlockFatalError> { trace!(target: "engine::tree", "invoked new payload"); self.metrics.engine.new_payload_messages.increment(1); diff --git a/crates/engine/util/Cargo.toml b/crates/engine/util/Cargo.toml index c11948b9405f..35a7e74bb219 100644 --- a/crates/engine/util/Cargo.toml +++ b/crates/engine/util/Cargo.toml @@ -27,6 +27,7 @@ revm-primitives.workspace = true reth-trie.workspace = true # alloy +alloy-eips.workspace = true alloy-primitives.workspace = true alloy-rpc-types-engine.workspace = true alloy-consensus.workspace = true @@ -49,6 +50,4 @@ itertools.workspace = true tracing.workspace = true [features] -optimism = [ - "reth-beacon-consensus/optimism", -] +optimism = ["reth-beacon-consensus/optimism"] diff --git a/crates/engine/util/src/reorg.rs b/crates/engine/util/src/reorg.rs index 90b5c90aa952..e07b18b92509 100644 --- a/crates/engine/util/src/reorg.rs +++ b/crates/engine/util/src/reorg.rs @@ -1,7 +1,8 @@ //! Stream wrapper that simulates reorgs. use alloy_consensus::Transaction; -use alloy_primitives::{Bytes, U256}; +use alloy_eips::eip7685::Requests; +use alloy_primitives::U256; use alloy_rpc_types_engine::{ CancunPayloadFields, ExecutionPayload, ForkchoiceState, PayloadStatus, }; @@ -250,8 +251,8 @@ fn create_reorg_head( mut depth: usize, next_payload: ExecutionPayload, next_cancun_fields: Option, - next_execution_requests: Option>, -) -> RethResult<(ExecutionPayload, Option, Option>)> + next_execution_requests: Option, +) -> RethResult<(ExecutionPayload, Option, Option)> where Provider: BlockReader + StateProviderFactory, Evm: ConfigureEvm
, diff --git a/crates/payload/validator/Cargo.toml b/crates/payload/validator/Cargo.toml index a96799d7bcec..619b99f28de2 100644 --- a/crates/payload/validator/Cargo.toml +++ b/crates/payload/validator/Cargo.toml @@ -19,5 +19,4 @@ reth-rpc-types-compat.workspace = true # alloy alloy-eips.workspace = true -alloy-primitives.workspace = true alloy-rpc-types = { workspace = true, features = ["engine"] } diff --git a/crates/payload/validator/src/lib.rs b/crates/payload/validator/src/lib.rs index fdcd9244a434..3ec7b206a5b1 100644 --- a/crates/payload/validator/src/lib.rs +++ b/crates/payload/validator/src/lib.rs @@ -9,7 +9,6 @@ #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] use alloy_eips::eip7685::Requests; -use alloy_primitives::Bytes; use alloy_rpc_types::engine::{ExecutionPayload, MaybeCancunPayloadFields, PayloadError}; use reth_chainspec::EthereumHardforks; use reth_primitives::SealedBlock; @@ -114,17 +113,14 @@ impl ExecutionPayloadValidator { &self, payload: ExecutionPayload, cancun_fields: MaybeCancunPayloadFields, - execution_requests: Option>, + execution_requests: Option, ) -> Result { let expected_hash = payload.block_hash(); // First parse the block - let sealed_block = try_into_block( - payload, - cancun_fields.parent_beacon_block_root(), - execution_requests.map(Requests::new), - )? - .seal_slow(); + let sealed_block = + try_into_block(payload, cancun_fields.parent_beacon_block_root(), execution_requests)? + .seal_slow(); // Ensure the hash included in the payload matches the block hash if expected_hash != sealed_block.hash() { diff --git a/crates/rpc/rpc-api/src/engine.rs b/crates/rpc/rpc-api/src/engine.rs index 458768c38b19..ddf6d846119d 100644 --- a/crates/rpc/rpc-api/src/engine.rs +++ b/crates/rpc/rpc-api/src/engine.rs @@ -3,7 +3,7 @@ //! This contains the `engine_` namespace and the subset of the `eth_` namespace that is exposed to //! the consensus client. -use alloy_eips::{eip4844::BlobAndProofV1, BlockId, BlockNumberOrTag}; +use alloy_eips::{eip4844::BlobAndProofV1, eip7685::Requests, BlockId, BlockNumberOrTag}; use alloy_json_rpc::RpcObject; use alloy_primitives::{Address, BlockHash, Bytes, B256, U256, U64}; use alloy_rpc_types::{ @@ -57,7 +57,7 @@ pub trait EngineApi { payload: ExecutionPayloadV3, versioned_hashes: Vec, parent_beacon_block_root: B256, - execution_requests: Vec, + execution_requests: Requests, ) -> RpcResult; /// See also diff --git a/crates/rpc/rpc-engine-api/src/engine_api.rs b/crates/rpc/rpc-engine-api/src/engine_api.rs index 9450b2c92170..ca055a77ea10 100644 --- a/crates/rpc/rpc-engine-api/src/engine_api.rs +++ b/crates/rpc/rpc-engine-api/src/engine_api.rs @@ -1,8 +1,8 @@ use crate::{ capabilities::EngineCapabilities, metrics::EngineApiMetrics, EngineApiError, EngineApiResult, }; -use alloy_eips::eip4844::BlobAndProofV1; -use alloy_primitives::{BlockHash, BlockNumber, Bytes, B256, U64}; +use alloy_eips::{eip4844::BlobAndProofV1, eip7685::Requests}; +use alloy_primitives::{BlockHash, BlockNumber, B256, U64}; use alloy_rpc_types_engine::{ CancunPayloadFields, ClientVersionV1, ExecutionPayload, ExecutionPayloadBodiesV1, ExecutionPayloadInputV2, ExecutionPayloadV1, ExecutionPayloadV3, ForkchoiceState, @@ -189,7 +189,7 @@ where parent_beacon_block_root: B256, // TODO(onbjerg): Figure out why we even get these here, since we'll check the requests // from execution against the requests root in the header. - execution_requests: Vec, + execution_requests: Requests, ) -> EngineApiResult { let payload = ExecutionPayload::from(payload); let payload_or_attrs = @@ -677,7 +677,7 @@ where payload: ExecutionPayloadV3, versioned_hashes: Vec, parent_beacon_block_root: B256, - execution_requests: Vec, + execution_requests: Requests, ) -> RpcResult { trace!(target: "rpc::engine", "Serving engine_newPayloadV4"); let start = Instant::now();