mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-30 01:28:21 -05:00
Deprecate best_transactions_with_base_fee (#6394)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@@ -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::<u64>();
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -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::<u64>();
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -421,7 +421,7 @@ where
|
||||
&self,
|
||||
base_fee: u64,
|
||||
) -> Box<dyn BestTransactions<Item = Arc<ValidPoolTransaction<Self::Transaction>>>> {
|
||||
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(
|
||||
|
||||
@@ -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<dyn crate::traits::BestTransactions<Item = Arc<ValidPoolTransaction<T::Transaction>>>>
|
||||
{
|
||||
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(
|
||||
|
||||
@@ -221,6 +221,7 @@ impl<T: PoolTransaction> ParkedPool<BasefeeOrd<T>> {
|
||||
/// 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,
|
||||
|
||||
@@ -292,34 +292,6 @@ impl<T: TransactionOrdering> TxPool<T> {
|
||||
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<dyn crate::traits::BestTransactions<Item = Arc<ValidPoolTransaction<T::Transaction>>>>
|
||||
{
|
||||
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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user