Type Alias TestPool

pub type TestPool = Pool<MockTransactionValidator<MockTransaction>, CoinbaseTipOrdering<MockTransaction>, InMemoryBlobStore>;
Available on crate feature test-utils only.
Expand description

A Pool used for testing

Aliased Type§

struct TestPool { /* private fields */ }

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 8 bytes

Implementations

§

impl<V, T, S> Pool<V, T, S>

pub fn new( validator: V, ordering: T, blob_store: S, config: PoolConfig, ) -> Pool<V, T, S>

Create a new transaction pool instance.

pub fn config(&self) -> &PoolConfig

Get the config the pool was configured with.

pub fn len(&self) -> usize

Number of transactions in the entire pool

pub fn is_empty(&self) -> bool

Whether the pool is empty

pub fn is_exceeded(&self) -> bool

Returns whether or not the pool is over its configured size and transaction count limits.

pub fn blob_store(&self) -> &S

Returns the configured blob store.

Trait Implementations

§

impl<V, T, S> Clone for Pool<V, T, S>

§

fn clone(&self) -> Pool<V, T, S>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<V, T, S> Debug for Pool<V, T, S>
where V: Debug, T: Debug + TransactionOrdering, S: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl From<TestPoolBuilder> for Pool<MockTransactionValidator<MockTransaction>, CoinbaseTipOrdering<MockTransaction>, InMemoryBlobStore>

§

impl<V, T, S> TransactionPool for Pool<V, T, S>

implements the TransactionPool interface for various transaction pool API consumers.

§

fn get_pending_transactions_by_origin( &self, origin: TransactionOrigin, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns all pending transactions filtered by TransactionOrigin

§

type Transaction = <T as TransactionOrdering>::Transaction

The transaction type of the pool
§

fn pool_size(&self) -> PoolSize

Returns stats about the pool and all sub-pools.
§

fn block_info(&self) -> BlockInfo

Returns the block the pool is currently tracking. Read more
§

async fn add_transaction_and_subscribe( &self, origin: TransactionOrigin, transaction: <Pool<V, T, S> as TransactionPool>::Transaction, ) -> Result<TransactionEvents, PoolError>

Adds an unvalidated transaction into the pool and subscribe to state changes. Read more
§

async fn add_transaction( &self, origin: TransactionOrigin, transaction: <Pool<V, T, S> as TransactionPool>::Transaction, ) -> Result<FixedBytes<32>, PoolError>

Adds an unvalidated transaction into the pool. Read more
§

async fn add_transactions( &self, origin: TransactionOrigin, transactions: Vec<<Pool<V, T, S> as TransactionPool>::Transaction>, ) -> Vec<Result<FixedBytes<32>, PoolError>>

Adds the given unvalidated transaction into the pool. Read more
§

fn transaction_event_listener( &self, tx_hash: FixedBytes<32>, ) -> Option<TransactionEvents>

Returns a new transaction change event stream for the given transaction. Read more
§

fn all_transactions_event_listener( &self, ) -> AllTransactionsEvents<<Pool<V, T, S> as TransactionPool>::Transaction>

Returns a new transaction change event stream for all transactions in the pool.
§

fn pending_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<FixedBytes<32>>

Returns a new [Receiver] that yields transactions hashes for new pending transactions inserted into the pending pool depending on the given TransactionListenerKind argument.
§

fn blob_transaction_sidecars_listener(&self) -> Receiver<NewBlobSidecar>

Returns a new [Receiver] that yields blob “sidecars” (blobs w/ assoc. kzg commitments/proofs) for eip-4844 transactions inserted into the pool
§

fn new_transactions_listener_for( &self, kind: TransactionListenerKind, ) -> Receiver<NewTransactionEvent<<Pool<V, T, S> as TransactionPool>::Transaction>>

Returns a new stream that yields new valid transactions added to the pool depending on the given TransactionListenerKind argument.
§

fn pooled_transaction_hashes(&self) -> Vec<FixedBytes<32>>

Returns the hashes of all transactions in the pool. Read more
§

fn pooled_transaction_hashes_max(&self, max: usize) -> Vec<FixedBytes<32>>

Returns only the first max hashes of transactions in the pool. Read more
§

fn pooled_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns the full transaction objects all transactions in the pool. Read more
§

fn pooled_transactions_max( &self, max: usize, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns only the first max transactions in the pool. Read more
§

fn get_pooled_transaction_elements( &self, tx_hashes: Vec<FixedBytes<32>>, limit: GetPooledTransactionLimit, ) -> Vec<<<V as TransactionValidator>::Transaction as PoolTransaction>::Pooled>

Returns converted PooledTransaction for the given transaction hashes. Read more
§

fn get_pooled_transaction_element( &self, tx_hash: FixedBytes<32>, ) -> Option<Recovered<<<V as TransactionValidator>::Transaction as PoolTransaction>::Pooled>>

Returns the pooled transaction variant for the given transaction hash. Read more
§

fn best_transactions( &self, ) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>>

Returns an iterator that yields transactions that are ready for block production. Read more
§

fn best_transactions_with_attributes( &self, best_transactions_attributes: BestTransactionsAttributes, ) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>>

Returns an iterator that yields transactions that are ready for block production with the given base fee and optional blob fee attributes. Read more
§

fn pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns all transactions that can be included in the next block. Read more
§

fn pending_transactions_max( &self, max: usize, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns first max transactions that can be included in the next block. See https://github.com/paradigmxyz/reth/issues/12767#issuecomment-2493223579 Read more
§

fn queued_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns all transactions that can be included in future blocks. Read more
§

fn all_transactions( &self, ) -> AllPoolTransactions<<Pool<V, T, S> as TransactionPool>::Transaction>

Returns all transactions that are currently in the pool grouped by whether they are ready for inclusion in the next block or not. Read more
§

fn remove_transactions( &self, hashes: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Removes all transactions corresponding to the given hashes. Read more
§

fn remove_transactions_and_descendants( &self, hashes: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Removes all transactions corresponding to the given hashes. Read more
§

fn remove_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Removes all transactions from the given sender Read more
§

fn retain_unknown<A>(&self, announcement: &mut A)

Retains only those hashes that are unknown to the pool. In other words, removes all transactions from the given set that are currently present in the pool. Returns hashes already known to the pool. Read more
§

fn get( &self, tx_hash: &FixedBytes<32>, ) -> Option<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns the transaction for the given hash.
§

fn get_all( &self, txs: Vec<FixedBytes<32>>, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns all transactions objects for the given hashes. Read more
§

fn on_propagated(&self, txs: PropagatedTransactions)

Notify the pool about transactions that are propagated to peers. Read more
§

fn get_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns all transactions sent by a given user
§

fn get_pending_transactions_with_predicate( &self, predicate: impl FnMut(&ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>) -> bool, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns all pending transactions filtered by predicate
§

fn get_pending_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns all pending transactions sent by a given user
§

fn get_queued_transactions_by_sender( &self, sender: Address, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns all queued transactions sent by a given user
§

fn get_highest_transaction_by_sender( &self, sender: Address, ) -> Option<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns the highest transaction sent by a given user
§

fn get_highest_consecutive_transaction_by_sender( &self, sender: Address, on_chain_nonce: u64, ) -> Option<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns the transaction with the highest nonce that is executable given the on chain nonce. In other words the highest non nonce gapped transaction. Read more
§

fn get_transaction_by_sender_and_nonce( &self, sender: Address, nonce: u64, ) -> Option<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns a transaction sent by a given user and a nonce
§

fn get_transactions_by_origin( &self, origin: TransactionOrigin, ) -> Vec<Arc<ValidPoolTransaction<<Pool<V, T, S> as TransactionPool>::Transaction>>>

Returns all transactions that where submitted with the given TransactionOrigin
§

fn unique_senders(&self) -> HashSet<Address>

Returns a set of all senders of transactions in the pool
§

fn get_blob( &self, tx_hash: FixedBytes<32>, ) -> Result<Option<Arc<BlobTransactionSidecar>>, BlobStoreError>

Returns the BlobTransactionSidecar for the given transaction hash if it exists in the blob store.
§

fn get_all_blobs( &self, tx_hashes: Vec<FixedBytes<32>>, ) -> Result<Vec<(FixedBytes<32>, Arc<BlobTransactionSidecar>)>, BlobStoreError>

Returns all BlobTransactionSidecar for the given transaction hashes if they exists in the blob store. Read more
§

fn get_all_blobs_exact( &self, tx_hashes: Vec<FixedBytes<32>>, ) -> Result<Vec<Arc<BlobTransactionSidecar>>, BlobStoreError>

Returns the exact BlobTransactionSidecar for the given transaction hashes in the order they were requested. Read more
§

fn get_blobs_for_versioned_hashes( &self, versioned_hashes: &[FixedBytes<32>], ) -> Result<Vec<Option<BlobAndProofV1>>, BlobStoreError>

Return the BlobTransactionSidecars for a list of blob versioned hashes.
§

fn add_external_transaction( &self, transaction: Self::Transaction, ) -> impl Future<Output = Result<FixedBytes<32>, PoolError>> + Send

Imports an external transaction. Read more
§

fn add_external_transactions( &self, transactions: Vec<Self::Transaction>, ) -> impl Future<Output = Vec<Result<FixedBytes<32>, PoolError>>> + Send

Imports all external transactions Read more
§

fn pending_transactions_listener(&self) -> Receiver<FixedBytes<32>>

Returns a new Stream that yields transactions hashes for new pending transactions inserted into the pool that are allowed to be propagated. Read more
§

fn new_transactions_listener( &self, ) -> Receiver<NewTransactionEvent<Self::Transaction>>

Returns a new stream that yields new valid transactions added to the pool.
§

fn new_pending_pool_transactions_listener( &self, ) -> NewSubpoolTransactionStream<Self::Transaction>

Returns a new Stream that yields new transactions added to the pending sub-pool. Read more
§

fn new_basefee_pool_transactions_listener( &self, ) -> NewSubpoolTransactionStream<Self::Transaction>

Returns a new Stream that yields new transactions added to the basefee sub-pool. Read more
§

fn new_queued_transactions_listener( &self, ) -> NewSubpoolTransactionStream<Self::Transaction>

Returns a new Stream that yields new transactions added to the queued-pool. Read more
§

fn contains(&self, tx_hash: &FixedBytes<32>) -> bool

Returns if the transaction for the given hash is already included in this pool.
§

fn get_local_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions that where submitted as TransactionOrigin::Local
§

fn get_private_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions that where submitted as TransactionOrigin::Private
§

fn get_external_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all transactions that where submitted as TransactionOrigin::External
§

fn get_local_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all pending transactions that where submitted as TransactionOrigin::Local
§

fn get_private_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all pending transactions that where submitted as TransactionOrigin::Private
§

fn get_external_pending_transactions( &self, ) -> Vec<Arc<ValidPoolTransaction<Self::Transaction>>>

Returns all pending transactions that where submitted as TransactionOrigin::External
§

impl<V, T, S> TransactionPoolExt for Pool<V, T, S>

§

fn set_block_info(&self, info: BlockInfo)

Sets the current block info for the pool.
§

fn on_canonical_state_change<B>(&self, update: CanonicalStateUpdate<'_, B>)
where B: Block,

Event listener for when the pool needs to be updated. Read more
§

fn update_accounts(&self, accounts: Vec<ChangedAccount>)

Updates the accounts in the pool
§

fn delete_blob(&self, tx: FixedBytes<32>)

Deletes the blob sidecar for the given transaction from the blob store
§

fn delete_blobs(&self, txs: Vec<FixedBytes<32>>)

Deletes multiple blob sidecars from the blob store
§

fn cleanup_blobs(&self)

Maintenance function to cleanup blobs that are no longer needed.