Skip to content

Commit b9e2183

Browse files
authored
refactor: relax OpAddOns (#16180)
1 parent ffbdd97 commit b9e2183

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

crates/optimism/node/src/node.rs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,10 @@ where
192192
OpConsensusBuilder,
193193
>;
194194

195-
type AddOns =
196-
OpAddOns<NodeAdapter<N, <Self::ComponentsBuilder as NodeComponentsBuilder<N>>::Components>>;
195+
type AddOns = OpAddOns<
196+
NodeAdapter<N, <Self::ComponentsBuilder as NodeComponentsBuilder<N>>::Components>,
197+
OpEthApiBuilder,
198+
>;
197199

198200
fn components_builder(&self) -> Self::ComponentsBuilder {
199201
Self::components(self)
@@ -236,19 +238,15 @@ impl NodeTypes for OpNode {
236238

237239
/// Add-ons w.r.t. optimism.
238240
#[derive(Debug)]
239-
pub struct OpAddOns<N>
240-
where
241+
pub struct OpAddOns<
241242
N: FullNodeComponents,
242-
OpEthApiBuilder: EthApiBuilder<N>,
243-
{
243+
EthB: EthApiBuilder<N>,
244+
EV = OpEngineValidatorBuilder,
245+
EB = OpEngineApiBuilder<OpEngineValidatorBuilder>,
246+
> {
244247
/// Rpc add-ons responsible for launching the RPC servers and instantiating the RPC handlers
245248
/// and eth-api.
246-
pub rpc_add_ons: RpcAddOns<
247-
N,
248-
OpEthApiBuilder,
249-
OpEngineValidatorBuilder,
250-
OpEngineApiBuilder<OpEngineValidatorBuilder>,
251-
>,
249+
pub rpc_add_ons: RpcAddOns<N, EthB, EV, EB>,
252250
/// Data availability configuration for the OP builder.
253251
pub da_config: OpDAConfig,
254252
/// Sequencer client, configured to forward submitted transactions to sequencer of given OP
@@ -258,7 +256,7 @@ where
258256
enable_tx_conditional: bool,
259257
}
260258

261-
impl<N> Default for OpAddOns<N>
259+
impl<N> Default for OpAddOns<N, OpEthApiBuilder>
262260
where
263261
N: FullNodeComponents<Types: NodeTypes<Primitives = OpPrimitives>>,
264262
OpEthApiBuilder: EthApiBuilder<N>,
@@ -268,7 +266,7 @@ where
268266
}
269267
}
270268

271-
impl<N> OpAddOns<N>
269+
impl<N> OpAddOns<N, OpEthApiBuilder>
272270
where
273271
N: FullNodeComponents<Types: NodeTypes<Primitives = OpPrimitives>>,
274272
OpEthApiBuilder: EthApiBuilder<N>,
@@ -279,7 +277,7 @@ where
279277
}
280278
}
281279

282-
impl<N> NodeAddOns<N> for OpAddOns<N>
280+
impl<N> NodeAddOns<N> for OpAddOns<N, OpEthApiBuilder>
283281
where
284282
N: FullNodeComponents<
285283
Types: NodeTypes<
@@ -364,7 +362,7 @@ where
364362
}
365363
}
366364

367-
impl<N> RethRpcAddOns<N> for OpAddOns<N>
365+
impl<N> RethRpcAddOns<N> for OpAddOns<N, OpEthApiBuilder>
368366
where
369367
N: FullNodeComponents<
370368
Types: NodeTypes<
@@ -386,7 +384,7 @@ where
386384
}
387385
}
388386

389-
impl<N> EngineValidatorAddOn<N> for OpAddOns<N>
387+
impl<N> EngineValidatorAddOn<N> for OpAddOns<N, OpEthApiBuilder>
390388
where
391389
N: FullNodeComponents<
392390
Types: NodeTypes<
@@ -439,7 +437,7 @@ impl OpAddOnsBuilder {
439437

440438
impl OpAddOnsBuilder {
441439
/// Builds an instance of [`OpAddOns`].
442-
pub fn build<N>(self) -> OpAddOns<N>
440+
pub fn build<N>(self) -> OpAddOns<N, OpEthApiBuilder>
443441
where
444442
N: FullNodeComponents<Types: NodeTypes<Primitives = OpPrimitives>>,
445443
OpEthApiBuilder: EthApiBuilder<N>,
@@ -449,8 +447,8 @@ impl OpAddOnsBuilder {
449447
OpAddOns {
450448
rpc_add_ons: RpcAddOns::new(
451449
OpEthApiBuilder::default().with_sequencer(sequencer_url.clone()),
452-
Default::default(),
453-
Default::default(),
450+
OpEngineValidatorBuilder::default(),
451+
OpEngineApiBuilder::default(),
454452
),
455453
da_config: da_config.unwrap_or_default(),
456454
sequencer_url,

0 commit comments

Comments
 (0)