feat: relax bounds for EthPubSub (#13203)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Arsenii Kulikov
2024-12-07 09:30:56 +04:00
committed by GitHub
parent 4d2c5767ec
commit 6b35b05993
8 changed files with 74 additions and 139 deletions

View File

@ -61,7 +61,8 @@ pub trait FullNodeComponents: FullNodeTypes + Clone + 'static {
type Network: FullNetwork;
/// Builds new blocks.
type PayloadBuilder: PayloadBuilder + Clone;
type PayloadBuilder: PayloadBuilder<PayloadType = <Self::Types as NodeTypesWithEngine>::Engine>
+ Clone;
/// Returns the transaction pool of the node.
fn pool(&self) -> &Self::Pool;

View File

@ -13,9 +13,7 @@ use crate::{
AddOns, FullNode,
};
use reth_exex::ExExContext;
use reth_node_api::{
FullNodeComponents, FullNodeTypes, NodeAddOns, NodeTypes, NodeTypesWithDB, PayloadBuilder,
};
use reth_node_api::{FullNodeComponents, FullNodeTypes, NodeAddOns, NodeTypes, NodeTypesWithDB};
use reth_node_core::node_config::NodeConfig;
use reth_tasks::TaskExecutor;
use std::{fmt, future::Future};
@ -88,10 +86,7 @@ impl<T: FullNodeTypes, C: NodeComponents<T>> FullNodeTypes for NodeAdapter<T, C>
type Provider = T::Provider;
}
impl<T: FullNodeTypes, C: NodeComponents<T>> FullNodeComponents for NodeAdapter<T, C>
where
C::PayloadBuilder: PayloadBuilder,
{
impl<T: FullNodeTypes, C: NodeComponents<T>> FullNodeComponents for NodeAdapter<T, C> {
type Pool = C::Pool;
type Evm = C::Evm;
type Executor = C::Executor;

View File

@ -26,7 +26,7 @@ use reth_consensus::FullConsensus;
use reth_evm::execute::BlockExecutorProvider;
use reth_network::NetworkHandle;
use reth_network_api::FullNetwork;
use reth_node_api::{HeaderTy, NodeTypes, NodeTypesWithEngine, TxTy};
use reth_node_api::{HeaderTy, NodeTypes, NodeTypesWithEngine, PayloadBuilder, TxTy};
use reth_payload_builder::PayloadBuilderHandle;
use reth_transaction_pool::{PoolTransaction, TransactionPool};
@ -52,7 +52,8 @@ pub trait NodeComponents<T: FullNodeTypes>: Clone + Unpin + Send + Sync + 'stati
type Network: FullNetwork;
/// Builds new blocks.
type PayloadBuilder: Clone;
type PayloadBuilder: PayloadBuilder<PayloadType = <T::Types as NodeTypesWithEngine>::Engine>
+ Clone;
/// Returns the transaction pool of the node.
fn pool(&self) -> &Self::Pool;

View File

@ -10,8 +10,8 @@ use std::{
use alloy_rpc_types::engine::ClientVersionV1;
use futures::TryFutureExt;
use reth_node_api::{
AddOnsContext, EngineValidator, FullNodeComponents, NodeAddOns, NodeTypes, NodeTypesWithEngine,
PayloadBuilder,
AddOnsContext, EngineValidator, FullNodeComponents, NodeAddOns, NodePrimitives, NodeTypes,
NodeTypesWithEngine,
};
use reth_node_core::{
node_config::NodeConfig,
@ -19,7 +19,7 @@ use reth_node_core::{
};
use reth_payload_builder::PayloadStore;
use reth_primitives::EthPrimitives;
use reth_provider::{providers::ProviderNodeTypes, BlockReader};
use reth_provider::providers::ProviderNodeTypes;
use reth_rpc::{
eth::{EthApiTypes, FullEthApiServer},
EthApi,
@ -33,7 +33,6 @@ use reth_rpc_builder::{
use reth_rpc_engine_api::{capabilities::EngineCapabilities, EngineApi};
use reth_tasks::TaskExecutor;
use reth_tracing::tracing::{debug, info};
use reth_transaction_pool::TransactionPool;
use crate::EthApiBuilderCtx;
@ -404,18 +403,17 @@ where
impl<N, EthApi, EV> RpcAddOns<N, EthApi, EV>
where
N: FullNodeComponents<
Types: ProviderNodeTypes<Primitives = EthPrimitives>,
PayloadBuilder: PayloadBuilder<PayloadType = <N::Types as NodeTypesWithEngine>::Engine>,
Pool: TransactionPool<Transaction = <EthApi::Pool as TransactionPool>::Transaction>,
Types: ProviderNodeTypes<
Primitives: NodePrimitives<
Block = reth_primitives::Block,
BlockHeader = reth_primitives::Header,
BlockBody = reth_primitives::BlockBody,
>,
>,
>,
EthApi: EthApiTypes
+ FullEthApiServer<
Provider: BlockReader<
Block = reth_primitives::Block,
Receipt = reth_primitives::Receipt,
Header = reth_primitives::Header,
>,
> + AddDevSigners
+ FullEthApiServer<Provider = N::Provider, Pool = N::Pool, Network = N::Network>
+ AddDevSigners
+ Unpin
+ 'static,
EV: EngineValidatorBuilder<N>,
@ -535,19 +533,10 @@ where
impl<N, EthApi, EV> NodeAddOns<N> for RpcAddOns<N, EthApi, EV>
where
N: FullNodeComponents<
Types: ProviderNodeTypes<Primitives = EthPrimitives>,
PayloadBuilder: PayloadBuilder<PayloadType = <N::Types as NodeTypesWithEngine>::Engine>,
Pool: TransactionPool<Transaction = <EthApi::Pool as TransactionPool>::Transaction>,
>,
N: FullNodeComponents<Types: ProviderNodeTypes<Primitives = EthPrimitives>>,
EthApi: EthApiTypes
+ FullEthApiServer<
Provider: BlockReader<
Block = reth_primitives::Block,
Receipt = reth_primitives::Receipt,
Header = reth_primitives::Header,
>,
> + AddDevSigners
+ FullEthApiServer<Provider = N::Provider, Pool = N::Pool, Network = N::Network>
+ AddDevSigners
+ Unpin
+ 'static,
EV: EngineValidatorBuilder<N>,