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

@ -108,7 +108,7 @@
//! ```
//! use futures_util::Stream;
//! use reth_chain_state::CanonStateNotification;
//! use reth_chainspec::{MAINNET, ChainSpecProvider};
//! use reth_chainspec::{MAINNET, ChainSpecProvider, ChainSpec};
//! use reth_storage_api::{BlockReaderIdExt, StateProviderFactory};
//! use reth_tasks::TokioTaskExecutor;
//! use reth_tasks::TaskSpawner;
@ -118,7 +118,7 @@
//! use reth_transaction_pool::maintain::{maintain_transaction_pool_future};
//!
//! async fn t<C, St>(client: C, stream: St)
//! where C: StateProviderFactory + BlockReaderIdExt + ChainSpecProvider + Clone + 'static,
//! where C: StateProviderFactory + BlockReaderIdExt + ChainSpecProvider<ChainSpec = ChainSpec> + Clone + 'static,
//! St: Stream<Item = CanonStateNotification> + Send + Unpin + 'static,
//! {
//! let blob_store = InMemoryBlobStore::default();

View File

@ -12,7 +12,7 @@ use futures_util::{
FutureExt, Stream, StreamExt,
};
use reth_chain_state::CanonStateNotification;
use reth_chainspec::ChainSpecProvider;
use reth_chainspec::{ChainSpec, ChainSpecProvider};
use reth_execution_types::ExecutionOutcome;
use reth_fs_util::FsPathError;
use reth_primitives::{
@ -73,7 +73,12 @@ pub fn maintain_transaction_pool_future<Client, P, St, Tasks>(
config: MaintainPoolConfig,
) -> BoxFuture<'static, ()>
where
Client: StateProviderFactory + BlockReaderIdExt + ChainSpecProvider + Clone + Send + 'static,
Client: StateProviderFactory
+ BlockReaderIdExt
+ ChainSpecProvider<ChainSpec = ChainSpec>
+ Clone
+ Send
+ 'static,
P: TransactionPoolExt + 'static,
St: Stream<Item = CanonStateNotification> + Send + Unpin + 'static,
Tasks: TaskSpawner + 'static,
@ -94,7 +99,12 @@ pub async fn maintain_transaction_pool<Client, P, St, Tasks>(
task_spawner: Tasks,
config: MaintainPoolConfig,
) where
Client: StateProviderFactory + BlockReaderIdExt + ChainSpecProvider + Clone + Send + 'static,
Client: StateProviderFactory
+ BlockReaderIdExt
+ ChainSpecProvider<ChainSpec = ChainSpec>
+ Clone
+ Send
+ 'static,
P: TransactionPoolExt + 'static,
St: Stream<Item = CanonStateNotification> + Send + Unpin + 'static,
Tasks: TaskSpawner + 'static,