mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: NodeTypesWithDB (#10683)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use reth_node_api::FullNodeComponents;
|
||||
use reth_node_api::{FullNodeComponents, NodeTypesWithEngine};
|
||||
use reth_node_core::node_config::NodeConfig;
|
||||
use reth_primitives::Head;
|
||||
use reth_tasks::TaskExecutor;
|
||||
@ -76,7 +76,10 @@ impl<Node: FullNodeComponents> ExExContext<Node> {
|
||||
}
|
||||
|
||||
/// Returns the handle to the payload builder service.
|
||||
pub fn payload_builder(&self) -> &reth_payload_builder::PayloadBuilderHandle<Node::Engine> {
|
||||
pub fn payload_builder(
|
||||
&self,
|
||||
) -> &reth_payload_builder::PayloadBuilderHandle<<Node::Types as NodeTypesWithEngine>::Engine>
|
||||
{
|
||||
self.components.payload_builder()
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,9 @@ use reth_evm::test_utils::MockExecutorProvider;
|
||||
use reth_execution_types::Chain;
|
||||
use reth_exex::{ExExContext, ExExEvent, ExExNotification};
|
||||
use reth_network::{config::SecretKey, NetworkConfigBuilder, NetworkManager};
|
||||
use reth_node_api::{FullNodeTypes, FullNodeTypesAdapter, NodeTypes, NodeTypesWithEngine};
|
||||
use reth_node_api::{
|
||||
FullNodeTypes, FullNodeTypesAdapter, NodeTypes, NodeTypesWithDBAdapter, NodeTypesWithEngine,
|
||||
};
|
||||
use reth_node_builder::{
|
||||
components::{
|
||||
Components, ComponentsBuilder, ConsensusBuilder, ExecutorBuilder, NodeComponentsBuilder,
|
||||
@ -119,7 +121,7 @@ impl NodeTypesWithEngine for TestNode {
|
||||
|
||||
impl<N> Node<N> for TestNode
|
||||
where
|
||||
N: FullNodeTypes<Engine = EthEngineTypes, ChainSpec = ChainSpec>,
|
||||
N: FullNodeTypes<Types: NodeTypesWithEngine<Engine = EthEngineTypes, ChainSpec = ChainSpec>>,
|
||||
{
|
||||
type ComponentsBuilder = ComponentsBuilder<
|
||||
N,
|
||||
@ -148,9 +150,9 @@ pub type TmpDB = Arc<TempDatabase<DatabaseEnv>>;
|
||||
/// boot the testing environment
|
||||
pub type Adapter = NodeAdapter<
|
||||
RethFullAdapter<TmpDB, TestNode>,
|
||||
<<TestNode as Node<FullNodeTypesAdapter<TestNode, TmpDB, BlockchainProvider<TmpDB>>>>::ComponentsBuilder as NodeComponentsBuilder<
|
||||
RethFullAdapter<TmpDB, TestNode>,
|
||||
>>::Components,
|
||||
<<TestNode as Node<
|
||||
FullNodeTypesAdapter<NodeTypesWithDBAdapter<TestNode, TmpDB>, BlockchainProvider<TmpDB>>,
|
||||
>>::ComponentsBuilder as NodeComponentsBuilder<RethFullAdapter<TmpDB, TestNode>>>::Components,
|
||||
>;
|
||||
/// An [`ExExContext`] using the [`Adapter`] type.
|
||||
pub type TestExExContext = ExExContext<Adapter>;
|
||||
@ -251,7 +253,7 @@ pub async fn test_exex_context_with_chain_spec(
|
||||
let tasks = TaskManager::current();
|
||||
let task_executor = tasks.executor();
|
||||
|
||||
let components = NodeAdapter::<FullNodeTypesAdapter<TestNode, _, _>, _> {
|
||||
let components = NodeAdapter::<FullNodeTypesAdapter<NodeTypesWithDBAdapter<TestNode, _>, _>, _> {
|
||||
components: Components {
|
||||
transaction_pool,
|
||||
evm_config,
|
||||
|
||||
Reference in New Issue
Block a user