Skip to content

Commit

Permalink
chore: relax txpool client trait bounds (#10705)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Sep 4, 2024
1 parent f82719f commit f8e5b18
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
12 changes: 6 additions & 6 deletions crates/transaction-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@
//! Listen for new transactions and print them:
//!
//! ```
//! use reth_chainspec::{MAINNET, ChainSpecProvider};
//! use reth_storage_api::{BlockReaderIdExt, StateProviderFactory};
//! use reth_chainspec::MAINNET;
//! use reth_storage_api::StateProviderFactory;
//! use reth_tasks::TokioTaskExecutor;
//! use reth_transaction_pool::{TransactionValidationTaskExecutor, Pool, TransactionPool};
//! use reth_transaction_pool::blobstore::InMemoryBlobStore;
//! async fn t<C>(client: C) where C: StateProviderFactory + BlockReaderIdExt + ChainSpecProvider + Clone + 'static{
//! async fn t<C>(client: C) where C: StateProviderFactory + Clone + 'static{
//! let blob_store = InMemoryBlobStore::default();
//! let pool = Pool::eth_pool(
//! TransactionValidationTaskExecutor::eth(client, MAINNET.clone(), blob_store.clone(), TokioTaskExecutor::default()),
Expand Down Expand Up @@ -278,7 +278,7 @@ where

impl<Client, S> EthTransactionPool<Client, S>
where
Client: StateProviderFactory + reth_storage_api::BlockReaderIdExt + Clone + 'static,
Client: StateProviderFactory + Clone + 'static,
S: BlobStore,
{
/// Returns a new [`Pool`] that uses the default [`TransactionValidationTaskExecutor`] when
Expand All @@ -288,12 +288,12 @@ where
///
/// ```
/// use reth_chainspec::MAINNET;
/// use reth_storage_api::{BlockReaderIdExt, StateProviderFactory};
/// use reth_storage_api::StateProviderFactory;
/// use reth_tasks::TokioTaskExecutor;
/// use reth_transaction_pool::{
/// blobstore::InMemoryBlobStore, Pool, TransactionValidationTaskExecutor,
/// };
/// # fn t<C>(client: C) where C: StateProviderFactory + BlockReaderIdExt + Clone + 'static {
/// # fn t<C>(client: C) where C: StateProviderFactory + Clone + 'static {
/// let blob_store = InMemoryBlobStore::default();
/// let pool = Pool::eth_pool(
/// TransactionValidationTaskExecutor::eth(
Expand Down
8 changes: 4 additions & 4 deletions crates/transaction-pool/src/validate/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use reth_primitives::{
EIP1559_TX_TYPE_ID, EIP2930_TX_TYPE_ID, EIP4844_TX_TYPE_ID, EIP7702_TX_TYPE_ID,
LEGACY_TX_TYPE_ID,
};
use reth_storage_api::{AccountReader, BlockReaderIdExt, StateProviderFactory};
use reth_storage_api::{AccountReader, StateProviderFactory};
use reth_tasks::TaskSpawner;
use revm::{
interpreter::gas::validate_initial_tx_gas,
Expand Down Expand Up @@ -48,7 +48,7 @@ impl<Client, Tx> EthTransactionValidator<Client, Tx> {

impl<Client, Tx> EthTransactionValidator<Client, Tx>
where
Client: StateProviderFactory + BlockReaderIdExt,
Client: StateProviderFactory,
Tx: EthPoolTransaction,
{
/// Validates a single transaction.
Expand Down Expand Up @@ -77,7 +77,7 @@ where

impl<Client, Tx> TransactionValidator for EthTransactionValidator<Client, Tx>
where
Client: StateProviderFactory + BlockReaderIdExt,
Client: StateProviderFactory,
Tx: EthPoolTransaction,
{
type Transaction = Tx;
Expand Down Expand Up @@ -146,7 +146,7 @@ impl<Client, Tx> EthTransactionValidatorInner<Client, Tx> {

impl<Client, Tx> EthTransactionValidatorInner<Client, Tx>
where
Client: StateProviderFactory + BlockReaderIdExt,
Client: StateProviderFactory,
Tx: EthPoolTransaction,
{
/// Validates a single transaction.
Expand Down
6 changes: 1 addition & 5 deletions crates/transaction-pool/src/validate/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::{
use futures_util::{lock::Mutex, StreamExt};
use reth_chainspec::ChainSpec;
use reth_primitives::SealedBlock;
use reth_storage_api::BlockReaderIdExt;
use reth_tasks::TaskSpawner;
use std::{future::Future, pin::Pin, sync::Arc};
use tokio::{
Expand Down Expand Up @@ -111,10 +110,7 @@ impl<V> TransactionValidationTaskExecutor<V> {
}
}

impl<Client, Tx> TransactionValidationTaskExecutor<EthTransactionValidator<Client, Tx>>
where
Client: BlockReaderIdExt,
{
impl<Client, Tx> TransactionValidationTaskExecutor<EthTransactionValidator<Client, Tx>> {
/// Creates a new instance for the given [`ChainSpec`]
///
/// This will spawn a single validation tasks that performs the actual validation.
Expand Down

0 comments on commit f8e5b18

Please sign in to comment.