refactor: move executors to revm crate (#2076)

This commit is contained in:
Bjerg
2023-04-03 17:01:36 +02:00
committed by GitHub
parent 7da8323ac2
commit e4a428e29b
20 changed files with 67 additions and 52 deletions

View File

@@ -12,6 +12,7 @@ reth-primitives = { path = "../../crates/primitives", features = ["arbitrary"] }
reth-db = { path = "../../crates/storage/db", features = ["mdbx", "test-utils"] }
# TODO: Temporary use of the test-utils feature
reth-provider = { path = "../../crates/storage/provider", features = ["test-utils"] }
reth-revm = { path = "../../crates/revm" }
reth-revm-inspectors = { path = "../../crates/revm/revm-inspectors" }
reth-staged-sync = { path = "../../crates/staged-sync" }
reth-stages = { path = "../../crates/stages"}

View File

@@ -138,7 +138,7 @@ impl ImportCommand {
.into_task();
let (tip_tx, tip_rx) = watch::channel(H256::zero());
let factory = reth_executor::Factory::new(self.chain.clone());
let factory = reth_revm::Factory::new(self.chain.clone());
let mut pipeline = Pipeline::builder()
.with_tip_sender(tip_tx)

View File

@@ -99,7 +99,7 @@ async fn unwind_and_copy<DB: Database>(
let mut unwind_tx = Transaction::new(db_tool.db)?;
let mut exec_stage =
ExecutionStage::new_with_factory(reth_executor::Factory::new(Arc::new(MAINNET.clone())));
ExecutionStage::new_with_factory(reth_revm::Factory::new(Arc::new(MAINNET.clone())));
exec_stage
.unwind(
@@ -129,7 +129,7 @@ async fn dry_run(
let mut tx = Transaction::new(&output_db)?;
let mut exec_stage =
ExecutionStage::new_with_factory(reth_executor::Factory::new(Arc::new(MAINNET.clone())));
ExecutionStage::new_with_factory(reth_revm::Factory::new(Arc::new(MAINNET.clone())));
exec_stage
.execute(

View File

@@ -73,7 +73,7 @@ async fn unwind_and_copy<DB: Database>(
// Bring Plainstate to TO (hashing stage execution requires it)
let mut exec_stage =
ExecutionStage::new(reth_executor::Factory::new(Arc::new(MAINNET.clone())), u64::MAX);
ExecutionStage::new(reth_revm::Factory::new(Arc::new(MAINNET.clone())), u64::MAX);
exec_stage
.unwind(

View File

@@ -26,9 +26,8 @@ use reth_downloaders::{
bodies::bodies::BodiesDownloaderBuilder,
headers::reverse_headers::ReverseHeadersDownloaderBuilder,
};
use reth_executor::{
blockchain_tree::{externals::TreeExternals, BlockchainTree, ShareableBlockchainTree},
Factory,
use reth_executor::blockchain_tree::{
externals::TreeExternals, BlockchainTree, ShareableBlockchainTree,
};
use reth_interfaces::{
consensus::{Consensus, ForkchoiceState},
@@ -42,6 +41,7 @@ use reth_network::{error::NetworkError, NetworkConfig, NetworkHandle, NetworkMan
use reth_network_api::NetworkInfo;
use reth_primitives::{BlockHashOrNumber, ChainSpec, Head, Header, SealedHeader, H256};
use reth_provider::{BlockProvider, HeaderProvider, ShareableDatabase};
use reth_revm::Factory;
use reth_revm_inspectors::stack::Hook;
use reth_rpc_engine_api::{EngineApi, EngineApiHandle};
use reth_staged_sync::{
@@ -587,7 +587,7 @@ impl Command {
let (tip_tx, tip_rx) = watch::channel(H256::zero());
use reth_revm_inspectors::stack::InspectorStackConfig;
let factory = reth_executor::Factory::new(self.chain.clone());
let factory = reth_revm::Factory::new(self.chain.clone());
let stack_config = InspectorStackConfig {
use_printer_tracer: self.debug.print_inspector,

View File

@@ -163,7 +163,7 @@ impl Command {
stage.execute(&mut tx, input).await?;
}
StageEnum::Execution => {
let factory = reth_executor::Factory::new(self.chain.clone());
let factory = reth_revm::Factory::new(self.chain.clone());
let mut stage = ExecutionStage::new(factory, num_blocks);
if !self.skip_unwind {
stage.unwind(&mut tx, unwind).await?;

View File

@@ -194,7 +194,7 @@ pub async fn run_test(path: PathBuf) -> eyre::Result<TestOutcome> {
// Initialize the execution stage
// Hardcode the chain_id to Ethereum 1.
let factory = reth_executor::Factory::new(Arc::new(chain_spec));
let factory = reth_revm::Factory::new(Arc::new(chain_spec));
let mut stage = ExecutionStage::new(factory, 1_000);
// Call execution stage