chore(net): expose max concurrent GetPooledTransactions reqs in cli (#10358)

This commit is contained in:
Emilia Hane
2024-08-22 14:31:57 +02:00
committed by GitHub
parent f2e0bc073a
commit 15810108e8
10 changed files with 160 additions and 46 deletions

View File

@ -177,18 +177,28 @@ Networking:
--max-inbound-peers <MAX_INBOUND_PEERS>
Maximum number of inbound requests. default: 30
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
--max-tx-reqs <COUNT>
Max concurrent `GetPooledTransactions` requests.
[default: 4096]
[default: 130]
--max-seen-tx-history <MAX_SEEN_TX_HISTORY>
--max-tx-reqs-peer <COUNT>
Max concurrent `GetPooledTransactions` requests per peer.
[default: 1]
--max-seen-tx-history <COUNT>
Max number of seen transactions to remember per peer.
Default is 320 transaction hashes.
[default: 320]
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
[default: 4096]
--pooled-tx-response-soft-limit <BYTES>
Experimental, for usage in research. Sets the max accumulated byte size of transactions
to pack in one response.

View File

@ -177,18 +177,28 @@ Networking:
--max-inbound-peers <MAX_INBOUND_PEERS>
Maximum number of inbound requests. default: 30
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
--max-tx-reqs <COUNT>
Max concurrent `GetPooledTransactions` requests.
[default: 4096]
[default: 130]
--max-seen-tx-history <MAX_SEEN_TX_HISTORY>
--max-tx-reqs-peer <COUNT>
Max concurrent `GetPooledTransactions` requests per peer.
[default: 1]
--max-seen-tx-history <COUNT>
Max number of seen transactions to remember per peer.
Default is 320 transaction hashes.
[default: 320]
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
[default: 4096]
--pooled-tx-response-soft-limit <BYTES>
Experimental, for usage in research. Sets the max accumulated byte size of transactions
to pack in one response.

View File

@ -177,18 +177,28 @@ Networking:
--max-inbound-peers <MAX_INBOUND_PEERS>
Maximum number of inbound requests. default: 30
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
--max-tx-reqs <COUNT>
Max concurrent `GetPooledTransactions` requests.
[default: 4096]
[default: 130]
--max-seen-tx-history <MAX_SEEN_TX_HISTORY>
--max-tx-reqs-peer <COUNT>
Max concurrent `GetPooledTransactions` requests per peer.
[default: 1]
--max-seen-tx-history <COUNT>
Max number of seen transactions to remember per peer.
Default is 320 transaction hashes.
[default: 320]
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
[default: 4096]
--pooled-tx-response-soft-limit <BYTES>
Experimental, for usage in research. Sets the max accumulated byte size of transactions
to pack in one response.

View File

@ -177,18 +177,28 @@ Networking:
--max-inbound-peers <MAX_INBOUND_PEERS>
Maximum number of inbound requests. default: 30
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
--max-tx-reqs <COUNT>
Max concurrent `GetPooledTransactions` requests.
[default: 4096]
[default: 130]
--max-seen-tx-history <MAX_SEEN_TX_HISTORY>
--max-tx-reqs-peer <COUNT>
Max concurrent `GetPooledTransactions` requests per peer.
[default: 1]
--max-seen-tx-history <COUNT>
Max number of seen transactions to remember per peer.
Default is 320 transaction hashes.
[default: 320]
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
[default: 4096]
--pooled-tx-response-soft-limit <BYTES>
Experimental, for usage in research. Sets the max accumulated byte size of transactions
to pack in one response.

18
book/cli/reth/node.md vendored
View File

@ -169,18 +169,28 @@ Networking:
--max-inbound-peers <MAX_INBOUND_PEERS>
Maximum number of inbound requests. default: 30
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
--max-tx-reqs <COUNT>
Max concurrent `GetPooledTransactions` requests.
[default: 4096]
[default: 130]
--max-seen-tx-history <MAX_SEEN_TX_HISTORY>
--max-tx-reqs-peer <COUNT>
Max concurrent `GetPooledTransactions` requests per peer.
[default: 1]
--max-seen-tx-history <COUNT>
Max number of seen transactions to remember per peer.
Default is 320 transaction hashes.
[default: 320]
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
[default: 4096]
--pooled-tx-response-soft-limit <BYTES>
Experimental, for usage in research. Sets the max accumulated byte size of transactions
to pack in one response.

18
book/cli/reth/p2p.md vendored
View File

@ -154,18 +154,28 @@ Networking:
--max-inbound-peers <MAX_INBOUND_PEERS>
Maximum number of inbound requests. default: 30
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
--max-tx-reqs <COUNT>
Max concurrent `GetPooledTransactions` requests.
[default: 4096]
[default: 130]
--max-seen-tx-history <MAX_SEEN_TX_HISTORY>
--max-tx-reqs-peer <COUNT>
Max concurrent `GetPooledTransactions` requests per peer.
[default: 1]
--max-seen-tx-history <COUNT>
Max number of seen transactions to remember per peer.
Default is 320 transaction hashes.
[default: 320]
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
[default: 4096]
--pooled-tx-response-soft-limit <BYTES>
Experimental, for usage in research. Sets the max accumulated byte size of transactions
to pack in one response.

View File

@ -220,18 +220,28 @@ Networking:
--max-inbound-peers <MAX_INBOUND_PEERS>
Maximum number of inbound requests. default: 30
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
--max-tx-reqs <COUNT>
Max concurrent `GetPooledTransactions` requests.
[default: 4096]
[default: 130]
--max-seen-tx-history <MAX_SEEN_TX_HISTORY>
--max-tx-reqs-peer <COUNT>
Max concurrent `GetPooledTransactions` requests per peer.
[default: 1]
--max-seen-tx-history <COUNT>
Max number of seen transactions to remember per peer.
Default is 320 transaction hashes.
[default: 320]
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
[default: 4096]
--pooled-tx-response-soft-limit <BYTES>
Experimental, for usage in research. Sets the max accumulated byte size of transactions
to pack in one response.

View File

@ -182,18 +182,28 @@ Networking:
--max-inbound-peers <MAX_INBOUND_PEERS>
Maximum number of inbound requests. default: 30
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
--max-tx-reqs <COUNT>
Max concurrent `GetPooledTransactions` requests.
[default: 4096]
[default: 130]
--max-seen-tx-history <MAX_SEEN_TX_HISTORY>
--max-tx-reqs-peer <COUNT>
Max concurrent `GetPooledTransactions` requests per peer.
[default: 1]
--max-seen-tx-history <COUNT>
Max number of seen transactions to remember per peer.
Default is 320 transaction hashes.
[default: 320]
--max-pending-imports <COUNT>
Max number of transactions to import concurrently.
[default: 4096]
--pooled-tx-response-soft-limit <BYTES>
Experimental, for usage in research. Sets the max accumulated byte size of transactions
to pack in one response.

View File

@ -5,6 +5,9 @@ use super::{
DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ,
SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE,
};
use crate::transactions::constants::tx_fetcher::{
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS, DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER,
};
/// Configuration for managing transactions within the network.
#[derive(Debug, Clone)]
@ -29,6 +32,11 @@ impl Default for TransactionsManagerConfig {
#[derive(Debug, Constructor, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct TransactionFetcherConfig {
/// Max inflight [`GetPooledTransactions`](reth_eth_wire::GetPooledTransactions) requests.
pub max_inflight_requests: u32,
/// Max inflight [`GetPooledTransactions`](reth_eth_wire::GetPooledTransactions) requests per
/// peer.
pub max_inflight_requests_per_peer: u8,
/// Soft limit for the byte size of a
/// [`PooledTransactions`](reth_eth_wire::PooledTransactions) response on assembling a
/// [`GetPooledTransactions`](reth_eth_wire::GetPooledTransactions) request. Spec'd at 2
@ -42,7 +50,13 @@ pub struct TransactionFetcherConfig {
impl Default for TransactionFetcherConfig {
fn default() -> Self {
Self { soft_limit_byte_size_pooled_transactions_response: SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE, soft_limit_byte_size_pooled_transactions_response_on_pack_request: DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ
Self {
max_inflight_requests: DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS,
max_inflight_requests_per_peer: DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER,
soft_limit_byte_size_pooled_transactions_response:
SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE,
soft_limit_byte_size_pooled_transactions_response_on_pack_request:
DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ
}
}
}

View File

@ -1,6 +1,12 @@
//! clap [Args](clap::Args) for network related arguments.
use crate::version::P2P_CLIENT_VERSION;
use std::{
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
ops::Not,
path::PathBuf,
sync::Arc,
};
use clap::Args;
use reth_chainspec::ChainSpec;
use reth_config::Config;
@ -12,8 +18,14 @@ use reth_discv5::{
use reth_net_nat::NatResolver;
use reth_network::{
transactions::{
constants::tx_manager::{
DEFAULT_MAX_COUNT_PENDING_POOL_IMPORTS, DEFAULT_MAX_COUNT_TRANSACTIONS_SEEN_BY_PEER,
constants::{
tx_fetcher::{
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS,
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER,
},
tx_manager::{
DEFAULT_MAX_COUNT_PENDING_POOL_IMPORTS, DEFAULT_MAX_COUNT_TRANSACTIONS_SEEN_BY_PEER,
},
},
TransactionFetcherConfig, TransactionsManagerConfig,
DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ,
@ -23,12 +35,8 @@ use reth_network::{
};
use reth_network_peers::{mainnet_nodes, TrustedPeer};
use secp256k1::SecretKey;
use std::{
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
ops::Not,
path::PathBuf,
sync::Arc,
};
use crate::version::P2P_CLIENT_VERSION;
/// Parameters for configuring the network more granularity via CLI
#[derive(Debug, Clone, Args, PartialEq, Eq)]
@ -99,16 +107,24 @@ pub struct NetworkArgs {
#[arg(long)]
pub max_inbound_peers: Option<usize>,
#[arg(long = "max-pending-imports", value_name = "COUNT", default_value_t = DEFAULT_MAX_COUNT_PENDING_POOL_IMPORTS, verbatim_doc_comment)]
/// Max number of transactions to import concurrently.
pub max_pending_pool_imports: usize,
/// Max concurrent `GetPooledTransactions` requests.
#[arg(long = "max-tx-reqs", value_name = "COUNT", default_value_t = DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS, verbatim_doc_comment)]
pub max_concurrent_tx_requests: u32,
/// Max concurrent `GetPooledTransactions` requests per peer.
#[arg(long = "max-tx-reqs-peer", value_name = "COUNT", default_value_t = DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER, verbatim_doc_comment)]
pub max_concurrent_tx_requests_per_peer: u8,
/// Max number of seen transactions to remember per peer.
///
/// Default is 320 transaction hashes.
#[arg(long = "max-seen-tx-history", value_name = "MAX_SEEN_TX_HISTORY", default_value_t = DEFAULT_MAX_COUNT_TRANSACTIONS_SEEN_BY_PEER, verbatim_doc_comment)]
#[arg(long = "max-seen-tx-history", value_name = "COUNT", default_value_t = DEFAULT_MAX_COUNT_TRANSACTIONS_SEEN_BY_PEER, verbatim_doc_comment)]
pub max_seen_tx_history: u32,
#[arg(long = "max-pending-imports", value_name = "COUNT", default_value_t = DEFAULT_MAX_COUNT_PENDING_POOL_IMPORTS, verbatim_doc_comment)]
/// Max number of transactions to import concurrently.
pub max_pending_pool_imports: usize,
/// Experimental, for usage in research. Sets the max accumulated byte size of transactions
/// to pack in one response.
/// Spec'd at 2MiB.
@ -171,6 +187,8 @@ impl NetworkArgs {
// Configure transactions manager
let transactions_manager_config = TransactionsManagerConfig {
transaction_fetcher_config: TransactionFetcherConfig::new(
self.max_concurrent_tx_requests,
self.max_concurrent_tx_requests_per_peer,
self.soft_limit_byte_size_pooled_transactions_response,
self.soft_limit_byte_size_pooled_transactions_response_on_pack_request,
),
@ -272,6 +290,8 @@ impl Default for NetworkArgs {
port: DEFAULT_DISCOVERY_PORT,
max_outbound_peers: None,
max_inbound_peers: None,
max_concurrent_tx_requests: DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS,
max_concurrent_tx_requests_per_peer: DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER,
soft_limit_byte_size_pooled_transactions_response:
SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE,
soft_limit_byte_size_pooled_transactions_response_on_pack_request: DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ,