mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: trait-based storage API (#12616)
Co-authored-by: joshie <93316087+joshieDo@users.noreply.github.com>
This commit is contained in:
@ -32,6 +32,7 @@ reth-fs-util.workspace = true
|
||||
reth-network = { workspace = true, features = ["serde"] }
|
||||
reth-network-p2p.workspace = true
|
||||
reth-network-peers = { workspace = true, features = ["secp256k1"] }
|
||||
reth-node-api.workspace = true
|
||||
reth-node-builder.workspace = true
|
||||
reth-node-core.workspace = true
|
||||
reth-node-events.workspace = true
|
||||
|
||||
@ -10,12 +10,16 @@ use reth_db::{init_db, open_db_read_only, DatabaseEnv};
|
||||
use reth_db_common::init::init_genesis;
|
||||
use reth_downloaders::{bodies::noop::NoopBodiesDownloader, headers::noop::NoopHeaderDownloader};
|
||||
use reth_evm::noop::NoopBlockExecutorProvider;
|
||||
use reth_node_api::FullNodePrimitives;
|
||||
use reth_node_builder::{NodeTypesWithDBAdapter, NodeTypesWithEngine};
|
||||
use reth_node_core::{
|
||||
args::{DatabaseArgs, DatadirArgs},
|
||||
dirs::{ChainPath, DataDirPath},
|
||||
};
|
||||
use reth_provider::{providers::StaticFileProvider, ProviderFactory, StaticFileProviderFactory};
|
||||
use reth_provider::{
|
||||
providers::{NodeTypesForProvider, StaticFileProvider},
|
||||
ProviderFactory, StaticFileProviderFactory,
|
||||
};
|
||||
use reth_stages::{sets::DefaultStages, Pipeline, PipelineTarget};
|
||||
use reth_static_file::StaticFileProducer;
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
@ -191,5 +195,21 @@ impl AccessRights {
|
||||
|
||||
/// Helper trait with a common set of requirements for the
|
||||
/// [`NodeTypes`](reth_node_builder::NodeTypes) in CLI.
|
||||
pub trait CliNodeTypes: NodeTypesWithEngine<ChainSpec: EthereumHardforks> {}
|
||||
impl<N> CliNodeTypes for N where N: NodeTypesWithEngine<ChainSpec: EthereumHardforks> {}
|
||||
pub trait CliNodeTypes:
|
||||
NodeTypesWithEngine
|
||||
+ NodeTypesForProvider<
|
||||
Primitives: FullNodePrimitives<
|
||||
Block: reth_node_api::Block<Body = reth_primitives::BlockBody>,
|
||||
>,
|
||||
>
|
||||
{
|
||||
}
|
||||
impl<N> CliNodeTypes for N where
|
||||
N: NodeTypesWithEngine
|
||||
+ NodeTypesForProvider<
|
||||
Primitives: FullNodePrimitives<
|
||||
Block: reth_node_api::Block<Body = reth_primitives::BlockBody>,
|
||||
>,
|
||||
>
|
||||
{
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ pub fn build_import_pipeline<N, C, E>(
|
||||
executor: E,
|
||||
) -> eyre::Result<(Pipeline<N>, impl Stream<Item = NodeEvent>)>
|
||||
where
|
||||
N: ProviderNodeTypes,
|
||||
N: ProviderNodeTypes + CliNodeTypes,
|
||||
C: Consensus + 'static,
|
||||
E: BlockExecutorProvider,
|
||||
{
|
||||
|
||||
@ -113,7 +113,7 @@ impl<C: ChainSpecParser<ChainSpec: EthChainSpec + EthereumHardforks>> Command<C>
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn build_pipeline<N: ProviderNodeTypes<ChainSpec = C::ChainSpec>>(
|
||||
fn build_pipeline<N: ProviderNodeTypes<ChainSpec = C::ChainSpec> + CliNodeTypes>(
|
||||
self,
|
||||
config: Config,
|
||||
provider_factory: ProviderFactory<N>,
|
||||
|
||||
Reference in New Issue
Block a user