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

@ -348,6 +348,11 @@ TxPool:
[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
Flag to disable local transaction exemptions

View File

@ -4,8 +4,9 @@ use crate::cli::config::RethTransactionPoolConfig;
use clap::Args;
use reth_primitives::Address;
use reth_transaction_pool::{
validate::DEFAULT_MAX_TX_INPUT_BYTES, LocalTransactionConfig, PoolConfig, PriceBumpConfig,
SubPoolLimit, DEFAULT_PRICE_BUMP, REPLACE_BLOB_PRICE_BUMP, TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER,
blobstore::disk::DEFAULT_MAX_CACHED_BLOBS, validate::DEFAULT_MAX_TX_INPUT_BYTES,
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,
};
/// 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)]
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.
#[arg(long = "txpool.nolocals")]
pub no_locals: bool,
@ -73,6 +78,7 @@ impl Default for TxPoolArgs {
price_bump: DEFAULT_PRICE_BUMP,
blob_transaction_price_bump: REPLACE_BLOB_PRICE_BUMP,
max_tx_input_bytes: DEFAULT_MAX_TX_INPUT_BYTES,
max_cached_entries: DEFAULT_MAX_CACHED_BLOBS,
no_locals: false,
locals: Default::default(),
no_local_transactions_propagation: false,

View File

@ -63,8 +63,8 @@ use reth_stages::{
};
use reth_tasks::TaskExecutor;
use reth_transaction_pool::{
blobstore::DiskFileBlobStore, EthTransactionPool, TransactionPool,
TransactionValidationTaskExecutor,
blobstore::{DiskFileBlobStore, DiskFileBlobStoreConfig},
EthTransactionPool, TransactionPool, TransactionValidationTaskExecutor,
};
use revm_inspectors::stack::Hook;
use secp256k1::SecretKey;
@ -467,7 +467,11 @@ impl NodeConfig {
+ Clone
+ '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))
.with_head_timestamp(head.timestamp)
.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.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum OpenDiskFileBlobStore {