Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

fix parlia builder #185

Merged
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions crates/node/builder/src/components/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ use reth_transaction_pool::TransactionPool;
use crate::{
components::{
Components, ConsensusBuilder, ExecutorBuilder, NetworkBuilder, NodeComponents,
PayloadServiceBuilder, PoolBuilder,
PayloadServiceBuilder, PoolBuilder, ParliaBuilder,
},
BuilderContext, ConfigureEvm, FullNodeTypes,
};

use super::ParliaBuilder;

/// A generic, general purpose and customizable [`NodeComponentsBuilder`] implementation.
///
/// This type is stateful and captures the configuration of the node's components.
Expand Down
1 change: 1 addition & 0 deletions crates/node/builder/src/components/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ where
self(ctx)
}
}

2 changes: 2 additions & 0 deletions crates/node/builder/src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ mod execute;
mod network;
mod payload;
mod pool;
mod parlia;

pub use builder::*;
pub use consensus::*;
pub use execute::*;
pub use network::*;
pub use payload::*;
pub use pool::*;
pub use parlia::*;
#[cfg(feature = "bsc")]
use reth_bsc_consensus::Parlia;
use reth_consensus::Consensus;
Expand Down
26 changes: 26 additions & 0 deletions crates/node/builder/src/components/parlia.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//! Parlia component for the node builder.
use crate::{BuilderContext, FullNodeTypes};
use std::future::Future;

/// Needed for bsc parlia consensus.
pub trait ParliaBuilder<Node: FullNodeTypes>: Send {
/// Creates the parlia.
fn build_parlia(
self,
ctx: &BuilderContext<Node>,
) -> impl Future<Output = eyre::Result<Parlia>> + Send;
}

impl<Node, F, Fut> ParliaBuilder<Node> for F
where
Node: FullNodeTypes,
F: FnOnce(&BuilderContext<Node>) -> Fut + Send,
Fut: Future<Output = eyre::Result<Parlia>> + Send,
{
fn build_parlia(
self,
ctx: &BuilderContext<Node>,
) -> impl Future<Output = eyre::Result<Parlia>> {
self(ctx)
}
}
Loading