chore(cli): fix clap deprecated warnings (#6872)

Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
This commit is contained in:
DaniPopes
2024-02-29 15:24:13 +02:00
committed by GitHub
parent 6b5b6f7a40
commit 17818e79d4
35 changed files with 77 additions and 78 deletions

View File

@@ -32,7 +32,7 @@ pub use crate::core::cli::*;
#[command(author, version = SHORT_VERSION, long_version = LONG_VERSION, about = "Reth", long_about = None)]
pub struct Cli<Ext: RethCliExt = ()> {
/// The command to run
#[clap(subcommand)]
#[command(subcommand)]
command: Commands<Ext>,
/// The chain this node is running.
@@ -64,7 +64,7 @@ pub struct Cli<Ext: RethCliExt = ()> {
#[arg(long, value_name = "INSTANCE", global = true, default_value_t = 1, value_parser = value_parser!(u16).range(..=200))]
instance: u16,
#[clap(flatten)]
#[command(flatten)]
logs: LogArgs,
}

View File

@@ -31,7 +31,7 @@ pub struct Command {
secondary_datadir: PlatformPath<DataDirPath>,
/// Arguments for the second database
#[clap(flatten)]
#[command(flatten)]
second_db: DatabaseArgs,
/// The table name to diff. If not specified, all tables are diffed.

View File

@@ -12,7 +12,7 @@ use tracing::error;
/// The arguments for the `reth db get` command
#[derive(Parser, Debug)]
pub struct Command {
#[clap(subcommand)]
#[command(subcommand)]
subcommand: Subcommand,
}
@@ -31,7 +31,7 @@ enum Subcommand {
subkey: Option<String>,
/// Output bytes instead of human-readable decoded value
#[clap(long)]
#[arg(long)]
raw: bool,
},
/// Gets the content of a static file segment for the given key
@@ -43,7 +43,7 @@ enum Subcommand {
key: String,
/// Output bytes instead of human-readable decoded value
#[clap(long)]
#[arg(long)]
raw: bool,
},
}
@@ -209,7 +209,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -56,10 +56,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

View File

@@ -81,7 +81,7 @@ pub struct Command {
chain: Arc<ChainSpec>,
/// Database arguments.
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
/// Overrides the KZG trusted setup by reading from the supplied file.

View File

@@ -71,10 +71,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,
#[clap(flatten)]
#[command(flatten)]
network: NetworkArgs,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
/// The maximum block height.

View File

@@ -60,10 +60,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
#[clap(flatten)]
#[command(flatten)]
network: NetworkArgs,
/// The number of retries per request

View File

@@ -67,10 +67,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
#[clap(flatten)]
#[command(flatten)]
network: NetworkArgs,
/// The number of retries per request

View File

@@ -13,7 +13,7 @@ mod replay_engine;
/// `reth debug` command
#[derive(Debug, Parser)]
pub struct Command {
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

View File

@@ -68,10 +68,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
#[clap(flatten)]
#[command(flatten)]
network: NetworkArgs,
/// The path to read engine API messages from.

View File

@@ -61,7 +61,7 @@ pub struct ImportCommand {
)]
chain: Arc<ChainSpec>,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
/// The path to a block file for import.

View File

@@ -40,7 +40,7 @@ pub struct InitCommand {
)]
chain: Arc<ChainSpec>,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
}

View File

@@ -85,45 +85,44 @@ pub struct NodeCommand<Ext: RethCliExt = ()> {
pub trusted_setup_file: Option<PathBuf>,
/// All networking related arguments
#[clap(flatten)]
#[command(flatten)]
pub network: NetworkArgs,
/// All rpc related arguments
#[clap(flatten)]
#[command(flatten)]
pub rpc: RpcServerArgs,
/// All txpool related arguments with --txpool prefix
#[clap(flatten)]
#[command(flatten)]
pub txpool: TxPoolArgs,
/// All payload builder related arguments
#[clap(flatten)]
#[command(flatten)]
pub builder: PayloadBuilderArgs,
/// All debug related arguments with --debug prefix
#[clap(flatten)]
#[command(flatten)]
pub debug: DebugArgs,
/// All database related arguments
#[clap(flatten)]
#[command(flatten)]
pub db: DatabaseArgs,
/// All dev related arguments with --dev prefix
#[clap(flatten)]
#[command(flatten)]
pub dev: DevArgs,
/// All pruning related arguments
#[clap(flatten)]
#[command(flatten)]
pub pruning: PruningArgs,
/// Rollup related arguments
#[cfg(feature = "optimism")]
#[clap(flatten)]
#[command(flatten)]
pub rollup: crate::args::RollupArgs,
/// Additional cli arguments
#[clap(flatten)]
#[clap(next_help_heading = "Extension")]
#[command(flatten, next_help_heading = "Extension")]
pub ext: Ext::Node,
}

View File

@@ -73,10 +73,10 @@ pub struct Command {
#[arg(long, default_value = "any")]
nat: NatResolver,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

View File

@@ -8,7 +8,7 @@ mod storage_tries;
/// `reth recover` command
#[derive(Debug, Parser)]
pub struct Command {
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

View File

@@ -45,7 +45,7 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
stage: StageEnum,

View File

@@ -58,10 +58,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
#[clap(subcommand)]
#[command(subcommand)]
command: Stages,
}

View File

@@ -10,7 +10,7 @@ pub mod unwind;
/// `reth stage` command
#[derive(Debug, Parser)]
pub struct Command {
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

View File

@@ -63,7 +63,7 @@ pub struct Command {
/// Enable Prometheus metrics.
///
/// The metrics will be served at the given interface and port.
#[clap(long, value_name = "SOCKET")]
#[arg(long, value_name = "SOCKET")]
metrics: Option<SocketAddr>,
/// The name of the stage to run
@@ -90,10 +90,10 @@ pub struct Command {
#[arg(long, short)]
skip_unwind: bool,
#[clap(flatten)]
#[command(flatten)]
network: NetworkArgs,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
/// Commits the changes in the database. WARNING: potentially destructive.

View File

@@ -42,10 +42,10 @@ pub struct Command {
)]
chain: Arc<ChainSpec>,
#[clap(flatten)]
#[command(flatten)]
db: DatabaseArgs,
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}
@@ -87,10 +87,10 @@ impl Command {
#[derive(Subcommand, Debug, Eq, PartialEq)]
enum Subcommands {
/// Unwinds the database until the given block number (range is inclusive).
#[clap(name = "to-block")]
#[command(name = "to-block")]
ToBlock { target: BlockHashOrNumber },
/// Unwinds the given number of blocks from the database.
#[clap(name = "num-blocks")]
#[command(name = "num-blocks")]
NumBlocks { amount: u64 },
}

View File

@@ -7,7 +7,7 @@ mod tables;
/// Generate test-vectors for different data types.
#[derive(Debug, Parser)]
pub struct Command {
#[clap(subcommand)]
#[command(subcommand)]
command: Subcommands,
}

View File

@@ -5,7 +5,7 @@ use reth_interfaces::db::LogLevel;
/// Parameters for database configuration
#[derive(Debug, Args, PartialEq, Default, Clone, Copy)]
#[clap(next_help_heading = "Database")]
#[command(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)]
@@ -20,7 +20,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -6,7 +6,7 @@ use std::path::PathBuf;
/// Parameters for debugging purposes
#[derive(Debug, Clone, Args, PartialEq, Default)]
#[clap(next_help_heading = "Debug")]
#[command(next_help_heading = "Debug")]
pub struct DebugArgs {
/// Prompt the downloader to download blocks one at a time.
///
@@ -74,7 +74,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -7,7 +7,7 @@ use humantime::parse_duration;
/// Parameters for Dev testnet configuration
#[derive(Debug, Args, PartialEq, Default, Clone, Copy)]
#[clap(next_help_heading = "Dev testnet")]
#[command(next_help_heading = "Dev testnet")]
pub struct DevArgs {
/// Start the node in dev mode
///
@@ -49,7 +49,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -8,7 +8,7 @@ use reth_rpc_builder::constants::{
/// Parameters to configure Gas Price Oracle
#[derive(Debug, Clone, Copy, Args, PartialEq, Eq)]
#[clap(next_help_heading = "Gas Price Oracle")]
#[command(next_help_heading = "Gas Price Oracle")]
pub struct GasPriceOracleArgs {
/// Number of recent blocks to check for gas price
#[arg(long = "gpo.blocks", default_value_t = DEFAULT_GAS_PRICE_BLOCKS)]
@@ -59,7 +59,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -67,7 +67,7 @@ pub struct LogArgs {
)]
pub color: ColorMode,
/// The verbosity settings for the tracer.
#[clap(flatten)]
#[command(flatten)]
pub verbosity: Verbosity,
}
@@ -145,11 +145,11 @@ pub struct Verbosity {
/// -vvv Info
/// -vvvv Debug
/// -vvvvv Traces (warning: very verbose!)
#[clap(short, long, action = ArgAction::Count, global = true, default_value_t = 3, verbatim_doc_comment, help_heading = "Display")]
#[arg(short, long, action = ArgAction::Count, global = true, default_value_t = 3, verbatim_doc_comment, help_heading = "Display")]
verbosity: u8,
/// Silence all log output.
#[clap(long, alias = "silent", short = 'q', global = true, help_heading = "Display")]
#[arg(long, alias = "silent", short = 'q', global = true, help_heading = "Display")]
quiet: bool,
}

View File

@@ -19,7 +19,7 @@ use std::{net::Ipv4Addr, path::PathBuf, sync::Arc};
/// Parameters for configuring the network more granularity via CLI
#[derive(Debug, Clone, Args, PartialEq, Eq)]
#[clap(next_help_heading = "Networking")]
#[command(next_help_heading = "Networking")]
pub struct NetworkArgs {
/// Disable the discovery service.
#[command(flatten)]
@@ -211,11 +211,11 @@ pub struct DiscoveryArgs {
pub disable_discv4_discovery: bool,
/// The UDP address to use for P2P discovery/networking
#[arg(long = "discovery.addr", name = "discovery.addr", value_name = "DISCOVERY_ADDR", default_value_t = DEFAULT_DISCOVERY_ADDR)]
#[arg(id = "discovery.addr", long = "discovery.addr", value_name = "DISCOVERY_ADDR", default_value_t = DEFAULT_DISCOVERY_ADDR)]
pub addr: Ipv4Addr,
/// The UDP port to use for P2P discovery/networking
#[arg(long = "discovery.port", name = "discovery.port", value_name = "DISCOVERY_PORT", default_value_t = DEFAULT_DISCOVERY_PORT)]
#[arg(id = "discovery.port", long = "discovery.port", value_name = "DISCOVERY_PORT", default_value_t = DEFAULT_DISCOVERY_PORT)]
pub port: u16,
}
@@ -262,7 +262,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -13,7 +13,7 @@ use std::{borrow::Cow, ffi::OsStr, time::Duration};
/// Parameters for configuring the Payload Builder
#[derive(Debug, Clone, Args, PartialEq)]
#[clap(next_help_heading = "Builder")]
#[command(next_help_heading = "Builder")]
pub struct PayloadBuilderArgs {
/// Block extra data set by the payload builder.
#[arg(long = "builder.extradata", value_parser = ExtradataValueParser::default(), default_value_t = default_extradata())]
@@ -124,7 +124,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -9,7 +9,7 @@ use std::sync::Arc;
/// Parameters for pruning and full node
#[derive(Debug, Clone, Args, PartialEq, Default)]
#[clap(next_help_heading = "Pruning")]
#[command(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.
@@ -56,7 +56,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -2,7 +2,7 @@
/// Parameters for rollup configuration
#[derive(Debug, Clone, Default, PartialEq, Eq, clap::Args)]
#[clap(next_help_heading = "Rollup")]
#[command(next_help_heading = "Rollup")]
pub struct RollupArgs {
/// HTTP endpoint for the sequencer mempool
#[arg(long = "rollup.sequencer-http", value_name = "HTTP_URL")]
@@ -26,7 +26,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -61,7 +61,7 @@ pub(crate) const RPC_DEFAULT_MAX_CONNECTIONS: u32 = 500;
/// Parameters for configuring the rpc more granularity via CLI
#[derive(Debug, Clone, Args, PartialEq, Eq)]
#[clap(next_help_heading = "RPC")]
#[command(next_help_heading = "RPC")]
pub struct RpcServerArgs {
/// Enable the HTTP-RPC server
#[arg(long, default_value_if("dev", "true", "true"))]
@@ -96,7 +96,7 @@ pub struct RpcServerArgs {
pub ws_port: u16,
/// Origins from which to accept WebSocket requests
#[arg(long = "ws.origins", name = "ws.origins")]
#[arg(id = "ws.origins", long = "ws.origins")]
pub ws_allowed_origins: Option<String>,
/// Rpc Modules to be configured for the WS server
@@ -175,11 +175,11 @@ pub struct RpcServerArgs {
pub rpc_gas_cap: u64,
/// State cache configuration.
#[clap(flatten)]
#[command(flatten)]
pub rpc_state_cache: RpcStateCacheArgs,
/// Gas price oracle configuration.
#[clap(flatten)]
#[command(flatten)]
pub gas_price_oracle: GasPriceOracleArgs,
}
@@ -631,7 +631,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -6,7 +6,7 @@ use reth_rpc::eth::cache::{
/// Parameters to configure RPC state cache.
#[derive(Debug, Clone, Args, PartialEq, Eq)]
#[clap(next_help_heading = "RPC State Cache")]
#[command(next_help_heading = "RPC State Cache")]
pub struct RpcStateCacheArgs {
/// Max number of blocks in cache.

View File

@@ -11,7 +11,7 @@ use reth_transaction_pool::{
};
/// Parameters for debugging purposes
#[derive(Debug, Clone, Args, PartialEq)]
#[clap(next_help_heading = "TxPool")]
#[command(next_help_heading = "TxPool")]
pub struct TxPoolArgs {
/// Max number of transaction in the pending sub-pool.
#[arg(long = "txpool.pending_max_count", default_value_t = TXPOOL_SUBPOOL_MAX_TXS_DEFAULT)]
@@ -128,7 +128,7 @@ mod tests {
/// A helper type to parse Args more easily
#[derive(Parser)]
struct CommandParser<T: Args> {
#[clap(flatten)]
#[command(flatten)]
args: T,
}

View File

@@ -209,7 +209,7 @@ impl<Conf: RethNodeCommandConfig> RethCliExt for NoArgsCliExt<Conf> {
/// the reth node command.
#[derive(Debug, Clone, Copy, Default, Args)]
pub struct NoArgs<T = ()> {
#[clap(skip)]
#[arg(skip)]
inner: Option<T>,
}

View File

@@ -38,7 +38,7 @@ impl RethCliExt for MyRethCliExt {
#[derive(Debug, Clone, Copy, Default, clap::Args)]
struct RethCliTxpoolExt {
/// CLI flag to enable the txpool extension namespace
#[clap(long)]
#[arg(long)]
pub enable_ext: bool,
}