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

decrease default tracing permits #7010

Merged
merged 5 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/node-core/src/args/rpc_server_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub struct RpcServerArgs {
pub rpc_max_connections: MaxU32,

/// Maximum number of concurrent tracing requests.
#[arg(long, value_name = "COUNT", default_value_t = constants::DEFAULT_MAX_TRACING_REQUESTS)]
#[arg(long, value_name = "COUNT", default_value_t = *constants::DEFAULT_MAX_TRACING_REQUESTS)]
pub rpc_max_tracing_requests: u32,

/// Maximum number of blocks that could be scanned per filter request. (0 = entire chain)
Expand Down Expand Up @@ -499,7 +499,7 @@ impl Default for RpcServerArgs {
rpc_max_response_size: RPC_DEFAULT_MAX_RESPONSE_SIZE_MB.into(),
rpc_max_subscriptions_per_connection: RPC_DEFAULT_MAX_SUBS_PER_CONN.into(),
rpc_max_connections: RPC_DEFAULT_MAX_CONNECTIONS.into(),
rpc_max_tracing_requests: constants::DEFAULT_MAX_TRACING_REQUESTS,
rpc_max_tracing_requests: *constants::DEFAULT_MAX_TRACING_REQUESTS,
rpc_max_blocks_per_filter: constants::DEFAULT_MAX_BLOCKS_PER_FILTER.into(),
rpc_max_logs_per_response: (constants::DEFAULT_MAX_LOGS_PER_RESPONSE as u64).into(),
rpc_gas_cap: RPC_DEFAULT_GAS_CAP.into(),
Expand Down
1 change: 1 addition & 0 deletions crates/rpc/rpc-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ strum = { workspace = true, features = ["derive"] }
serde = { workspace = true, features = ["derive"] }
thiserror.workspace = true
tracing.workspace = true
once_cell.workspace = true

[dev-dependencies]
reth-beacon-consensus.workspace = true
Expand Down
5 changes: 4 additions & 1 deletion crates/rpc/rpc-builder/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use once_cell::sync::Lazy;
/// GPO reexports
pub use reth_rpc::eth::gas_oracle::{
DEFAULT_GAS_PRICE_BLOCKS, DEFAULT_GAS_PRICE_PERCENTILE, DEFAULT_IGNORE_GAS_PRICE,
DEFAULT_MAX_GAS_PRICE,
};
use std::cmp::max;

/// The default port for the http server
pub const DEFAULT_HTTP_RPC_PORT: u16 = 8545;
Expand All @@ -20,7 +22,8 @@ pub const DEFAULT_MAX_BLOCKS_PER_FILTER: u64 = 100_000;
pub const DEFAULT_MAX_LOGS_PER_RESPONSE: usize = 20_000;

/// The default maximum number of concurrently executed tracing calls
pub const DEFAULT_MAX_TRACING_REQUESTS: u32 = 25;
pub static DEFAULT_MAX_TRACING_REQUESTS: Lazy<u32> =
Lazy::new(|| (max(std::thread::available_parallelism().unwrap().into(), 4) - 2) as u32);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a function instead


/// The default IPC endpoint
#[cfg(windows)]
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-builder/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Default for EthConfig {
Self {
cache: EthStateCacheConfig::default(),
gas_oracle: GasPriceOracleConfig::default(),
max_tracing_requests: DEFAULT_MAX_TRACING_REQUESTS,
max_tracing_requests: *DEFAULT_MAX_TRACING_REQUESTS,
max_blocks_per_filter: DEFAULT_MAX_BLOCKS_PER_FILTER,
max_logs_per_response: DEFAULT_MAX_LOGS_PER_RESPONSE,
rpc_gas_cap: RPC_DEFAULT_GAS_CAP.into(),
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-inspector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Run with
//!
//! ```not_rust
//! cargo run --release -p custom-inspector --node --http --ws --recipients 0x....,0x....
//! cargo run --release -p custom-inspector -- node --http --ws --recipients 0x....,0x....
//! ```
//!
//! If no recipients are specified, all transactions will be inspected.
Expand Down
Loading