refactor: relax OpAddOns (#16180)

This commit is contained in:
Léa Narzis
2025-05-14 18:59:15 +02:00
committed by GitHub
parent ffbdd97592
commit b9e218343c

View File

@@ -192,8 +192,10 @@ where
OpConsensusBuilder,
>;
type AddOns =
OpAddOns<NodeAdapter<N, <Self::ComponentsBuilder as NodeComponentsBuilder<N>>::Components>>;
type AddOns = OpAddOns<
NodeAdapter<N, <Self::ComponentsBuilder as NodeComponentsBuilder<N>>::Components>,
OpEthApiBuilder,
>;
fn components_builder(&self) -> Self::ComponentsBuilder {
Self::components(self)
@@ -236,19 +238,15 @@ impl NodeTypes for OpNode {
/// Add-ons w.r.t. optimism.
#[derive(Debug)]
pub struct OpAddOns<N>
where
pub struct OpAddOns<
N: FullNodeComponents,
OpEthApiBuilder: EthApiBuilder<N>,
{
EthB: EthApiBuilder<N>,
EV = OpEngineValidatorBuilder,
EB = OpEngineApiBuilder<OpEngineValidatorBuilder>,
> {
/// Rpc add-ons responsible for launching the RPC servers and instantiating the RPC handlers
/// and eth-api.
pub rpc_add_ons: RpcAddOns<
N,
OpEthApiBuilder,
OpEngineValidatorBuilder,
OpEngineApiBuilder<OpEngineValidatorBuilder>,
>,
pub rpc_add_ons: RpcAddOns<N, EthB, EV, EB>,
/// Data availability configuration for the OP builder.
pub da_config: OpDAConfig,
/// Sequencer client, configured to forward submitted transactions to sequencer of given OP
@@ -258,7 +256,7 @@ where
enable_tx_conditional: bool,
}
impl<N> Default for OpAddOns<N>
impl<N> Default for OpAddOns<N, OpEthApiBuilder>
where
N: FullNodeComponents<Types: NodeTypes<Primitives = OpPrimitives>>,
OpEthApiBuilder: EthApiBuilder<N>,
@@ -268,7 +266,7 @@ where
}
}
impl<N> OpAddOns<N>
impl<N> OpAddOns<N, OpEthApiBuilder>
where
N: FullNodeComponents<Types: NodeTypes<Primitives = OpPrimitives>>,
OpEthApiBuilder: EthApiBuilder<N>,
@@ -279,7 +277,7 @@ where
}
}
impl<N> NodeAddOns<N> for OpAddOns<N>
impl<N> NodeAddOns<N> for OpAddOns<N, OpEthApiBuilder>
where
N: FullNodeComponents<
Types: NodeTypes<
@@ -364,7 +362,7 @@ where
}
}
impl<N> RethRpcAddOns<N> for OpAddOns<N>
impl<N> RethRpcAddOns<N> for OpAddOns<N, OpEthApiBuilder>
where
N: FullNodeComponents<
Types: NodeTypes<
@@ -386,7 +384,7 @@ where
}
}
impl<N> EngineValidatorAddOn<N> for OpAddOns<N>
impl<N> EngineValidatorAddOn<N> for OpAddOns<N, OpEthApiBuilder>
where
N: FullNodeComponents<
Types: NodeTypes<
@@ -439,7 +437,7 @@ impl OpAddOnsBuilder {
impl OpAddOnsBuilder {
/// Builds an instance of [`OpAddOns`].
pub fn build<N>(self) -> OpAddOns<N>
pub fn build<N>(self) -> OpAddOns<N, OpEthApiBuilder>
where
N: FullNodeComponents<Types: NodeTypes<Primitives = OpPrimitives>>,
OpEthApiBuilder: EthApiBuilder<N>,
@@ -449,8 +447,8 @@ impl OpAddOnsBuilder {
OpAddOns {
rpc_add_ons: RpcAddOns::new(
OpEthApiBuilder::default().with_sequencer(sequencer_url.clone()),
Default::default(),
Default::default(),
OpEngineValidatorBuilder::default(),
OpEngineApiBuilder::default(),
),
da_config: da_config.unwrap_or_default(),
sequencer_url,