mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(provider): use NodeTypes on DatabaseProvider instead (#12166)
This commit is contained in:
@ -2,12 +2,11 @@
|
||||
use criterion::{criterion_main, measurement::WallTime, BenchmarkGroup, Criterion};
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_config::config::{EtlConfig, TransactionLookupConfig};
|
||||
use reth_db::{test_utils::TempDatabase, Database, DatabaseEnv};
|
||||
|
||||
use alloy_primitives::BlockNumber;
|
||||
use reth_provider::{DatabaseProvider, DatabaseProviderFactory};
|
||||
use reth_provider::{test_utils::MockNodeTypesWithDB, DatabaseProvider, DatabaseProviderFactory};
|
||||
use reth_stages::{
|
||||
stages::{MerkleStage, SenderRecoveryStage, TransactionLookupStage},
|
||||
test_utils::TestStageDB,
|
||||
@ -148,7 +147,8 @@ fn measure_stage<F, S>(
|
||||
block_interval: RangeInclusive<BlockNumber>,
|
||||
label: String,
|
||||
) where
|
||||
S: Clone + Stage<DatabaseProvider<<TempDatabase<DatabaseEnv> as Database>::TXMut, ChainSpec>>,
|
||||
S: Clone
|
||||
+ Stage<DatabaseProvider<<TempDatabase<DatabaseEnv> as Database>::TXMut, MockNodeTypesWithDB>>,
|
||||
F: Fn(S, &TestStageDB, StageRange),
|
||||
{
|
||||
let stage_range = (
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
#![allow(unreachable_pub)]
|
||||
use alloy_primitives::{Address, Sealable, B256, U256};
|
||||
use itertools::concat;
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_db::{tables, test_utils::TempDatabase, Database, DatabaseEnv};
|
||||
use reth_db_api::{
|
||||
cursor::DbCursorRO,
|
||||
transaction::{DbTx, DbTxMut},
|
||||
};
|
||||
use reth_primitives::{Account, SealedBlock, SealedHeader};
|
||||
use reth_provider::{DatabaseProvider, DatabaseProviderFactory, TrieWriter};
|
||||
use reth_provider::{
|
||||
test_utils::MockNodeTypesWithDB, DatabaseProvider, DatabaseProviderFactory, TrieWriter,
|
||||
};
|
||||
use reth_stages::{
|
||||
stages::{AccountHashingStage, StorageHashingStage},
|
||||
test_utils::{StorageKind, TestStageDB},
|
||||
@ -31,7 +32,8 @@ use reth_trie_db::DatabaseStateRoot;
|
||||
pub(crate) type StageRange = (ExecInput, UnwindInput);
|
||||
|
||||
pub(crate) fn stage_unwind<
|
||||
S: Clone + Stage<DatabaseProvider<<TempDatabase<DatabaseEnv> as Database>::TXMut, ChainSpec>>,
|
||||
S: Clone
|
||||
+ Stage<DatabaseProvider<<TempDatabase<DatabaseEnv> as Database>::TXMut, MockNodeTypesWithDB>>,
|
||||
>(
|
||||
stage: S,
|
||||
db: &TestStageDB,
|
||||
@ -63,7 +65,8 @@ pub(crate) fn stage_unwind<
|
||||
|
||||
pub(crate) fn unwind_hashes<S>(stage: S, db: &TestStageDB, range: StageRange)
|
||||
where
|
||||
S: Clone + Stage<DatabaseProvider<<TempDatabase<DatabaseEnv> as Database>::TXMut, ChainSpec>>,
|
||||
S: Clone
|
||||
+ Stage<DatabaseProvider<<TempDatabase<DatabaseEnv> as Database>::TXMut, MockNodeTypesWithDB>>,
|
||||
{
|
||||
let (input, unwind) = range;
|
||||
|
||||
|
||||
@ -58,11 +58,8 @@ impl AccountHashingStage {
|
||||
///
|
||||
/// Proceeds to go to the `BlockTransitionIndex` end, go back `transitions` and change the
|
||||
/// account state in the `AccountChangeSets` table.
|
||||
pub fn seed<
|
||||
Tx: DbTx + DbTxMut + 'static,
|
||||
Spec: Send + Sync + 'static + reth_chainspec::EthereumHardforks,
|
||||
>(
|
||||
provider: &reth_provider::DatabaseProvider<Tx, Spec>,
|
||||
pub fn seed<Tx: DbTx + DbTxMut + 'static, N: reth_provider::providers::ProviderNodeTypes>(
|
||||
provider: &reth_provider::DatabaseProvider<Tx, N>,
|
||||
opts: SeedOpts,
|
||||
) -> Result<Vec<(alloy_primitives::Address, reth_primitives::Account)>, StageError> {
|
||||
use alloy_primitives::U256;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
use super::TestStageDB;
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_db::{test_utils::TempDatabase, Database, DatabaseEnv};
|
||||
use reth_provider::{DatabaseProvider, ProviderError};
|
||||
use reth_provider::{test_utils::MockNodeTypesWithDB, DatabaseProvider, ProviderError};
|
||||
use reth_stages_api::{
|
||||
ExecInput, ExecOutput, Stage, StageError, StageExt, UnwindInput, UnwindOutput,
|
||||
};
|
||||
@ -20,7 +19,7 @@ pub(crate) enum TestRunnerError {
|
||||
|
||||
/// A generic test runner for stages.
|
||||
pub(crate) trait StageTestRunner {
|
||||
type S: Stage<DatabaseProvider<<TempDatabase<DatabaseEnv> as Database>::TXMut, ChainSpec>>
|
||||
type S: Stage<DatabaseProvider<<TempDatabase<DatabaseEnv> as Database>::TXMut, MockNodeTypesWithDB>>
|
||||
+ 'static;
|
||||
|
||||
/// Return a reference to the database.
|
||||
|
||||
Reference in New Issue
Block a user