mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(execution): rename EVMProcessor factory (#5533)
This commit is contained in:
@ -152,7 +152,7 @@ impl ImportCommand {
|
||||
.into_task();
|
||||
|
||||
let (tip_tx, tip_rx) = watch::channel(B256::ZERO);
|
||||
let factory = reth_revm::Factory::new(self.chain.clone());
|
||||
let factory = reth_revm::EvmProcessorFactory::new(self.chain.clone());
|
||||
|
||||
let max_block = file_client.max_block().unwrap_or(0);
|
||||
let mut pipeline = Pipeline::builder()
|
||||
|
||||
@ -32,7 +32,7 @@ use reth_provider::{
|
||||
providers::BlockchainProvider, BlockHashReader, BlockReader, BlockWriter, ExecutorFactory,
|
||||
ProviderFactory, StageCheckpointReader, StateProviderFactory,
|
||||
};
|
||||
use reth_revm::Factory;
|
||||
use reth_revm::EvmProcessorFactory;
|
||||
use reth_rpc_types::engine::{BlobsBundleV1, PayloadAttributes};
|
||||
use reth_transaction_pool::{
|
||||
blobstore::InMemoryBlobStore, BlobStore, EthPooledTransaction, PoolConfig, TransactionOrigin,
|
||||
@ -150,7 +150,7 @@ impl Command {
|
||||
let tree_externals = TreeExternals::new(
|
||||
provider_factory.clone(),
|
||||
Arc::clone(&consensus),
|
||||
Factory::new(self.chain.clone()),
|
||||
EvmProcessorFactory::new(self.chain.clone()),
|
||||
);
|
||||
let tree = BlockchainTree::new(tree_externals, BlockchainTreeConfig::default(), None)?;
|
||||
let blockchain_tree = ShareableBlockchainTree::new(tree);
|
||||
@ -267,7 +267,7 @@ impl Command {
|
||||
let block_with_senders =
|
||||
SealedBlockWithSenders::new(block.clone(), senders).unwrap();
|
||||
|
||||
let executor_factory = Factory::new(self.chain.clone());
|
||||
let executor_factory = EvmProcessorFactory::new(self.chain.clone());
|
||||
let mut executor = executor_factory.with_state(blockchain_db.latest()?);
|
||||
executor.execute_and_verify_receipt(
|
||||
&block_with_senders.block.clone().unseal(),
|
||||
|
||||
@ -108,7 +108,7 @@ impl Command {
|
||||
let stage_conf = &config.stages;
|
||||
|
||||
let (tip_tx, tip_rx) = watch::channel(B256::ZERO);
|
||||
let factory = reth_revm::Factory::new(self.chain.clone());
|
||||
let factory = reth_revm::EvmProcessorFactory::new(self.chain.clone());
|
||||
|
||||
let header_mode = HeaderSyncMode::Tip(tip_rx);
|
||||
let pipeline = Pipeline::builder()
|
||||
|
||||
@ -159,7 +159,7 @@ impl Command {
|
||||
)
|
||||
.await?;
|
||||
|
||||
let executor_factory = reth_revm::Factory::new(self.chain.clone());
|
||||
let executor_factory = reth_revm::EvmProcessorFactory::new(self.chain.clone());
|
||||
let mut executor =
|
||||
executor_factory.with_state(LatestStateProviderRef::new(provider.tx_ref()));
|
||||
|
||||
|
||||
@ -197,7 +197,7 @@ impl Command {
|
||||
checkpoint.stage_checkpoint.is_some()
|
||||
});
|
||||
|
||||
let factory = reth_revm::Factory::new(self.chain.clone());
|
||||
let factory = reth_revm::EvmProcessorFactory::new(self.chain.clone());
|
||||
let mut execution_stage = ExecutionStage::new(
|
||||
factory,
|
||||
ExecutionStageThresholds {
|
||||
|
||||
@ -64,7 +64,7 @@ use reth_provider::{
|
||||
HeaderProvider, HeaderSyncMode, ProviderFactory, StageCheckpointReader,
|
||||
};
|
||||
use reth_prune::{segments::SegmentSet, Pruner};
|
||||
use reth_revm::Factory;
|
||||
use reth_revm::EvmProcessorFactory;
|
||||
use reth_revm_inspectors::stack::Hook;
|
||||
use reth_rpc_engine_api::EngineApi;
|
||||
use reth_snapshot::HighestSnapshotsTracker;
|
||||
@ -295,7 +295,7 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
|
||||
let tree_externals = TreeExternals::new(
|
||||
provider_factory.clone(),
|
||||
Arc::clone(&consensus),
|
||||
Factory::new(self.chain.clone()),
|
||||
EvmProcessorFactory::new(self.chain.clone()),
|
||||
);
|
||||
let tree = BlockchainTree::new(
|
||||
tree_externals,
|
||||
@ -873,7 +873,7 @@ impl<Ext: RethCliExt> NodeCommand<Ext> {
|
||||
|
||||
let (tip_tx, tip_rx) = watch::channel(B256::ZERO);
|
||||
use reth_revm_inspectors::stack::InspectorStackConfig;
|
||||
let factory = reth_revm::Factory::new(self.chain.clone());
|
||||
let factory = reth_revm::EvmProcessorFactory::new(self.chain.clone());
|
||||
|
||||
let stack_config = InspectorStackConfig {
|
||||
use_printer_tracer: self.debug.print_inspector,
|
||||
|
||||
@ -7,7 +7,7 @@ use reth_db::{
|
||||
};
|
||||
use reth_primitives::{stage::StageCheckpoint, ChainSpec};
|
||||
use reth_provider::ProviderFactory;
|
||||
use reth_revm::Factory;
|
||||
use reth_revm::EvmProcessorFactory;
|
||||
use reth_stages::{stages::ExecutionStage, Stage, UnwindInput};
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
use tracing::info;
|
||||
@ -98,7 +98,8 @@ async fn unwind_and_copy<DB: Database>(
|
||||
let factory = ProviderFactory::new(db_tool.db, db_tool.chain.clone());
|
||||
let provider = factory.provider_rw()?;
|
||||
|
||||
let mut exec_stage = ExecutionStage::new_with_factory(Factory::new(db_tool.chain.clone()));
|
||||
let mut exec_stage =
|
||||
ExecutionStage::new_with_factory(EvmProcessorFactory::new(db_tool.chain.clone()));
|
||||
|
||||
exec_stage.unwind(
|
||||
&provider,
|
||||
@ -129,7 +130,7 @@ async fn dry_run<DB: Database>(
|
||||
info!(target: "reth::cli", "Executing stage. [dry-run]");
|
||||
|
||||
let factory = ProviderFactory::new(&output_db, chain.clone());
|
||||
let mut exec_stage = ExecutionStage::new_with_factory(Factory::new(chain.clone()));
|
||||
let mut exec_stage = ExecutionStage::new_with_factory(EvmProcessorFactory::new(chain.clone()));
|
||||
|
||||
let input =
|
||||
reth_stages::ExecInput { target: Some(to), checkpoint: Some(StageCheckpoint::new(from)) };
|
||||
|
||||
@ -68,7 +68,7 @@ async fn unwind_and_copy<DB: Database>(
|
||||
|
||||
// Bring Plainstate to TO (hashing stage execution requires it)
|
||||
let mut exec_stage = ExecutionStage::new(
|
||||
reth_revm::Factory::new(db_tool.chain.clone()),
|
||||
reth_revm::EvmProcessorFactory::new(db_tool.chain.clone()),
|
||||
ExecutionStageThresholds {
|
||||
max_blocks: Some(u64::MAX),
|
||||
max_changes: None,
|
||||
|
||||
@ -195,7 +195,7 @@ impl Command {
|
||||
}
|
||||
StageEnum::Senders => (Box::new(SenderRecoveryStage::new(batch_size)), None),
|
||||
StageEnum::Execution => {
|
||||
let factory = reth_revm::Factory::new(self.chain.clone());
|
||||
let factory = reth_revm::EvmProcessorFactory::new(self.chain.clone());
|
||||
(
|
||||
Box::new(ExecutionStage::new(
|
||||
factory,
|
||||
|
||||
@ -30,7 +30,7 @@ use reth_provider::{
|
||||
PrunableBlockExecutor,
|
||||
};
|
||||
use reth_prune::Pruner;
|
||||
use reth_revm::Factory;
|
||||
use reth_revm::EvmProcessorFactory;
|
||||
use reth_rpc_types::engine::{
|
||||
CancunPayloadFields, ExecutionPayload, ForkchoiceState, ForkchoiceUpdated, PayloadStatus,
|
||||
};
|
||||
@ -45,7 +45,7 @@ type TestBeaconConsensusEngine<Client> = BeaconConsensusEngine<
|
||||
Arc<DatabaseEnv>,
|
||||
ShareableBlockchainTree<
|
||||
Arc<DatabaseEnv>,
|
||||
EitherExecutorFactory<TestExecutorFactory, Factory>,
|
||||
EitherExecutorFactory<TestExecutorFactory, EvmProcessorFactory>,
|
||||
>,
|
||||
>,
|
||||
Arc<EitherDownloader<Client, NoopFullBlockClient>>,
|
||||
@ -481,9 +481,9 @@ where
|
||||
executor_factory.extend(results);
|
||||
EitherExecutorFactory::Left(executor_factory)
|
||||
}
|
||||
TestExecutorConfig::Real => {
|
||||
EitherExecutorFactory::Right(Factory::new(self.base_config.chain_spec.clone()))
|
||||
}
|
||||
TestExecutorConfig::Real => EitherExecutorFactory::Right(EvmProcessorFactory::new(
|
||||
self.base_config.chain_spec.clone(),
|
||||
)),
|
||||
};
|
||||
|
||||
// Setup pipeline
|
||||
|
||||
@ -7,14 +7,14 @@ use reth_primitives::ChainSpec;
|
||||
use reth_provider::{ExecutorFactory, PrunableBlockExecutor, StateProvider};
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Factory that spawn Executor.
|
||||
/// Factory for creating [EVMProcessor].
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Factory {
|
||||
pub struct EvmProcessorFactory {
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
stack: Option<InspectorStack>,
|
||||
}
|
||||
|
||||
impl Factory {
|
||||
impl EvmProcessorFactory {
|
||||
/// Create new factory
|
||||
pub fn new(chain_spec: Arc<ChainSpec>) -> Self {
|
||||
Self { chain_spec, stack: None }
|
||||
@ -33,7 +33,7 @@ impl Factory {
|
||||
}
|
||||
}
|
||||
|
||||
impl ExecutorFactory for Factory {
|
||||
impl ExecutorFactory for EvmProcessorFactory {
|
||||
fn with_state<'a, SP: StateProvider + 'a>(
|
||||
&'a self,
|
||||
sp: SP,
|
||||
|
||||
@ -22,7 +22,7 @@ pub mod processor;
|
||||
pub mod state_change;
|
||||
|
||||
/// revm executor factory.
|
||||
pub use factory::Factory;
|
||||
pub use factory::EvmProcessorFactory;
|
||||
|
||||
/// reexport for convenience
|
||||
pub use reth_revm_inspectors::*;
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
//! # use reth_downloaders::headers::reverse_headers::ReverseHeadersDownloaderBuilder;
|
||||
//! # use reth_interfaces::consensus::Consensus;
|
||||
//! # use reth_interfaces::test_utils::{TestBodiesClient, TestConsensus, TestHeadersClient};
|
||||
//! # use reth_revm::Factory;
|
||||
//! # use reth_revm::EvmProcessorFactory;
|
||||
//! # use reth_primitives::{PeerId, MAINNET, B256};
|
||||
//! # use reth_stages::Pipeline;
|
||||
//! # use reth_stages::sets::DefaultStages;
|
||||
@ -39,7 +39,7 @@
|
||||
//! # provider_factory.clone()
|
||||
//! # );
|
||||
//! # let (tip_tx, tip_rx) = watch::channel(B256::default());
|
||||
//! # let factory = Factory::new(chain_spec.clone());
|
||||
//! # let executor_factory = EvmProcessorFactory::new(chain_spec.clone());
|
||||
//! // Create a pipeline that can fully sync
|
||||
//! # let pipeline =
|
||||
//! Pipeline::builder()
|
||||
@ -50,7 +50,7 @@
|
||||
//! consensus,
|
||||
//! headers_downloader,
|
||||
//! bodies_downloader,
|
||||
//! factory,
|
||||
//! executor_factory,
|
||||
//! ))
|
||||
//! .build(provider_factory);
|
||||
//! ```
|
||||
|
||||
@ -12,26 +12,26 @@
|
||||
//! ```no_run
|
||||
//! # use reth_stages::Pipeline;
|
||||
//! # use reth_stages::sets::{OfflineStages};
|
||||
//! # use reth_revm::Factory;
|
||||
//! # use reth_revm::EvmProcessorFactory;
|
||||
//! # use reth_primitives::MAINNET;
|
||||
//! # use reth_provider::test_utils::create_test_provider_factory;
|
||||
//!
|
||||
//! # let factory = Factory::new(MAINNET.clone());
|
||||
//! # let executor_factory = EvmProcessorFactory::new(MAINNET.clone());
|
||||
//! # let provider_factory = create_test_provider_factory();
|
||||
//! // Build a pipeline with all offline stages.
|
||||
//! # let pipeline = Pipeline::builder().add_stages(OfflineStages::new(factory)).build(provider_factory);
|
||||
//! # let pipeline = Pipeline::builder().add_stages(OfflineStages::new(executor_factory)).build(provider_factory);
|
||||
//! ```
|
||||
//!
|
||||
//! ```ignore
|
||||
//! # use reth_stages::Pipeline;
|
||||
//! # use reth_stages::{StageSet, sets::OfflineStages};
|
||||
//! # use reth_revm::Factory;
|
||||
//! # use reth_revm::EvmProcessorFactory;
|
||||
//! # use reth_primitives::MAINNET;
|
||||
//! // Build a pipeline with all offline stages and a custom stage at the end.
|
||||
//! # let factory = Factory::new(MAINNET.clone());
|
||||
//! # let executor_factory = EvmProcessorFactory::new(MAINNET.clone());
|
||||
//! Pipeline::builder()
|
||||
//! .add_stages(
|
||||
//! OfflineStages::new(factory).builder().add_stage(MyCustomStage)
|
||||
//! OfflineStages::new(executor_factory).builder().add_stage(MyCustomStage)
|
||||
//! )
|
||||
//! .build();
|
||||
//! ```
|
||||
|
||||
@ -500,14 +500,15 @@ mod tests {
|
||||
ChainSpecBuilder, PruneModes, SealedBlock, StorageEntry, B256, MAINNET, U256,
|
||||
};
|
||||
use reth_provider::{AccountReader, BlockWriter, ProviderFactory, ReceiptProvider};
|
||||
use reth_revm::Factory;
|
||||
use reth_revm::EvmProcessorFactory;
|
||||
use std::sync::Arc;
|
||||
|
||||
fn stage() -> ExecutionStage<Factory> {
|
||||
let factory =
|
||||
Factory::new(Arc::new(ChainSpecBuilder::mainnet().berlin_activated().build()));
|
||||
fn stage() -> ExecutionStage<EvmProcessorFactory> {
|
||||
let executor_factory = EvmProcessorFactory::new(Arc::new(
|
||||
ChainSpecBuilder::mainnet().berlin_activated().build(),
|
||||
));
|
||||
ExecutionStage::new(
|
||||
factory,
|
||||
executor_factory,
|
||||
ExecutionStageThresholds {
|
||||
max_blocks: Some(100),
|
||||
max_changes: None,
|
||||
@ -684,7 +685,7 @@ mod tests {
|
||||
provider.commit().unwrap();
|
||||
|
||||
let provider = factory.provider_rw().unwrap();
|
||||
let mut execution_stage: ExecutionStage<Factory> = stage();
|
||||
let mut execution_stage: ExecutionStage<EvmProcessorFactory> = stage();
|
||||
let output = execution_stage.execute(&provider, input).unwrap();
|
||||
provider.commit().unwrap();
|
||||
assert_matches!(output, ExecOutput {
|
||||
|
||||
@ -62,7 +62,7 @@ mod tests {
|
||||
use reth_provider::{
|
||||
AccountExtReader, BlockWriter, ProviderFactory, ReceiptProvider, StorageReader,
|
||||
};
|
||||
use reth_revm::Factory;
|
||||
use reth_revm::EvmProcessorFactory;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::test]
|
||||
@ -128,7 +128,9 @@ mod tests {
|
||||
// Check execution and create receipts and changesets according to the pruning
|
||||
// configuration
|
||||
let mut execution_stage = ExecutionStage::new(
|
||||
Factory::new(Arc::new(ChainSpecBuilder::mainnet().berlin_activated().build())),
|
||||
EvmProcessorFactory::new(Arc::new(
|
||||
ChainSpecBuilder::mainnet().berlin_activated().build(),
|
||||
)),
|
||||
ExecutionStageThresholds {
|
||||
max_blocks: Some(100),
|
||||
max_changes: None,
|
||||
|
||||
@ -101,9 +101,9 @@ impl Case for BlockchainTestCase {
|
||||
|
||||
// Call execution stage
|
||||
{
|
||||
let mut stage = ExecutionStage::new_with_factory(reth_revm::Factory::new(
|
||||
Arc::new(case.network.clone().into()),
|
||||
));
|
||||
let mut stage = ExecutionStage::new_with_factory(
|
||||
reth_revm::EvmProcessorFactory::new(Arc::new(case.network.clone().into())),
|
||||
);
|
||||
|
||||
let target = last_block.as_ref().map(|b| b.number);
|
||||
tokio::runtime::Builder::new_current_thread()
|
||||
|
||||
Reference in New Issue
Block a user