feat: integrate type specific engine validator in tree service (#12952)

This commit is contained in:
Matthias Seitz
2024-11-28 17:09:54 +01:00
committed by GitHub
parent 55b758ac10
commit cca6372e87
11 changed files with 72 additions and 63 deletions

View File

@ -16,12 +16,12 @@ reth-consensus.workspace = true
reth-engine-primitives.workspace = true
reth-engine-service.workspace = true
reth-engine-tree.workspace = true
reth-node-types.workspace = true
reth-evm.workspace = true
reth-ethereum-engine-primitives.workspace = true
reth-payload-builder.workspace = true
reth-payload-builder-primitives.workspace = true
reth-payload-primitives.workspace = true
reth-payload-validator.workspace = true
reth-provider.workspace = true
reth-prune.workspace = true
reth-rpc-types-compat.workspace = true

View File

@ -19,7 +19,7 @@ use futures_util::{Stream, StreamExt};
use reth_beacon_consensus::{BeaconConsensusEngineEvent, EngineNodeTypes};
use reth_chainspec::EthChainSpec;
use reth_consensus::Consensus;
use reth_engine_primitives::BeaconEngineMessage;
use reth_engine_primitives::{BeaconEngineMessage, EngineValidator};
use reth_engine_service::service::EngineMessageStream;
use reth_engine_tree::{
chain::{ChainEvent, HandlerEvent},
@ -31,9 +31,9 @@ use reth_engine_tree::{
tree::{EngineApiTreeHandler, InvalidBlockHook, TreeConfig},
};
use reth_evm::execute::BlockExecutorProvider;
use reth_node_types::BlockTy;
use reth_payload_builder::PayloadBuilderHandle;
use reth_payload_primitives::{PayloadAttributesBuilder, PayloadTypes};
use reth_payload_validator::ExecutionPayloadValidator;
use reth_provider::{providers::BlockchainProvider2, ChainSpecProvider, ProviderFactory};
use reth_prune::PrunerWithFactory;
use reth_stages_api::MetricEventsSender;
@ -63,13 +63,14 @@ where
{
/// Constructor for [`LocalEngineService`].
#[allow(clippy::too_many_arguments)]
pub fn new<B>(
pub fn new<B, V>(
consensus: Arc<dyn Consensus>,
executor_factory: impl BlockExecutorProvider,
provider: ProviderFactory<N>,
blockchain_db: BlockchainProvider2<N>,
pruner: PrunerWithFactory<ProviderFactory<N>>,
payload_builder: PayloadBuilderHandle<N::Engine>,
payload_validator: V,
tree_config: TreeConfig,
invalid_block_hook: Box<dyn InvalidBlockHook>,
sync_metrics_tx: MetricEventsSender,
@ -80,6 +81,7 @@ where
) -> Self
where
B: PayloadAttributesBuilder<<N::Engine as PayloadTypes>::PayloadAttributes>,
V: EngineValidator<N::Engine, Block = BlockTy<N>>,
{
let chain_spec = provider.chain_spec();
let engine_kind =
@ -87,8 +89,6 @@ where
let persistence_handle =
PersistenceHandle::spawn_service(provider, pruner, sync_metrics_tx);
let payload_validator = ExecutionPayloadValidator::new(chain_spec);
let canonical_in_memory_state = blockchain_db.canonical_in_memory_state();
let (to_tree_tx, from_tree) = EngineApiTreeHandler::<N::Primitives, _, _, _, _>::spawn_new(