diff --git a/Cargo.lock b/Cargo.lock index 995f36e5e49f..abed09267eb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6993,7 +6993,6 @@ name = "reth-engine-primitives" version = "1.0.7" dependencies = [ "alloy-primitives", - "reth-chainspec", "reth-execution-types", "reth-payload-primitives", "reth-primitives", diff --git a/crates/engine/primitives/Cargo.toml b/crates/engine/primitives/Cargo.toml index 43bde32eb1e1..008af4503327 100644 --- a/crates/engine/primitives/Cargo.toml +++ b/crates/engine/primitives/Cargo.toml @@ -12,7 +12,6 @@ workspace = true [dependencies] # reth -reth-chainspec.workspace = true reth-execution-types.workspace = true reth-payload-primitives.workspace = true reth-primitives.workspace = true diff --git a/crates/engine/primitives/src/lib.rs b/crates/engine/primitives/src/lib.rs index 284ed9f0fb02..8e1b6441ae3d 100644 --- a/crates/engine/primitives/src/lib.rs +++ b/crates/engine/primitives/src/lib.rs @@ -11,7 +11,6 @@ mod invalid_block_hook; pub use invalid_block_hook::InvalidBlockHook; -use reth_chainspec::ChainSpec; pub use reth_payload_primitives::{ BuiltPayload, EngineApiMessageVersion, EngineObjectValidationError, PayloadOrAttributes, PayloadTypes, @@ -32,6 +31,9 @@ pub trait EngineTypes: + Serialize + 'static { + /// The chain specification of the node. + type ChainSpec: Send + Sync; + /// Execution Payload V1 type. type ExecutionPayloadV1: DeserializeOwned + Serialize + Clone + Unpin + Send + Sync + 'static; /// Execution Payload V2 type. @@ -44,7 +46,7 @@ pub trait EngineTypes: /// Validates the presence or exclusion of fork-specific fields based on the payload attributes /// and the message version. fn validate_version_specific_fields( - chain_spec: &ChainSpec, + chain_spec: &Self::ChainSpec, version: EngineApiMessageVersion, payload_or_attrs: PayloadOrAttributes<'_, Self::PayloadAttributes>, ) -> Result<(), EngineObjectValidationError>; diff --git a/crates/ethereum/engine-primitives/src/lib.rs b/crates/ethereum/engine-primitives/src/lib.rs index 5554beea316f..955cdf8bb308 100644 --- a/crates/ethereum/engine-primitives/src/lib.rs +++ b/crates/ethereum/engine-primitives/src/lib.rs @@ -36,6 +36,8 @@ impl PayloadTypes for EthEngineTypes { } impl EngineTypes for EthEngineTypes { + type ChainSpec = ChainSpec; + type ExecutionPayloadV1 = ExecutionPayloadV1; type ExecutionPayloadV2 = ExecutionPayloadEnvelopeV2; type ExecutionPayloadV3 = ExecutionPayloadEnvelopeV3; diff --git a/crates/node/types/src/lib.rs b/crates/node/types/src/lib.rs index 2ad2f8abd873..dda669817093 100644 --- a/crates/node/types/src/lib.rs +++ b/crates/node/types/src/lib.rs @@ -39,7 +39,7 @@ pub trait NodeTypes: Send + Sync + Unpin + 'static { /// The type that configures an Ethereum-like node with an engine for consensus. pub trait NodeTypesWithEngine: NodeTypes { /// The node's engine types, defining the interaction with the consensus engine. - type Engine: EngineTypes; + type Engine: EngineTypes; } /// A helper trait that is downstream of the [`NodeTypesWithEngine`] trait and adds database to the @@ -166,7 +166,7 @@ where impl NodeTypesWithEngine for AnyNodeTypesWithEngine where P: NodePrimitives + Send + Sync + Unpin + 'static, - E: EngineTypes + Send + Sync + Unpin, + E: EngineTypes + Send + Sync + Unpin, C: EthChainSpec, { type Engine = E; diff --git a/crates/optimism/node/src/engine.rs b/crates/optimism/node/src/engine.rs index 0b0785306560..4bd6b78ea845 100644 --- a/crates/optimism/node/src/engine.rs +++ b/crates/optimism/node/src/engine.rs @@ -27,6 +27,8 @@ impl PayloadTypes for OptimismEngineTypes { } impl EngineTypes for OptimismEngineTypes { + type ChainSpec = ChainSpec; + type ExecutionPayloadV1 = ExecutionPayloadV1; type ExecutionPayloadV2 = ExecutionPayloadEnvelopeV2; type ExecutionPayloadV3 = OptimismExecutionPayloadEnvelopeV3; diff --git a/crates/rpc/rpc-engine-api/src/engine_api.rs b/crates/rpc/rpc-engine-api/src/engine_api.rs index a09ef8661901..ed91c0102b27 100644 --- a/crates/rpc/rpc-engine-api/src/engine_api.rs +++ b/crates/rpc/rpc-engine-api/src/engine_api.rs @@ -71,7 +71,7 @@ struct EngineApiInner { impl EngineApi where Provider: HeaderProvider + BlockReader + StateProviderFactory + EvmEnvProvider + 'static, - EngineT: EngineTypes, + EngineT: EngineTypes, Pool: TransactionPool + 'static, { /// Create new instance of [`EngineApi`]. @@ -622,7 +622,7 @@ where impl EngineApiServer for EngineApi where Provider: HeaderProvider + BlockReader + StateProviderFactory + EvmEnvProvider + 'static, - EngineT: EngineTypes, + EngineT: EngineTypes, Pool: TransactionPool + 'static, { /// Handler for `engine_newPayloadV1` diff --git a/examples/custom-engine-types/src/main.rs b/examples/custom-engine-types/src/main.rs index 94a24121e9ba..7f64a6962de0 100644 --- a/examples/custom-engine-types/src/main.rs +++ b/examples/custom-engine-types/src/main.rs @@ -168,6 +168,8 @@ impl PayloadTypes for CustomEngineTypes { } impl EngineTypes for CustomEngineTypes { + type ChainSpec = ChainSpec; + type ExecutionPayloadV1 = ExecutionPayloadV1; type ExecutionPayloadV2 = ExecutionPayloadEnvelopeV2; type ExecutionPayloadV3 = ExecutionPayloadEnvelopeV3;