Skip to content

Commit

Permalink
CLI parameter to specify the broadcast channel capacity of PendingPool (
Browse files Browse the repository at this point in the history
paradigmxyz#12388)

Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
stevencartavia and mattsse authored Nov 8, 2024
1 parent 462540f commit 9f6f63d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions book/cli/reth/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,11 @@ TxPool:
[default: 1024]
--txpool.max-new-pending-txs-notifications <MAX_NEW_PENDING_TXS_NOTIFICATIONS>
How many new pending transactions to buffer and send to in progress pending transaction iterators
[default: 200]
Builder:
--builder.extradata <EXTRADATA>
Block extra data set by the payload builder
Expand Down
13 changes: 10 additions & 3 deletions crates/node/core/src/args/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use reth_transaction_pool::{
pool::{NEW_TX_LISTENER_BUFFER_SIZE, PENDING_TX_LISTENER_BUFFER_SIZE},
validate::DEFAULT_MAX_TX_INPUT_BYTES,
LocalTransactionConfig, PoolConfig, PriceBumpConfig, SubPoolLimit, DEFAULT_PRICE_BUMP,
DEFAULT_TXPOOL_ADDITIONAL_VALIDATION_TASKS, REPLACE_BLOB_PRICE_BUMP,
TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER, TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT,
TXPOOL_SUBPOOL_MAX_TXS_DEFAULT,
DEFAULT_TXPOOL_ADDITIONAL_VALIDATION_TASKS, MAX_NEW_PENDING_TXS_NOTIFICATIONS,
REPLACE_BLOB_PRICE_BUMP, TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER,
TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT, TXPOOL_SUBPOOL_MAX_TXS_DEFAULT,
};
/// Parameters for debugging purposes
#[derive(Debug, Clone, Args, PartialEq, Eq)]
Expand Down Expand Up @@ -86,6 +86,11 @@ pub struct TxPoolArgs {
/// Maximum number of new transactions to buffer
#[arg(long = "txpool.max-new-txns", alias = "txpool.max_new_txns", default_value_t = NEW_TX_LISTENER_BUFFER_SIZE)]
pub new_tx_listener_buffer_size: usize,

/// How many new pending transactions to buffer and send to in progress pending transaction
/// iterators.
#[arg(long = "txpool.max-new-pending-txs-notifications", alias = "txpool.max-new-pending-txs-notifications", default_value_t = MAX_NEW_PENDING_TXS_NOTIFICATIONS)]
pub max_new_pending_txs_notifications: usize,
}

impl Default for TxPoolArgs {
Expand All @@ -110,6 +115,7 @@ impl Default for TxPoolArgs {
additional_validation_tasks: DEFAULT_TXPOOL_ADDITIONAL_VALIDATION_TASKS,
pending_tx_listener_buffer_size: PENDING_TX_LISTENER_BUFFER_SIZE,
new_tx_listener_buffer_size: NEW_TX_LISTENER_BUFFER_SIZE,
max_new_pending_txs_notifications: MAX_NEW_PENDING_TXS_NOTIFICATIONS,
}
}
}
Expand Down Expand Up @@ -148,6 +154,7 @@ impl RethTransactionPoolConfig for TxPoolArgs {
gas_limit: self.gas_limit,
pending_tx_listener_buffer_size: self.pending_tx_listener_buffer_size,
new_tx_listener_buffer_size: self.new_tx_listener_buffer_size,
max_new_pending_txs_notifications: self.max_new_pending_txs_notifications,
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions crates/transaction-pool/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ pub const DEFAULT_PRICE_BUMP: u128 = 10;
/// This enforces that a blob transaction requires a 100% price bump to be replaced
pub const REPLACE_BLOB_PRICE_BUMP: u128 = 100;

/// Default maximum new transactions for broadcasting.
pub const MAX_NEW_PENDING_TXS_NOTIFICATIONS: usize = 200;

/// Configuration options for the Transaction pool.
#[derive(Debug, Clone)]
pub struct PoolConfig {
Expand All @@ -53,6 +56,8 @@ pub struct PoolConfig {
pub pending_tx_listener_buffer_size: usize,
/// Bound on number of new transactions from `reth_network::TransactionsManager` to buffer.
pub new_tx_listener_buffer_size: usize,
/// How many new pending transactions to buffer and send iterators in progress.
pub max_new_pending_txs_notifications: usize,
}

impl PoolConfig {
Expand Down Expand Up @@ -80,6 +85,7 @@ impl Default for PoolConfig {
local_transactions_config: Default::default(),
pending_tx_listener_buffer_size: PENDING_TX_LISTENER_BUFFER_SIZE,
new_tx_listener_buffer_size: NEW_TX_LISTENER_BUFFER_SIZE,
max_new_pending_txs_notifications: MAX_NEW_PENDING_TXS_NOTIFICATIONS,
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/transaction-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ pub use crate::{
blobstore::{BlobStore, BlobStoreError},
config::{
LocalTransactionConfig, PoolConfig, PriceBumpConfig, SubPoolLimit, DEFAULT_PRICE_BUMP,
DEFAULT_TXPOOL_ADDITIONAL_VALIDATION_TASKS, REPLACE_BLOB_PRICE_BUMP,
TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER, TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT,
TXPOOL_SUBPOOL_MAX_TXS_DEFAULT,
DEFAULT_TXPOOL_ADDITIONAL_VALIDATION_TASKS, MAX_NEW_PENDING_TXS_NOTIFICATIONS,
REPLACE_BLOB_PRICE_BUMP, TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER,
TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT, TXPOOL_SUBPOOL_MAX_TXS_DEFAULT,
},
error::PoolResult,
ordering::{CoinbaseTipOrdering, Priority, TransactionOrdering},
Expand Down

0 comments on commit 9f6f63d

Please sign in to comment.