mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: make reth-stages independent of concrete DatabaseProvider (#10934)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -10,7 +10,7 @@ use reth_db_common::DbTool;
|
||||
use reth_evm::{execute::BlockExecutorProvider, noop::NoopBlockExecutorProvider};
|
||||
use reth_node_builder::{NodeTypesWithDB, NodeTypesWithDBAdapter};
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_provider::{providers::StaticFileProvider, ProviderFactory};
|
||||
use reth_provider::{providers::StaticFileProvider, DatabaseProviderFactory, ProviderFactory};
|
||||
use reth_stages::{stages::ExecutionStage, Stage, StageCheckpoint, UnwindInput};
|
||||
use tracing::info;
|
||||
|
||||
@ -135,7 +135,7 @@ fn unwind_and_copy<N: NodeTypesWithDB<ChainSpec = ChainSpec>>(
|
||||
tip_block_number: u64,
|
||||
output_db: &DatabaseEnv,
|
||||
) -> eyre::Result<()> {
|
||||
let provider = db_tool.provider_factory.provider_rw()?;
|
||||
let provider = db_tool.provider_factory.database_provider_rw()?;
|
||||
|
||||
let mut exec_stage = ExecutionStage::new_with_executor(NoopBlockExecutorProvider::default());
|
||||
|
||||
@ -175,7 +175,7 @@ where
|
||||
|
||||
let input =
|
||||
reth_stages::ExecInput { target: Some(to), checkpoint: Some(StageCheckpoint::new(from)) };
|
||||
exec_stage.execute(&output_provider_factory.provider_rw()?, input)?;
|
||||
exec_stage.execute(&output_provider_factory.database_provider_rw()?, input)?;
|
||||
|
||||
info!(target: "reth::cli", "Success");
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ use reth_db_api::{database::Database, table::TableImporter};
|
||||
use reth_db_common::DbTool;
|
||||
use reth_node_builder::{NodeTypesWithDB, NodeTypesWithDBAdapter};
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_provider::{providers::StaticFileProvider, ProviderFactory};
|
||||
use reth_provider::{providers::StaticFileProvider, DatabaseProviderFactory, ProviderFactory};
|
||||
use reth_stages::{stages::AccountHashingStage, Stage, StageCheckpoint, UnwindInput};
|
||||
use tracing::info;
|
||||
|
||||
@ -55,7 +55,7 @@ fn unwind_and_copy<N: NodeTypesWithDB<ChainSpec = ChainSpec>>(
|
||||
tip_block_number: u64,
|
||||
output_db: &DatabaseEnv,
|
||||
) -> eyre::Result<()> {
|
||||
let provider = db_tool.provider_factory.provider_rw()?;
|
||||
let provider = db_tool.provider_factory.database_provider_rw()?;
|
||||
let mut exec_stage = AccountHashingStage::default();
|
||||
|
||||
exec_stage.unwind(
|
||||
@ -81,7 +81,7 @@ fn dry_run<N: NodeTypesWithDB<ChainSpec = ChainSpec>>(
|
||||
) -> eyre::Result<()> {
|
||||
info!(target: "reth::cli", "Executing stage.");
|
||||
|
||||
let provider = output_provider_factory.provider_rw()?;
|
||||
let provider = output_provider_factory.database_provider_rw()?;
|
||||
let mut stage = AccountHashingStage {
|
||||
clean_threshold: 1, // Forces hashing from scratch
|
||||
..Default::default()
|
||||
|
||||
@ -8,7 +8,7 @@ use reth_db_api::{database::Database, table::TableImporter};
|
||||
use reth_db_common::DbTool;
|
||||
use reth_node_builder::{NodeTypesWithDB, NodeTypesWithDBAdapter};
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_provider::{providers::StaticFileProvider, ProviderFactory};
|
||||
use reth_provider::{providers::StaticFileProvider, DatabaseProviderFactory, ProviderFactory};
|
||||
use reth_stages::{stages::StorageHashingStage, Stage, StageCheckpoint, UnwindInput};
|
||||
use tracing::info;
|
||||
|
||||
@ -45,7 +45,7 @@ fn unwind_and_copy<N: NodeTypesWithDB<ChainSpec = ChainSpec>>(
|
||||
tip_block_number: u64,
|
||||
output_db: &DatabaseEnv,
|
||||
) -> eyre::Result<()> {
|
||||
let provider = db_tool.provider_factory.provider_rw()?;
|
||||
let provider = db_tool.provider_factory.database_provider_rw()?;
|
||||
|
||||
let mut exec_stage = StorageHashingStage::default();
|
||||
|
||||
@ -76,7 +76,7 @@ fn dry_run<N: NodeTypesWithDB<ChainSpec = ChainSpec>>(
|
||||
) -> eyre::Result<()> {
|
||||
info!(target: "reth::cli", "Executing stage.");
|
||||
|
||||
let provider = output_provider_factory.provider_rw()?;
|
||||
let provider = output_provider_factory.database_provider_rw()?;
|
||||
let mut stage = StorageHashingStage {
|
||||
clean_threshold: 1, // Forces hashing from scratch
|
||||
..Default::default()
|
||||
|
||||
@ -12,7 +12,7 @@ use reth_evm::noop::NoopBlockExecutorProvider;
|
||||
use reth_exex::ExExManagerHandle;
|
||||
use reth_node_builder::{NodeTypesWithDB, NodeTypesWithDBAdapter};
|
||||
use reth_node_core::dirs::{ChainPath, DataDirPath};
|
||||
use reth_provider::{providers::StaticFileProvider, ProviderFactory};
|
||||
use reth_provider::{providers::StaticFileProvider, DatabaseProviderFactory, ProviderFactory};
|
||||
use reth_prune::PruneModes;
|
||||
use reth_stages::{
|
||||
stages::{
|
||||
@ -73,7 +73,7 @@ fn unwind_and_copy<N: NodeTypesWithDB<ChainSpec = ChainSpec>>(
|
||||
output_db: &DatabaseEnv,
|
||||
) -> eyre::Result<()> {
|
||||
let (from, to) = range;
|
||||
let provider = db_tool.provider_factory.provider_rw()?;
|
||||
let provider = db_tool.provider_factory.database_provider_rw()?;
|
||||
|
||||
let unwind = UnwindInput {
|
||||
unwind_to: from,
|
||||
@ -150,7 +150,7 @@ fn dry_run<N: NodeTypesWithDB<ChainSpec = ChainSpec>>(
|
||||
from: u64,
|
||||
) -> eyre::Result<()> {
|
||||
info!(target: "reth::cli", "Executing stage.");
|
||||
let provider = output_provider_factory.provider_rw()?;
|
||||
let provider = output_provider_factory.database_provider_rw()?;
|
||||
|
||||
let mut stage = MerkleStage::Execution {
|
||||
// Forces updating the root instead of calculating from scratch
|
||||
|
||||
@ -34,8 +34,8 @@ use reth_node_metrics::{
|
||||
version::VersionInfo,
|
||||
};
|
||||
use reth_provider::{
|
||||
writer::UnifiedStorageWriter, ChainSpecProvider, StageCheckpointReader, StageCheckpointWriter,
|
||||
StaticFileProviderFactory,
|
||||
writer::UnifiedStorageWriter, ChainSpecProvider, DatabaseProviderFactory,
|
||||
StageCheckpointReader, StageCheckpointWriter, StaticFileProviderFactory,
|
||||
};
|
||||
use reth_stages::{
|
||||
stages::{
|
||||
@ -117,7 +117,7 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
|
||||
let Environment { provider_factory, config, data_dir } =
|
||||
self.env.init::<N>(AccessRights::RW)?;
|
||||
|
||||
let mut provider_rw = provider_factory.provider_rw()?;
|
||||
let mut provider_rw = provider_factory.database_provider_rw()?;
|
||||
|
||||
if let Some(listen_addr) = self.metrics {
|
||||
info!(target: "reth::cli", "Starting metrics endpoint at {}", listen_addr);
|
||||
@ -333,7 +333,7 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
|
||||
provider_rw,
|
||||
provider_factory.static_file_provider(),
|
||||
)?;
|
||||
provider_rw = provider_factory.provider_rw()?;
|
||||
provider_rw = provider_factory.database_provider_rw()?;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -356,7 +356,7 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
|
||||
}
|
||||
if self.commit {
|
||||
UnifiedStorageWriter::commit(provider_rw, provider_factory.static_file_provider())?;
|
||||
provider_rw = provider_factory.provider_rw()?;
|
||||
provider_rw = provider_factory.database_provider_rw()?;
|
||||
}
|
||||
|
||||
if done {
|
||||
|
||||
Reference in New Issue
Block a user