feat: ChainSpec associated type (#10292)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Arsenii Kulikov
2024-08-22 20:30:09 +08:00
committed by GitHub
parent a4c30ead7e
commit f2e0bc073a
52 changed files with 254 additions and 116 deletions

View File

@ -14,7 +14,7 @@ use reth_chainspec::ChainSpec;
use reth_db::{test_utils::TempDatabase, DatabaseEnv};
use reth_node_builder::{
components::NodeComponentsBuilder, rpc::EthApiBuilderProvider, FullNodeTypesAdapter, Node,
NodeAdapter, NodeAddOns, NodeComponents, RethFullAdapter,
NodeAdapter, NodeAddOns, NodeComponents, NodeTypes, RethFullAdapter,
};
use reth_provider::providers::BlockchainProvider;
use tracing::{span, Level};
@ -50,7 +50,7 @@ pub async fn setup<N>(
is_dev: bool,
) -> eyre::Result<(Vec<NodeHelperType<N, N::AddOns>>, TaskManager, Wallet)>
where
N: Default + Node<TmpNodeAdapter<N>>,
N: Default + Node<TmpNodeAdapter<N>> + NodeTypes<ChainSpec = ChainSpec>,
<<N::ComponentsBuilder as NodeComponentsBuilder<TmpNodeAdapter<N>>>::Components as NodeComponents<TmpNodeAdapter<N>>>::Network: PeersHandleProvider,
<N::AddOns as NodeAddOns<Adapter<N>>>::EthApi:
FullEthApiServer + AddDevSigners + EthApiBuilderProvider<Adapter<N>>,

View File

@ -14,6 +14,7 @@ use reth::{
types::engine::PayloadStatusEnum,
},
};
use reth_chainspec::ChainSpec;
use reth_node_builder::{NodeAddOns, NodeTypes};
use reth_primitives::{BlockHash, BlockNumber, Bytes, B256};
use reth_stages_types::StageId;
@ -45,7 +46,7 @@ where
impl<Node, AddOns> NodeTestContext<Node, AddOns>
where
Node: FullNodeComponents,
Node: FullNodeComponents<ChainSpec = ChainSpec>,
Node::Network: PeersHandleProvider,
AddOns: NodeAddOns<Node>,
{

View File

@ -7,6 +7,7 @@ use reth::{
DebugApiServer,
},
};
use reth_chainspec::ChainSpec;
use reth_primitives::{Bytes, B256};
#[allow(missing_debug_implementations)]
@ -14,7 +15,7 @@ pub struct RpcTestContext<Node: FullNodeComponents, EthApi> {
pub inner: RpcRegistry<Node, EthApi>,
}
impl<Node: FullNodeComponents, EthApi> RpcTestContext<Node, EthApi>
impl<Node: FullNodeComponents<ChainSpec = ChainSpec>, EthApi> RpcTestContext<Node, EthApi>
where
EthApi: EthApiSpec + EthTransactions + TraceExt,
{