feat: relax provider bounds (#12857)

This commit is contained in:
Arsenii Kulikov
2024-11-26 20:26:36 +04:00
committed by GitHub
parent d51b347c81
commit 2ce741709f
37 changed files with 365 additions and 236 deletions

View File

@ -7,6 +7,7 @@ use reth_db_api::{
};
use reth_db_common::DbTool;
use reth_evm::{execute::BlockExecutorProvider, noop::NoopBlockExecutorProvider};
use reth_node_api::NodePrimitives;
use reth_node_builder::NodeTypesWithDB;
use reth_node_core::dirs::{ChainPath, DataDirPath};
use reth_provider::{
@ -25,7 +26,10 @@ pub(crate) async fn dump_execution_stage<N, E>(
executor: E,
) -> eyre::Result<()>
where
N: ProviderNodeTypes<DB = Arc<DatabaseEnv>>,
N: ProviderNodeTypes<
DB = Arc<DatabaseEnv>,
Primitives: NodePrimitives<Block = reth_primitives::Block>,
>,
E: BlockExecutorProvider,
{
let (output_db, tip_block_number) = setup(from, to, &output_datadir.db(), db_tool)?;
@ -131,7 +135,9 @@ fn import_tables_with_range<N: NodeTypesWithDB>(
/// Dry-run an unwind to FROM block, so we can get the `PlainStorageState` and
/// `PlainAccountState` safely. There might be some state dependency from an address
/// which hasn't been changed in the given range.
fn unwind_and_copy<N: ProviderNodeTypes>(
fn unwind_and_copy<
N: ProviderNodeTypes<Primitives: NodePrimitives<Block = reth_primitives::Block>>,
>(
db_tool: &DbTool<N>,
from: u64,
tip_block_number: u64,
@ -168,7 +174,7 @@ fn dry_run<N, E>(
executor: E,
) -> eyre::Result<()>
where
N: ProviderNodeTypes,
N: ProviderNodeTypes<Primitives: NodePrimitives<Block = reth_primitives::Block>>,
E: BlockExecutorProvider,
{
info!(target: "reth::cli", "Executing stage. [dry-run]");

View File

@ -9,6 +9,7 @@ use reth_db_api::{database::Database, table::TableImporter};
use reth_db_common::DbTool;
use reth_evm::noop::NoopBlockExecutorProvider;
use reth_exex::ExExManagerHandle;
use reth_node_api::NodePrimitives;
use reth_node_core::dirs::{ChainPath, DataDirPath};
use reth_provider::{
providers::{ProviderNodeTypes, StaticFileProvider},
@ -24,7 +25,12 @@ use reth_stages::{
};
use tracing::info;
pub(crate) async fn dump_merkle_stage<N: ProviderNodeTypes<DB = Arc<DatabaseEnv>>>(
pub(crate) async fn dump_merkle_stage<
N: ProviderNodeTypes<
DB = Arc<DatabaseEnv>,
Primitives: NodePrimitives<Block = reth_primitives::Block>,
>,
>(
db_tool: &DbTool<N>,
from: BlockNumber,
to: BlockNumber,
@ -67,7 +73,9 @@ pub(crate) async fn dump_merkle_stage<N: ProviderNodeTypes<DB = Arc<DatabaseEnv>
}
/// Dry-run an unwind to FROM block and copy the necessary table data to the new database.
fn unwind_and_copy<N: ProviderNodeTypes>(
fn unwind_and_copy<
N: ProviderNodeTypes<Primitives: NodePrimitives<Block = reth_primitives::Block>>,
>(
db_tool: &DbTool<N>,
range: (u64, u64),
tip_block_number: u64,