diff --git a/crates/payload/ethereum/src/lib.rs b/crates/payload/ethereum/src/lib.rs index 610ee9af71..2338e25f53 100644 --- a/crates/payload/ethereum/src/lib.rs +++ b/crates/payload/ethereum/src/lib.rs @@ -30,7 +30,7 @@ mod builder { }; use reth_provider::{BundleStateWithReceipts, StateProviderFactory}; use reth_revm::database::StateProviderDatabase; - use reth_transaction_pool::TransactionPool; + use reth_transaction_pool::{BestTransactionsAttributes, TransactionPool}; use revm::{ db::states::bundle_state::BundleRetention, primitives::{EVMError, Env, InvalidTransaction, ResultAndState}, @@ -207,7 +207,11 @@ mod builder { let base_fee = initialized_block_env.basefee.to::(); let mut executed_txs = Vec::new(); - let mut best_txs = pool.best_transactions_with_base_fee(base_fee); + + let mut best_txs = pool.best_transactions_with_attributes(BestTransactionsAttributes::new( + base_fee, + initialized_block_env.get_blob_gasprice().map(|gasprice| gasprice as u64), + )); let mut total_fees = U256::ZERO; diff --git a/crates/payload/optimism/src/lib.rs b/crates/payload/optimism/src/lib.rs index 06a2d8bbdb..441bba62c0 100644 --- a/crates/payload/optimism/src/lib.rs +++ b/crates/payload/optimism/src/lib.rs @@ -28,7 +28,7 @@ mod builder { }; use reth_provider::{BundleStateWithReceipts, StateProviderFactory}; use reth_revm::database::StateProviderDatabase; - use reth_transaction_pool::TransactionPool; + use reth_transaction_pool::{BestTransactionsAttributes, TransactionPool}; use revm::{ db::states::bundle_state::BundleRetention, primitives::{EVMError, Env, InvalidTransaction, ResultAndState}, @@ -240,7 +240,10 @@ mod builder { let base_fee = initialized_block_env.basefee.to::(); let mut executed_txs = Vec::new(); - let mut best_txs = pool.best_transactions_with_base_fee(base_fee); + let mut best_txs = pool.best_transactions_with_attributes(BestTransactionsAttributes::new( + base_fee, + initialized_block_env.get_blob_gasprice().map(|gasprice| gasprice as u64), + )); let mut total_fees = U256::ZERO; diff --git a/crates/rpc/rpc/src/eth/api/pending_block.rs b/crates/rpc/rpc/src/eth/api/pending_block.rs index ecef1e5bae..7609f8d41a 100644 --- a/crates/rpc/rpc/src/eth/api/pending_block.rs +++ b/crates/rpc/rpc/src/eth/api/pending_block.rs @@ -16,7 +16,7 @@ use reth_revm::{ database::StateProviderDatabase, state_change::{apply_beacon_root_contract_call, post_block_withdrawals_balance_increments}, }; -use reth_transaction_pool::TransactionPool; +use reth_transaction_pool::{BestTransactionsAttributes, TransactionPool}; use revm::{db::states::bundle_state::BundleRetention, Database, DatabaseCommit, State}; use std::time::Instant; @@ -62,7 +62,10 @@ impl PendingBlockEnv { let mut executed_txs = Vec::new(); let mut senders = Vec::new(); - let mut best_txs = pool.best_transactions_with_base_fee(base_fee); + let mut best_txs = pool.best_transactions_with_attributes(BestTransactionsAttributes::new( + base_fee, + block_env.get_blob_gasprice().map(|gasprice| gasprice as u64), + )); let (withdrawals, withdrawals_root) = match origin { PendingBlockEnvOrigin::ActualPending(ref block) => { diff --git a/crates/transaction-pool/src/lib.rs b/crates/transaction-pool/src/lib.rs index 1bc0ad1ed9..26b7caf841 100644 --- a/crates/transaction-pool/src/lib.rs +++ b/crates/transaction-pool/src/lib.rs @@ -421,7 +421,7 @@ where &self, base_fee: u64, ) -> Box>>> { - self.pool.best_transactions_with_base_fee(base_fee) + self.pool.best_transactions_with_attributes(BestTransactionsAttributes::base_fee(base_fee)) } fn best_transactions_with_attributes( diff --git a/crates/transaction-pool/src/pool/mod.rs b/crates/transaction-pool/src/pool/mod.rs index bab3777b20..efb37e96df 100644 --- a/crates/transaction-pool/src/pool/mod.rs +++ b/crates/transaction-pool/src/pool/mod.rs @@ -621,16 +621,6 @@ where self.get_pool_data().best_transactions() } - /// Returns an iterator that yields transactions that are ready to be included in the block with - /// the given base fee. - pub(crate) fn best_transactions_with_base_fee( - &self, - base_fee: u64, - ) -> Box>>> - { - self.get_pool_data().best_transactions_with_base_fee(base_fee) - } - /// Returns an iterator that yields transactions that are ready to be included in the block with /// the given base fee and optional blob fee attributes. pub(crate) fn best_transactions_with_attributes( diff --git a/crates/transaction-pool/src/pool/parked.rs b/crates/transaction-pool/src/pool/parked.rs index 671248b755..3b534431bb 100644 --- a/crates/transaction-pool/src/pool/parked.rs +++ b/crates/transaction-pool/src/pool/parked.rs @@ -221,6 +221,7 @@ impl ParkedPool> { /// Returns all transactions that satisfy the given basefee. /// /// Note: this does _not_ remove the transactions + #[allow(dead_code)] pub(crate) fn satisfy_base_fee_transactions( &self, basefee: u64, diff --git a/crates/transaction-pool/src/pool/txpool.rs b/crates/transaction-pool/src/pool/txpool.rs index 5644301b54..3745a98f24 100644 --- a/crates/transaction-pool/src/pool/txpool.rs +++ b/crates/transaction-pool/src/pool/txpool.rs @@ -292,34 +292,6 @@ impl TxPool { self.pending_pool.best() } - /// Returns an iterator that yields transactions that are ready to be included in the block with - /// the given base fee. - pub(crate) fn best_transactions_with_base_fee( - &self, - basefee: u64, - ) -> Box>>> - { - match basefee.cmp(&self.all_transactions.pending_fees.base_fee) { - Ordering::Equal => { - // fee unchanged, nothing to shift - Box::new(self.best_transactions()) - } - Ordering::Greater => { - // base fee increased, we only need to enforces this on the pending pool - Box::new(self.pending_pool.best_with_basefee(basefee)) - } - Ordering::Less => { - // base fee decreased, we need to move transactions from the basefee pool to the - // pending pool - let unlocked = self.basefee_pool.satisfy_base_fee_transactions(basefee); - Box::new( - self.pending_pool - .best_with_unlocked(unlocked, self.all_transactions.pending_fees.base_fee), - ) - } - } - } - /// Returns an iterator that yields transactions that are ready to be included in the block with /// the given base fee and optional blob fee. pub(crate) fn best_transactions_with_attributes( diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs index 66478501b5..d424b7edde 100644 --- a/crates/transaction-pool/src/traits.rs +++ b/crates/transaction-pool/src/traits.rs @@ -1,3 +1,5 @@ +#![allow(deprecated)] + use crate::{ blobstore::BlobStoreError, error::PoolResult, @@ -228,6 +230,7 @@ pub trait TransactionPool: Send + Sync + Clone { /// given base fee. /// /// Consumer: Block production + #[deprecated(note = "Use best_transactions_with_attributes instead.")] fn best_transactions_with_base_fee( &self, base_fee: u64,