Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 14 additions & 23 deletions crates/optimism/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ use crate::{
OpEngineApiBuilder, OpEngineTypes,
};
use op_alloy_consensus::{interop::SafetyLevel, OpPooledTransaction};
use op_alloy_rpc_types_engine::OpPayloadAttributes;
use op_alloy_rpc_types_engine::{OpExecutionData, OpPayloadAttributes};
use reth_chainspec::{ChainSpecProvider, EthChainSpec, Hardforks};
use reth_evm::{ConfigureEvm, EvmFactory, EvmFactoryFor};
use reth_network::{
types::BasicNetworkPrimitives, NetworkConfig, NetworkHandle, NetworkManager, NetworkPrimitives,
PeersInfo,
};
use reth_node_api::{
AddOnsContext, FullNodeComponents, KeyHasherTy, NodeAddOns, NodePrimitives, PayloadTypes,
PrimitivesTy, TxTy,
AddOnsContext, EngineTypes, FullNodeComponents, KeyHasherTy, NodeAddOns, NodePrimitives,
PayloadTypes, PrimitivesTy, TxTy,
};
use reth_node_builder::{
components::{
Expand Down Expand Up @@ -357,7 +357,7 @@ where
ChainSpec: OpHardforks,
Primitives = OpPrimitives,
Storage = OpStorage,
Payload = OpEngineTypes,
Payload: EngineTypes<ExecutionData = OpExecutionData>,
>,
Evm: ConfigureEvm<NextBlockEnvCtx = OpNextBlockEnvAttributes>,
>,
Expand Down Expand Up @@ -452,7 +452,7 @@ where
ChainSpec: OpHardforks,
Primitives = OpPrimitives,
Storage = OpStorage,
Payload = OpEngineTypes,
Payload: EngineTypes<ExecutionData = OpExecutionData>,
>,
Evm: ConfigureEvm<NextBlockEnvCtx = OpNextBlockEnvAttributes>,
>,
Expand All @@ -477,21 +477,17 @@ where
Types: NodeTypes<
ChainSpec: OpHardforks,
Primitives = OpPrimitives,
Payload = OpEngineTypes,
Payload: EngineTypes<ExecutionData = OpExecutionData>,
>,
>,
OpEthApiBuilder<NetworkT>: EthApiBuilder<N>,
EV: EngineValidatorBuilder<N>,
EV: EngineValidatorBuilder<N> + Default,
EB: EngineApiBuilder<N>,
{
type Validator = OpEngineValidator<
N::Provider,
<<N::Types as NodeTypes>::Primitives as NodePrimitives>::SignedTx,
<N::Types as NodeTypes>::ChainSpec,
>;
type Validator = <EV as EngineValidatorBuilder<N>>::Validator;

async fn engine_validator(&self, ctx: &AddOnsContext<'_, N>) -> eyre::Result<Self::Validator> {
OpEngineValidatorBuilder::default().build(ctx).await
EV::default().build(ctx).await
}
}

Expand Down Expand Up @@ -552,17 +548,12 @@ impl<NetworkT> OpAddOnsBuilder<NetworkT> {

impl<NetworkT> OpAddOnsBuilder<NetworkT> {
/// Builds an instance of [`OpAddOns`].
pub fn build<N>(
self,
) -> OpAddOns<
N,
OpEthApiBuilder<NetworkT>,
OpEngineValidatorBuilder,
OpEngineApiBuilder<OpEngineValidatorBuilder>,
>
pub fn build<N, EV, EB>(self) -> OpAddOns<N, OpEthApiBuilder<NetworkT>, EV, EB>
where
N: FullNodeComponents<Types: NodeTypes>,
OpEthApiBuilder<NetworkT>: EthApiBuilder<N>,
EV: Default,
EB: Default,
Comment on lines +555 to +556
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine, but this makes me think we could also move this to the OpAddOnsBuilder itself

{
let Self { sequencer_url, sequencer_headers, da_config, enable_tx_conditional, .. } = self;

Expand All @@ -571,8 +562,8 @@ impl<NetworkT> OpAddOnsBuilder<NetworkT> {
OpEthApiBuilder::default()
.with_sequencer(sequencer_url.clone())
.with_sequencer_headers(sequencer_headers.clone()),
OpEngineValidatorBuilder::default(),
OpEngineApiBuilder::default(),
EV::default(),
EB::default(),
),
da_config: da_config.unwrap_or_default(),
sequencer_url,
Expand Down
Loading