chore: expose TransactionFetcher param in cli (#10635)

This commit is contained in:
Roy
2024-09-01 01:34:38 +05:30
committed by GitHub
parent 3a49a552c7
commit 7269cf2853
11 changed files with 66 additions and 4 deletions

View File

@ -221,6 +221,11 @@ Networking:
[default: 131072] [default: 131072]
--max-tx-pending-fetch <COUNT>
Max capacity of cache of hashes for transactions pending fetch.
[default: 25600]
--to <TO> --to <TO>
The maximum block height The maximum block height

View File

@ -221,6 +221,11 @@ Networking:
[default: 131072] [default: 131072]
--max-tx-pending-fetch <COUNT>
Max capacity of cache of hashes for transactions pending fetch.
[default: 25600]
--retries <RETRIES> --retries <RETRIES>
The number of retries per request The number of retries per request

View File

@ -221,6 +221,11 @@ Networking:
[default: 131072] [default: 131072]
--max-tx-pending-fetch <COUNT>
Max capacity of cache of hashes for transactions pending fetch.
[default: 25600]
--retries <RETRIES> --retries <RETRIES>
The number of retries per request The number of retries per request

View File

@ -221,6 +221,11 @@ Networking:
[default: 131072] [default: 131072]
--max-tx-pending-fetch <COUNT>
Max capacity of cache of hashes for transactions pending fetch.
[default: 25600]
--engine-api-store <PATH> --engine-api-store <PATH>
The path to read engine API messages from The path to read engine API messages from

View File

@ -213,6 +213,11 @@ Networking:
[default: 131072] [default: 131072]
--max-tx-pending-fetch <COUNT>
Max capacity of cache of hashes for transactions pending fetch.
[default: 25600]
RPC: RPC:
--http --http
Enable the HTTP-RPC server Enable the HTTP-RPC server

View File

@ -198,6 +198,11 @@ Networking:
[default: 131072] [default: 131072]
--max-tx-pending-fetch <COUNT>
Max capacity of cache of hashes for transactions pending fetch.
[default: 25600]
Datadir: Datadir:
--datadir <DATA_DIR> --datadir <DATA_DIR>
The path to the data dir for all reth files and subdirectories. The path to the data dir for all reth files and subdirectories.

View File

@ -264,6 +264,11 @@ Networking:
[default: 131072] [default: 131072]
--max-tx-pending-fetch <COUNT>
Max capacity of cache of hashes for transactions pending fetch.
[default: 25600]
Logging: Logging:
--log.stdout.format <FORMAT> --log.stdout.format <FORMAT>
The format to use for logs written to stdout The format to use for logs written to stdout

View File

@ -226,6 +226,11 @@ Networking:
[default: 131072] [default: 131072]
--max-tx-pending-fetch <COUNT>
Max capacity of cache of hashes for transactions pending fetch.
[default: 25600]
--offline --offline
If this is enabled, then all stages except headers, bodies, and sender recovery will be unwound If this is enabled, then all stages except headers, bodies, and sender recovery will be unwound

View File

@ -6,7 +6,8 @@ use super::{
SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE, SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE,
}; };
use crate::transactions::constants::tx_fetcher::{ use crate::transactions::constants::tx_fetcher::{
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS, DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER, DEFAULT_MAX_CAPACITY_CACHE_PENDING_FETCH, DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS,
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER,
}; };
/// Configuration for managing transactions within the network. /// Configuration for managing transactions within the network.
@ -46,6 +47,11 @@ pub struct TransactionFetcherConfig {
/// [`PooledTransactions`](reth_eth_wire::PooledTransactions) response on packing a /// [`PooledTransactions`](reth_eth_wire::PooledTransactions) response on packing a
/// [`GetPooledTransactions`](reth_eth_wire::GetPooledTransactions) request with hashes. /// [`GetPooledTransactions`](reth_eth_wire::GetPooledTransactions) request with hashes.
pub soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize, pub soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize,
/// Max capacity of the cache of transaction hashes, for transactions that weren't yet fetched.
/// A transaction is pending fetch if its hash didn't fit into a
/// [`GetPooledTransactions`](reth_eth_wire::GetPooledTransactions) yet, or it wasn't returned
/// upon request to peers.
pub max_capacity_cache_txns_pending_fetch: u32,
} }
impl Default for TransactionFetcherConfig { impl Default for TransactionFetcherConfig {
@ -56,7 +62,8 @@ impl Default for TransactionFetcherConfig {
soft_limit_byte_size_pooled_transactions_response: soft_limit_byte_size_pooled_transactions_response:
SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE, SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE,
soft_limit_byte_size_pooled_transactions_response_on_pack_request: soft_limit_byte_size_pooled_transactions_response_on_pack_request:
DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ,
max_capacity_cache_txns_pending_fetch: DEFAULT_MAX_CAPACITY_CACHE_PENDING_FETCH,
} }
} }
} }

View File

@ -134,6 +134,8 @@ impl TransactionFetcher {
.metrics .metrics
.capacity_inflight_requests .capacity_inflight_requests
.increment(tx_fetcher.info.max_inflight_requests as u64); .increment(tx_fetcher.info.max_inflight_requests as u64);
tx_fetcher.info.max_capacity_cache_txns_pending_fetch =
config.max_capacity_cache_txns_pending_fetch;
tx_fetcher tx_fetcher
} }
@ -1291,6 +1293,10 @@ pub struct TransactionFetcherInfo {
/// Soft limit for the byte size of a [`PooledTransactions`] response, upon assembling the /// Soft limit for the byte size of a [`PooledTransactions`] response, upon assembling the
/// response. Spec'd at 2 MiB, but can be adjusted for research purpose. /// response. Spec'd at 2 MiB, but can be adjusted for research purpose.
pub soft_limit_byte_size_pooled_transactions_response: usize, pub soft_limit_byte_size_pooled_transactions_response: usize,
/// Max capacity of the cache of transaction hashes, for transactions that weren't yet fetched.
/// A transaction is pending fetch if its hash didn't fit into a [`GetPooledTransactions`] yet,
/// or it wasn't returned upon request to peers.
pub max_capacity_cache_txns_pending_fetch: u32,
} }
impl TransactionFetcherInfo { impl TransactionFetcherInfo {
@ -1299,11 +1305,13 @@ impl TransactionFetcherInfo {
max_inflight_requests: usize, max_inflight_requests: usize,
soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize, soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize,
soft_limit_byte_size_pooled_transactions_response: usize, soft_limit_byte_size_pooled_transactions_response: usize,
max_capacity_cache_txns_pending_fetch: u32,
) -> Self { ) -> Self {
Self { Self {
max_inflight_requests, max_inflight_requests,
soft_limit_byte_size_pooled_transactions_response_on_pack_request, soft_limit_byte_size_pooled_transactions_response_on_pack_request,
soft_limit_byte_size_pooled_transactions_response, soft_limit_byte_size_pooled_transactions_response,
max_capacity_cache_txns_pending_fetch,
} }
} }
} }
@ -1313,7 +1321,8 @@ impl Default for TransactionFetcherInfo {
Self::new( Self::new(
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS as usize * DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER as usize, DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS as usize * DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER as usize,
DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ, DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ,
SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESPONSE,
DEFAULT_MAX_CAPACITY_CACHE_PENDING_FETCH,
) )
} }
} }

View File

@ -20,7 +20,7 @@ use reth_network::{
transactions::{ transactions::{
constants::{ constants::{
tx_fetcher::{ tx_fetcher::{
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS, DEFAULT_MAX_CAPACITY_CACHE_PENDING_FETCH, DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS,
DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER, DEFAULT_MAX_COUNT_CONCURRENT_REQUESTS_PER_PEER,
}, },
tx_manager::{ tx_manager::{
@ -144,6 +144,10 @@ pub struct NetworkArgs {
/// Default is 128 KiB. /// Default is 128 KiB.
#[arg(long = "pooled-tx-pack-soft-limit", value_name = "BYTES", default_value_t = DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ, verbatim_doc_comment)] #[arg(long = "pooled-tx-pack-soft-limit", value_name = "BYTES", default_value_t = DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ, verbatim_doc_comment)]
pub soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize, pub soft_limit_byte_size_pooled_transactions_response_on_pack_request: usize,
/// Max capacity of cache of hashes for transactions pending fetch.
#[arg(long = "max-tx-pending-fetch", value_name = "COUNT", default_value_t = DEFAULT_MAX_CAPACITY_CACHE_PENDING_FETCH, verbatim_doc_comment)]
pub max_capacity_cache_txns_pending_fetch: u32,
} }
impl NetworkArgs { impl NetworkArgs {
@ -191,6 +195,7 @@ impl NetworkArgs {
self.max_concurrent_tx_requests_per_peer, self.max_concurrent_tx_requests_per_peer,
self.soft_limit_byte_size_pooled_transactions_response, self.soft_limit_byte_size_pooled_transactions_response,
self.soft_limit_byte_size_pooled_transactions_response_on_pack_request, self.soft_limit_byte_size_pooled_transactions_response_on_pack_request,
self.max_capacity_cache_txns_pending_fetch,
), ),
max_transactions_seen_by_peer_history: self.max_seen_tx_history, max_transactions_seen_by_peer_history: self.max_seen_tx_history,
}; };
@ -297,6 +302,7 @@ impl Default for NetworkArgs {
soft_limit_byte_size_pooled_transactions_response_on_pack_request: DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ, soft_limit_byte_size_pooled_transactions_response_on_pack_request: DEFAULT_SOFT_LIMIT_BYTE_SIZE_POOLED_TRANSACTIONS_RESP_ON_PACK_GET_POOLED_TRANSACTIONS_REQ,
max_pending_pool_imports: DEFAULT_MAX_COUNT_PENDING_POOL_IMPORTS, max_pending_pool_imports: DEFAULT_MAX_COUNT_PENDING_POOL_IMPORTS,
max_seen_tx_history: DEFAULT_MAX_COUNT_TRANSACTIONS_SEEN_BY_PEER, max_seen_tx_history: DEFAULT_MAX_COUNT_TRANSACTIONS_SEEN_BY_PEER,
max_capacity_cache_txns_pending_fetch: DEFAULT_MAX_CAPACITY_CACHE_PENDING_FETCH,
} }
} }
} }