From ca9f94cc7b024e8772b048578fcbc7542af2fada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Narzis?= <78718413+lean-apple@users.noreply.github.com> Date: Tue, 3 Jun 2025 10:57:19 +0200 Subject: [PATCH] refactor: relax `OpAddOns` trait bounds (#16582) --- crates/optimism/node/src/node.rs | 50 +++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/crates/optimism/node/src/node.rs b/crates/optimism/node/src/node.rs index ed74a56b94..e157c7d04b 100644 --- a/crates/optimism/node/src/node.rs +++ b/crates/optimism/node/src/node.rs @@ -25,8 +25,8 @@ use reth_node_builder::{ }, node::{FullNodeTypes, NodeTypes}, rpc::{ - EngineValidatorAddOn, EngineValidatorBuilder, EthApiBuilder, RethRpcAddOns, - RethRpcServerHandles, RpcAddOns, RpcContext, RpcHandle, + EngineApiBuilder, EngineValidatorAddOn, EngineValidatorBuilder, EthApiBuilder, + RethRpcAddOns, RethRpcServerHandles, RpcAddOns, RpcContext, RpcHandle, }, BuilderContext, DebugNode, Node, NodeAdapter, NodeComponentsBuilder, }; @@ -201,6 +201,8 @@ where type AddOns = OpAddOns< NodeAdapter>::Components>, OpEthApiBuilder, + OpEngineValidatorBuilder, + OpEngineApiBuilder, >; fn components_builder(&self) -> Self::ComponentsBuilder { @@ -238,12 +240,7 @@ impl NodeTypes for OpNode { /// Add-ons w.r.t. optimism. #[derive(Debug)] -pub struct OpAddOns< - N: FullNodeComponents, - EthB: EthApiBuilder, - EV = OpEngineValidatorBuilder, - EB = OpEngineApiBuilder, -> { +pub struct OpAddOns, EV, EB> { /// Rpc add-ons responsible for launching the RPC servers and instantiating the RPC handlers /// and eth-api. pub rpc_add_ons: RpcAddOns, @@ -258,7 +255,13 @@ pub struct OpAddOns< enable_tx_conditional: bool, } -impl Default for OpAddOns> +impl Default + for OpAddOns< + N, + OpEthApiBuilder, + OpEngineValidatorBuilder, + OpEngineApiBuilder, + > where N: FullNodeComponents, OpEthApiBuilder: EthApiBuilder, @@ -268,7 +271,13 @@ where } } -impl OpAddOns> +impl + OpAddOns< + N, + OpEthApiBuilder, + OpEngineValidatorBuilder, + OpEngineApiBuilder, + > where N: FullNodeComponents, OpEthApiBuilder: EthApiBuilder, @@ -341,7 +350,7 @@ where } } -impl NodeAddOns for OpAddOns> +impl NodeAddOns for OpAddOns, EV, EB> where N: FullNodeComponents< Types: NodeTypes< @@ -357,6 +366,8 @@ where EvmFactoryFor: EvmFactory>, OpEthApi: FullEthApiServer, NetworkT: op_alloy_network::Network + Unpin, + EV: EngineValidatorBuilder, + EB: EngineApiBuilder, { type Handle = RpcHandle>; @@ -434,7 +445,7 @@ where } } -impl RethRpcAddOns for OpAddOns> +impl RethRpcAddOns for OpAddOns, EV, EB> where N: FullNodeComponents< Types: NodeTypes< @@ -450,6 +461,8 @@ where EvmFactoryFor: EvmFactory>, OpEthApi: FullEthApiServer, NetworkT: op_alloy_network::Network + Unpin, + EV: EngineValidatorBuilder, + EB: EngineApiBuilder, { type EthApi = OpEthApi; @@ -458,7 +471,7 @@ where } } -impl EngineValidatorAddOn for OpAddOns> +impl EngineValidatorAddOn for OpAddOns, EV, EB> where N: FullNodeComponents< Types: NodeTypes< @@ -468,6 +481,8 @@ where >, >, OpEthApiBuilder: EthApiBuilder, + EV: EngineValidatorBuilder, + EB: EngineApiBuilder, { type Validator = OpEngineValidator< N::Provider, @@ -537,7 +552,14 @@ impl OpAddOnsBuilder { impl OpAddOnsBuilder { /// Builds an instance of [`OpAddOns`]. - pub fn build(self) -> OpAddOns> + pub fn build( + self, + ) -> OpAddOns< + N, + OpEthApiBuilder, + OpEngineValidatorBuilder, + OpEngineApiBuilder, + > where N: FullNodeComponents, OpEthApiBuilder: EthApiBuilder,