Skip to content

Commit

Permalink
pass snapshotter in test utils
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Jan 29, 2024
1 parent 3bb5bc0 commit 466a719
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions crates/consensus/beacon/src/engine/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ use reth_node_builder::EthEngineTypes;
use reth_payload_builder::test_utils::spawn_test_payload_service;
use reth_primitives::{BlockNumber, ChainSpec, PruneModes, Receipt, B256, U256};
use reth_provider::{
providers::BlockchainProvider, test_utils::TestExecutorFactory, BlockExecutor,
BundleStateWithReceipts, ExecutorFactory, HeaderSyncMode, ProviderFactory,
providers::BlockchainProvider,
test_utils::{create_test_provider_factory_with_chain_spec, TestExecutorFactory},
BlockExecutor, BundleStateWithReceipts, ExecutorFactory, HeaderSyncMode, ProviderFactory,
PrunableBlockExecutor,
};
use reth_prune::Pruner;
use reth_revm::EvmProcessorFactory;
use reth_rpc_types::engine::{
CancunPayloadFields, ExecutionPayload, ForkchoiceState, ForkchoiceUpdated, PayloadStatus,
};
use reth_snapshot::Snapshotter;
use reth_stages::{sets::DefaultStages, test_utils::TestStages, ExecOutput, Pipeline, StageError};
use reth_tasks::TokioTaskExecutor;
use std::{collections::VecDeque, sync::Arc};
Expand Down Expand Up @@ -445,9 +447,8 @@ where
/// Builds the test consensus engine into a `TestConsensusEngine` and `TestEnv`.
pub fn build(self) -> (TestBeaconConsensusEngine<Client>, TestEnv<Arc<DatabaseEnv>>) {
reth_tracing::init_test_tracing();
let db = create_test_rw_db();
let provider_factory =
ProviderFactory::new(db.clone(), self.base_config.chain_spec.clone());
create_test_provider_factory_with_chain_spec(self.base_config.chain_spec.clone());

let consensus: Arc<dyn Consensus> = match self.base_config.consensus {
TestConsensusConfig::Real => {
Expand Down Expand Up @@ -477,6 +478,13 @@ where
)),
};

let snapshotter = Snapshotter::new(
provider_factory,
provider_factory
.snapshot_provider()
.expect("snapshot provider initialized via provider factory"),
);

// Setup pipeline
let (tip_tx, tip_rx) = watch::channel(B256::default());
let mut pipeline = match self.base_config.pipeline_config {
Expand All @@ -500,6 +508,7 @@ where
header_downloader,
body_downloader,
executor_factory.clone(),
snapshotter,
)
.expect("should build"),
)
Expand Down

0 comments on commit 466a719

Please sign in to comment.