Skip to content

Commit

Permalink
chore: simplify clap next heading and use clap attribute (#5507)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 20, 2023
1 parent efe4964 commit 59251f0
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion bin/reth/src/args/database_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use reth_interfaces::db::LogLevel;

/// Parameters for database configuration
#[derive(Debug, Args, PartialEq, Default, Clone, Copy)]
#[command(next_help_heading = "Database")]
#[clap(next_help_heading = "Database")]
pub struct DatabaseArgs {
/// Database logging level. Levels higher than "notice" require a debug build.
#[arg(long = "db.log-level", value_enum)]
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/args/debug_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use reth_primitives::{TxHash, B256};

/// Parameters for debugging purposes
#[derive(Debug, Args, PartialEq, Default)]
#[command(next_help_heading = "Debug")]
#[clap(next_help_heading = "Debug")]
pub struct DebugArgs {
/// Prompt the downloader to download blocks one at a time.
///
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/args/dev_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use humantime::parse_duration;

/// Parameters for Dev testnet configuration
#[derive(Debug, Args, PartialEq, Default, Clone, Copy)]
#[command(next_help_heading = "Dev testnet")]
#[clap(next_help_heading = "Dev testnet")]
pub struct DevArgs {
/// Start the node in dev mode
///
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/args/gas_price_oracle_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use clap::Args;

/// Parameters to configure Gas Price Oracle
#[derive(Debug, Clone, Args, PartialEq, Eq, Default)]
#[command(next_help_heading = "Gas Price Oracle")]
#[clap(next_help_heading = "Gas Price Oracle")]
pub struct GasPriceOracleArgs {
/// Number of recent blocks to check for gas price
#[arg(long = "gpo.blocks", default_value = "20")]
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/args/network_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{net::Ipv4Addr, path::PathBuf, sync::Arc};

/// Parameters for configuring the network more granularity via CLI
#[derive(Debug, Args)]
#[command(next_help_heading = "Networking")]
#[clap(next_help_heading = "Networking")]
pub struct NetworkArgs {
/// Disable the discovery service.
#[command(flatten)]
Expand Down
16 changes: 6 additions & 10 deletions bin/reth/src/args/payload_builder_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,26 @@ use std::{borrow::Cow, ffi::OsStr, time::Duration};

/// Parameters for configuring the Payload Builder
#[derive(Debug, Args, PartialEq, Default)]
#[clap(next_help_heading = "Builder")]
pub struct PayloadBuilderArgs {
/// Block extra data set by the payload builder.
#[arg(long = "builder.extradata", help_heading = "Builder", value_parser=ExtradataValueParser::default(), default_value_t = default_extradata())]
#[arg(long = "builder.extradata", value_parser=ExtradataValueParser::default(), default_value_t = default_extradata())]
pub extradata: String,

/// Target gas ceiling for built blocks.
#[arg(
long = "builder.gaslimit",
help_heading = "Builder",
default_value = "30000000",
value_name = "GAS_LIMIT"
)]
#[arg(long = "builder.gaslimit", default_value = "30000000", value_name = "GAS_LIMIT")]
pub max_gas_limit: u64,

/// The interval at which the job should build a new payload after the last (in seconds).
#[arg(long = "builder.interval", help_heading = "Builder", value_parser = parse_duration_from_secs, default_value = "1", value_name = "SECONDS")]
#[arg(long = "builder.interval", value_parser = parse_duration_from_secs, default_value = "1", value_name = "SECONDS")]
pub interval: Duration,

/// The deadline for when the payload builder job should resolve.
#[arg(long = "builder.deadline", help_heading = "Builder", value_parser = parse_duration_from_secs, default_value = "12", value_name = "SECONDS")]
#[arg(long = "builder.deadline", value_parser = parse_duration_from_secs, default_value = "12", value_name = "SECONDS")]
pub deadline: Duration,

/// Maximum number of tasks to spawn for building a payload.
#[arg(long = "builder.max-tasks", help_heading = "Builder", default_value = "3", value_parser = RangedU64ValueParser::<usize>::new().range(1..))]
#[arg(long = "builder.max-tasks", default_value = "3", value_parser = RangedU64ValueParser::<usize>::new().range(1..))]
pub max_payload_tasks: usize,

/// By default the pending block equals the latest block
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/args/pruning_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::sync::Arc;

/// Parameters for pruning and full node
#[derive(Debug, Args, PartialEq, Default)]
#[command(next_help_heading = "Pruning")]
#[clap(next_help_heading = "Pruning")]
pub struct PruningArgs {
/// Run full node. Only the most recent [`MINIMUM_PRUNING_DISTANCE`] block states are stored.
/// This flag takes priority over pruning configuration in reth.toml.
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/args/rollup_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/// Parameters for rollup configuration
#[derive(Debug, clap::Args)]
#[command(next_help_heading = "Rollup")]
#[clap(next_help_heading = "Rollup")]
pub struct RollupArgs {
/// HTTP endpoint for the sequencer mempool
#[arg(long = "rollup.sequencer-http", value_name = "HTTP_URL")]
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/args/rpc_server_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub(crate) const RPC_DEFAULT_MAX_CONNECTIONS: u32 = 500;

/// Parameters for configuring the rpc more granularity via CLI
#[derive(Debug, Clone, Args)]
#[command(next_help_heading = "RPC")]
#[clap(next_help_heading = "RPC")]
pub struct RpcServerArgs {
/// Enable the HTTP-RPC server
#[arg(long, default_value_if("dev", "true", "true"))]
Expand Down
19 changes: 10 additions & 9 deletions bin/reth/src/args/txpool_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,39 @@ use reth_transaction_pool::{

/// Parameters for debugging purposes
#[derive(Debug, Args, PartialEq, Default)]
#[clap(next_help_heading = "TxPool")]
pub struct TxPoolArgs {
/// Max number of transaction in the pending sub-pool.
#[arg(long = "txpool.pending_max_count", help_heading = "TxPool", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)]
#[arg(long = "txpool.pending_max_count", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)]
pub pending_max_count: usize,
/// Max size of the pending sub-pool in megabytes.
#[arg(long = "txpool.pending_max_size", help_heading = "TxPool", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)]
#[arg(long = "txpool.pending_max_size", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)]
pub pending_max_size: usize,

/// Max number of transaction in the basefee sub-pool
#[arg(long = "txpool.basefee_max_count", help_heading = "TxPool", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)]
#[arg(long = "txpool.basefee_max_count", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)]
pub basefee_max_count: usize,
/// Max size of the basefee sub-pool in megabytes.
#[arg(long = "txpool.basefee_max_size", help_heading = "TxPool", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)]
#[arg(long = "txpool.basefee_max_size", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)]
pub basefee_max_size: usize,

/// Max number of transaction in the queued sub-pool
#[arg(long = "txpool.queued_max_count", help_heading = "TxPool", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)]
#[arg(long = "txpool.queued_max_count", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)]
pub queued_max_count: usize,
/// Max size of the queued sub-pool in megabytes.
#[arg(long = "txpool.queued_max_size", help_heading = "TxPool", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)]
#[arg(long = "txpool.queued_max_size", default_value_t = TXPOOL_SUBPOOL_MAX_SIZE_MB_DEFAULT)]
pub queued_max_size: usize,

/// Max number of executable transaction slots guaranteed per account
#[arg(long = "txpool.max_account_slots", help_heading = "TxPool", default_value_t = TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER)]
#[arg(long = "txpool.max_account_slots", default_value_t = TXPOOL_MAX_ACCOUNT_SLOTS_PER_SENDER)]
pub max_account_slots: usize,

/// Price bump (in %) for the transaction pool underpriced check.
#[arg(long = "txpool.pricebump", help_heading = "TxPool", default_value_t = DEFAULT_PRICE_BUMP)]
#[arg(long = "txpool.pricebump", default_value_t = DEFAULT_PRICE_BUMP)]
pub price_bump: u128,

/// Price bump percentage to replace an already existing blob transaction
#[arg(long = "blobpool.pricebump", help_heading = "TxPool", default_value_t = REPLACE_BLOB_PRICE_BUMP)]
#[arg(long = "blobpool.pricebump", default_value_t = REPLACE_BLOB_PRICE_BUMP)]
pub blob_transaction_price_bump: u128,
}

Expand Down

0 comments on commit 59251f0

Please sign in to comment.