config cache from cli (#6767)

This commit is contained in:
back
2024-02-24 02:20:19 -08:00
committed by GitHub
parent 39abdaa427
commit 2699262a6f
4 changed files with 29 additions and 6 deletions

View File

@ -344,10 +344,15 @@ TxPool:
[default: 100] [default: 100]
--txpool.max_tx_input_bytes <MAX_TX_INPUT_BYTES> --txpool.max_tx_input_bytes <MAX_TX_INPUT_BYTES>
Maximum size a single transaction can have Maximum size a single transaction can have
[default: 131072] [default: 131072]
--txpool.max_cached_entries <MAX_CACHED_ENTRIES>
The maximum number of blobs to keep in the in memory blob cache
[default: 100]
--txpool.nolocals --txpool.nolocals
Flag to disable local transaction exemptions Flag to disable local transaction exemptions

View File

@ -4,8 +4,9 @@ use crate::cli::config::RethTransactionPoolConfig;
use clap::Args; use clap::Args;
use reth_primitives::Address; use reth_primitives::Address;
use reth_transaction_pool::{ use reth_transaction_pool::{
validate::DEFAULT_MAX_TX_INPUT_BYTES, LocalTransactionConfig, PoolConfig, PriceBumpConfig, blobstore::disk::DEFAULT_MAX_CACHED_BLOBS, validate::DEFAULT_MAX_TX_INPUT_BYTES,
SubPoolLimit, DEFAULT_PRICE_BUMP, REPLACE_BLOB_PRICE_BUMP, TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER, LocalTransactionConfig, PoolConfig, PriceBumpConfig, SubPoolLimit, DEFAULT_PRICE_BUMP,
REPLACE_BLOB_PRICE_BUMP, TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER,
TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT, TXPOOL_SUBPOOL_MAX_TXS_DEFAULT, TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT, TXPOOL_SUBPOOL_MAX_TXS_DEFAULT,
}; };
/// Parameters for debugging purposes /// Parameters for debugging purposes
@ -49,6 +50,10 @@ pub struct TxPoolArgs {
#[arg(long = "txpool.max_tx_input_bytes", default_value_t = DEFAULT_MAX_TX_INPUT_BYTES)] #[arg(long = "txpool.max_tx_input_bytes", default_value_t = DEFAULT_MAX_TX_INPUT_BYTES)]
pub max_tx_input_bytes: usize, pub max_tx_input_bytes: usize,
/// The maximum number of blobs to keep in the in memory blob cache.
#[arg(long = "txpool.max_cached_entries", default_value_t = DEFAULT_MAX_CACHED_BLOBS)]
pub max_cached_entries: u32,
/// Flag to disable local transaction exemptions. /// Flag to disable local transaction exemptions.
#[arg(long = "txpool.nolocals")] #[arg(long = "txpool.nolocals")]
pub no_locals: bool, pub no_locals: bool,
@ -73,6 +78,7 @@ impl Default for TxPoolArgs {
price_bump: DEFAULT_PRICE_BUMP, price_bump: DEFAULT_PRICE_BUMP,
blob_transaction_price_bump: REPLACE_BLOB_PRICE_BUMP, blob_transaction_price_bump: REPLACE_BLOB_PRICE_BUMP,
max_tx_input_bytes: DEFAULT_MAX_TX_INPUT_BYTES, max_tx_input_bytes: DEFAULT_MAX_TX_INPUT_BYTES,
max_cached_entries: DEFAULT_MAX_CACHED_BLOBS,
no_locals: false, no_locals: false,
locals: Default::default(), locals: Default::default(),
no_local_transactions_propagation: false, no_local_transactions_propagation: false,

View File

@ -63,8 +63,8 @@ use reth_stages::{
}; };
use reth_tasks::TaskExecutor; use reth_tasks::TaskExecutor;
use reth_transaction_pool::{ use reth_transaction_pool::{
blobstore::DiskFileBlobStore, EthTransactionPool, TransactionPool, blobstore::{DiskFileBlobStore, DiskFileBlobStoreConfig},
TransactionValidationTaskExecutor, EthTransactionPool, TransactionPool, TransactionValidationTaskExecutor,
}; };
use revm_inspectors::stack::Hook; use revm_inspectors::stack::Hook;
use secp256k1::SecretKey; use secp256k1::SecretKey;
@ -467,7 +467,11 @@ impl NodeConfig {
+ Clone + Clone
+ 'static, + 'static,
{ {
let blob_store = DiskFileBlobStore::open(data_dir.blobstore_path(), Default::default())?; let blob_store = DiskFileBlobStore::open(
data_dir.blobstore_path(),
DiskFileBlobStoreConfig::default()
.with_max_cached_entries(self.txpool.max_cached_entries),
)?;
let validator = TransactionValidationTaskExecutor::eth_builder(Arc::clone(&self.chain)) let validator = TransactionValidationTaskExecutor::eth_builder(Arc::clone(&self.chain))
.with_head_timestamp(head.timestamp) .with_head_timestamp(head.timestamp)
.kzg_settings(self.kzg_settings()?) .kzg_settings(self.kzg_settings()?)

View File

@ -400,6 +400,14 @@ impl Default for DiskFileBlobStoreConfig {
} }
} }
impl DiskFileBlobStoreConfig {
/// Set maximum number of blobs to keep in the in memory blob cache.
pub const fn with_max_cached_entries(mut self, max_cached_entries: u32) -> Self {
self.max_cached_entries = max_cached_entries;
self
}
}
/// How to open a disk file blob store. /// How to open a disk file blob store.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum OpenDiskFileBlobStore { pub enum OpenDiskFileBlobStore {