feat: consensus trait generic over NodePrimitives (#13026)

This commit is contained in:
Arsenii Kulikov
2024-11-30 02:26:36 +04:00
committed by GitHub
parent 55ddaab1e4
commit 5d71150355
26 changed files with 166 additions and 113 deletions

View File

@ -11,7 +11,7 @@ use reth_blockchain_tree_api::{
error::{BlockchainTreeError, InsertBlockErrorKind},
BlockAttachment, BlockValidationKind,
};
use reth_consensus::{Consensus, ConsensusError, PostExecutionInput};
use reth_consensus::{ConsensusError, PostExecutionInput};
use reth_evm::execute::{BlockExecutorProvider, Executor};
use reth_execution_errors::BlockExecutionError;
use reth_execution_types::{Chain, ExecutionOutcome};

View File

@ -1,7 +1,7 @@
//! Blockchain tree externals.
use alloy_primitives::{BlockHash, BlockNumber};
use reth_consensus::Consensus;
use reth_consensus::FullConsensus;
use reth_db::{static_file::BlockHashMask, tables};
use reth_db_api::{cursor::DbCursorRO, transaction::DbTx};
use reth_node_types::NodeTypesWithDB;
@ -28,7 +28,7 @@ pub struct TreeExternals<N: NodeTypesWithDB, E> {
/// The provider factory, used to commit the canonical chain, or unwind it.
pub(crate) provider_factory: ProviderFactory<N>,
/// The consensus engine.
pub(crate) consensus: Arc<dyn Consensus>,
pub(crate) consensus: Arc<dyn FullConsensus>,
/// The executor factory to execute blocks with.
pub(crate) executor_factory: E,
}
@ -37,7 +37,7 @@ impl<N: ProviderNodeTypes, E> TreeExternals<N, E> {
/// Create new tree externals.
pub fn new(
provider_factory: ProviderFactory<N>,
consensus: Arc<dyn Consensus>,
consensus: Arc<dyn FullConsensus>,
executor_factory: E,
) -> Self {
Self { provider_factory, consensus, executor_factory }