Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make additional validation tasks size configurable #10200

Merged
merged 5 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions book/cli/reth/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ TxPool:
--txpool.no-local-transactions-propagation
Flag to toggle local transaction propagation

--txpool.additional-validation-tasks <ADDITIONAL_VALIDATION_TASKS>
Number of additional transaction validation tasks to spawn

[default: 1]

Builder:
--builder.extradata <EXTRADATA>
Block extra data set by the payload builder
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ where
.with_head_timestamp(ctx.head().timestamp)
.kzg_settings(ctx.kzg_settings()?)
.with_local_transactions_config(pool_config.local_transactions_config.clone())
.with_additional_tasks(1)
.with_additional_tasks(ctx.config().txpool.additional_validation_tasks)
.build_with_tasks(
ctx.provider().clone(),
ctx.task_executor().clone(),
Expand Down
9 changes: 7 additions & 2 deletions crates/node/core/src/args/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ use reth_primitives::Address;
use reth_transaction_pool::{
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,
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,
};
/// Parameters for debugging purposes
#[derive(Debug, Clone, Args, PartialEq, Eq)]
Expand Down Expand Up @@ -63,6 +64,9 @@ pub struct TxPoolArgs {
/// Flag to toggle local transaction propagation.
#[arg(long = "txpool.no-local-transactions-propagation")]
pub no_local_transactions_propagation: bool,
/// Number of additional transaction validation tasks to spawn.
#[arg(long = "txpool.additional-validation-tasks", alias = "txpool.additional_validation_tasks", default_value_t = DEFAULT_TXPOOL_ADDITIONAL_VALIDATION_TASKS)]
pub additional_validation_tasks: usize,
}

impl Default for TxPoolArgs {
Expand All @@ -82,6 +86,7 @@ impl Default for TxPoolArgs {
no_locals: false,
locals: Default::default(),
no_local_transactions_propagation: false,
additional_validation_tasks: DEFAULT_TXPOOL_ADDITIONAL_VALIDATION_TASKS,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/node/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ where
let validator = TransactionValidationTaskExecutor::eth_builder(ctx.chain_spec())
.with_head_timestamp(ctx.head().timestamp)
.kzg_settings(ctx.kzg_settings()?)
.with_additional_tasks(1)
.with_additional_tasks(ctx.config().txpool.additional_validation_tasks)
.build_with_tasks(
ctx.provider().clone(),
ctx.task_executor().clone(),
Expand Down
3 changes: 3 additions & 0 deletions crates/transaction-pool/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ pub const TXPOOL_SUBPOOL_MAX_TXS_DEFAULT: usize = 10_000;
/// The default maximum allowed size of the given subpool.
pub const TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT: usize = 20;

/// The default additional validation tasks size.
pub const DEFAULT_TXPOOL_ADDITIONAL_VALIDATION_TASKS: usize = 1;

/// Default price bump (in %) for the transaction pool underpriced check.
pub const DEFAULT_PRICE_BUMP: u128 = 10;

Expand Down
5 changes: 3 additions & 2 deletions crates/transaction-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ pub use crate::{
blobstore::{BlobStore, BlobStoreError},
config::{
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,
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,
},
error::PoolResult,
ordering::{CoinbaseTipOrdering, Priority, TransactionOrdering},
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-node-components/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ where
let validator = TransactionValidationTaskExecutor::eth_builder(ctx.chain_spec())
.with_head_timestamp(ctx.head().timestamp)
.kzg_settings(ctx.kzg_settings()?)
.with_additional_tasks(5)
.with_additional_tasks(ctx.config().txpool.additional_validation_tasks)
.build_with_tasks(
ctx.provider().clone(),
ctx.task_executor().clone(),
Expand Down
Loading