diff --git a/crates/iota-analytics-indexer/src/lib.rs b/crates/iota-analytics-indexer/src/lib.rs index b46ce94d72a..a778e4da270 100644 --- a/crates/iota-analytics-indexer/src/lib.rs +++ b/crates/iota-analytics-indexer/src/lib.rs @@ -65,56 +65,56 @@ const DYNAMIC_FIELD_PREFIX: &str = "dynamic_field"; const WRAPPED_OBJECT_PREFIX: &str = "wrapped_object"; #[derive(Parser, Clone, Debug)] -#[clap( +#[command( name = "IOTA Analytics Indexer", about = "Indexer service to upload data for the analytics pipeline.", rename_all = "kebab-case" )] pub struct AnalyticsIndexerConfig { /// The url of the checkpoint client to connect to. - #[clap(long)] + #[arg(long)] pub rest_url: String, /// The url of the metrics client to connect to. - #[clap(long, default_value = "127.0.0.1", global = true)] + #[arg(long, default_value = "127.0.0.1", global = true)] pub client_metric_host: String, /// The port of the metrics client to connect to. - #[clap(long, default_value = "8081", global = true)] + #[arg(long, default_value = "8081", global = true)] pub client_metric_port: u16, /// Directory to contain the temporary files for checkpoint entries. - #[clap(long, global = true, default_value = "/tmp")] + #[arg(long, global = true, default_value = "/tmp")] pub checkpoint_dir: PathBuf, /// Number of checkpoints to process before uploading to the datastore. - #[clap(long, default_value = "10000", global = true)] + #[arg(long, default_value = "10000", global = true)] pub checkpoint_interval: u64, /// Maximum file size in mb before uploading to the datastore. - #[clap(long, default_value = "100", global = true)] + #[arg(long, default_value = "100", global = true)] pub max_file_size_mb: u64, /// Checkpoint sequence number to start the download from - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub starting_checkpoint_seq_num: Option, /// Time to process in seconds before uploading to the datastore. - #[clap(long, default_value = "600", global = true)] + #[arg(long, default_value = "600", global = true)] pub time_interval_s: u64, // Remote object store where data gets written to #[command(flatten)] pub remote_store_config: ObjectStoreConfig, // Remote object store path prefix to use while writing - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub remote_store_path_prefix: Option, // File format to store data in i.e. csv, parquet, etc - #[clap(long, value_enum, default_value = "csv", global = true)] + #[arg(long, value_enum, default_value = "csv", global = true)] pub file_format: FileFormat, // Type of data to write i.e. checkpoint, object, transaction, etc - #[clap(long, value_enum, long, global = true)] + #[arg(long, value_enum, long, global = true)] pub file_type: FileType, - #[clap( + #[arg( long, default_value = "https://checkpoints.mainnet.iota.cafe", global = true )] pub remote_store_url: String, // Directory to contain the package cache for pipelines - #[clap( + #[arg( long, value_enum, long, @@ -122,37 +122,37 @@ pub struct AnalyticsIndexerConfig { default_value = "/opt/iota/db/package_cache" )] pub package_cache_path: PathBuf, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub bq_service_account_key_file: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub bq_project_id: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub bq_dataset_id: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub bq_table_id: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub bq_checkpoint_col_id: Option, - #[clap(long, global = true)] + #[arg(long, global = true)] pub report_bq_max_table_checkpoint: bool, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub sf_account_identifier: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub sf_warehouse: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub sf_database: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub sf_schema: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub sf_username: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub sf_role: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub sf_password: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub sf_table_id: Option, - #[clap(long, default_value = None, global = true)] + #[arg(long, default_value = None, global = true)] pub sf_checkpoint_col_id: Option, - #[clap(long, global = true)] + #[arg(long, global = true)] pub report_sf_max_table_checkpoint: bool, } diff --git a/crates/iota-aws-orchestrator/src/main.rs b/crates/iota-aws-orchestrator/src/main.rs index 7e1696c3ed9..91ff63896a1 100644 --- a/crates/iota-aws-orchestrator/src/main.rs +++ b/crates/iota-aws-orchestrator/src/main.rs @@ -39,7 +39,7 @@ pub struct Opts { /// The path to the settings file. This file contains basic information to /// deploy testbeds and run benchmarks such as the url of the git repo, /// the commit to deploy, etc. - #[clap( + #[arg( long, value_name = "FILE", default_value = "crates/iota-aws-orchestrator/assets/settings.json", @@ -48,7 +48,7 @@ pub struct Opts { settings_path: String, /// The type of operation to run. - #[clap(subcommand)] + #[command(subcommand)] operation: Operation, } @@ -56,7 +56,7 @@ pub struct Opts { pub enum Operation { /// Get or modify the status of the testbed. Testbed { - #[clap(subcommand)] + #[command(subcommand)] action: TestbedAction, }, @@ -64,79 +64,79 @@ pub enum Operation { Benchmark { /// Percentage of shared vs owned objects; 0 means only owned objects /// and 100 means only shared objects. - #[clap(long, default_value = "0", global = true)] + #[arg(long, default_value = "0", global = true)] benchmark_type: String, /// The committee size to deploy. - #[clap(long, value_name = "INT")] + #[arg(long, value_name = "INT")] committee: usize, /// Number of faulty nodes. - #[clap(long, value_name = "INT", default_value = "0", global = true)] + #[arg(long, value_name = "INT", default_value = "0", global = true)] faults: usize, /// Whether the faulty nodes recover. - #[clap(long, action, default_value = "false", global = true)] + #[arg(long, action, default_value = "false", global = true)] crash_recovery: bool, /// The interval to crash nodes in seconds. - #[clap(long, value_parser = parse_duration, default_value = "60", global = true)] + #[arg(long, value_parser = parse_duration, default_value = "60", global = true)] crash_interval: Duration, /// The minimum duration of the benchmark in seconds. - #[clap(long, value_parser = parse_duration, default_value = "600", global = true)] + #[arg(long, value_parser = parse_duration, default_value = "600", global = true)] duration: Duration, /// The interval between measurements collection in seconds. - #[clap(long, value_parser = parse_duration, default_value = "15", global = true)] + #[arg(long, value_parser = parse_duration, default_value = "15", global = true)] scrape_interval: Duration, /// Whether to skip testbed updates before running benchmarks. - #[clap(long, action, default_value = "false", global = true)] + #[arg(long, action, default_value = "false", global = true)] skip_testbed_update: bool, /// Whether to skip testbed configuration before running benchmarks. - #[clap(long, action, default_value = "false", global = true)] + #[arg(long, action, default_value = "false", global = true)] skip_testbed_configuration: bool, /// Whether to download and analyze the client and node log files. - #[clap(long, action, default_value = "false", global = true)] + #[arg(long, action, default_value = "false", global = true)] log_processing: bool, /// The number of instances running exclusively load generators. If set /// to zero the orchestrator collocates one load generator with /// each node. - #[clap(long, value_name = "INT", default_value = "0", global = true)] + #[arg(long, value_name = "INT", default_value = "0", global = true)] dedicated_clients: usize, /// Whether to forgo a grafana and prometheus instance and leave the /// testbed unmonitored. - #[clap(long, action, default_value = "false", global = true)] + #[arg(long, action, default_value = "false", global = true)] skip_monitoring: bool, /// The timeout duration for ssh commands (in seconds). - #[clap(long, action, value_parser = parse_duration, default_value = "30", global = true)] + #[arg(long, action, value_parser = parse_duration, default_value = "30", global = true)] timeout: Duration, /// The number of times the orchestrator should retry an ssh command. - #[clap(long, value_name = "INT", default_value = "5", global = true)] + #[arg(long, value_name = "INT", default_value = "5", global = true)] retries: usize, /// The load to submit to the system. - #[clap(subcommand)] + #[command(subcommand)] load_type: Load, }, /// Print a summary of the specified measurements collection. Summarize { /// The path to the settings file. - #[clap(long, value_name = "FILE")] + #[arg(long, value_name = "FILE")] path: String, }, } #[derive(Parser)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub enum TestbedAction { /// Display the testbed status. Status, @@ -145,13 +145,13 @@ pub enum TestbedAction { /// the setting file. Deploy { /// Number of instances to deploy. - #[clap(long)] + #[arg(long)] instances: usize, /// The region where to deploy the instances. If this parameter is not /// specified, the command deploys the specified number of /// instances in all regions listed in the setting file. - #[clap(long)] + #[arg(long)] region: Option, }, @@ -159,7 +159,7 @@ pub enum TestbedAction { /// existing testbed. Start { /// Number of instances to deploy. - #[clap(long, default_value = "200")] + #[arg(long, default_value = "200")] instances: usize, }, @@ -175,7 +175,7 @@ pub enum Load { /// The fixed loads (in tx/s) to submit to the nodes. FixedLoad { /// A list of fixed load (tx/s). - #[clap( + #[arg( long, value_name = "INT", num_args(1..), @@ -187,11 +187,11 @@ pub enum Load { /// Search for the maximum load that the system can sustainably handle. Search { /// The initial load (in tx/s) to test and use a baseline. - #[clap(long, value_name = "INT", default_value = "250")] + #[arg(long, value_name = "INT", default_value = "250")] starting_load: usize, /// The maximum number of iterations before converging on a breaking /// point. - #[clap(long, value_name = "INT", default_value = "5")] + #[arg(long, value_name = "INT", default_value = "5")] max_iterations: usize, }, } diff --git a/crates/iota-benchmark/src/options.rs b/crates/iota-benchmark/src/options.rs index 995b262872b..922a3afa47e 100644 --- a/crates/iota-benchmark/src/options.rs +++ b/crates/iota-benchmark/src/options.rs @@ -10,69 +10,69 @@ use strum_macros::EnumString; use crate::drivers::Interval; #[derive(Parser)] -#[clap(name = "Stress Testing Framework")] +#[command(name = "Stress Testing Framework")] pub struct Opts { /// Size of the IOTA committee. - #[clap(long, default_value = "4", global = true)] + #[arg(long, default_value = "4", global = true)] pub committee_size: u64, /// Num of accounts to use for transfer objects - #[clap(long, default_value = "5", global = true)] + #[arg(long, default_value = "5", global = true)] pub num_transfer_accounts: u64, /// Num server threads - #[clap(long, default_value = "24", global = true)] + #[arg(long, default_value = "24", global = true)] pub num_server_threads: u64, /// Num client threads /// ideally same as number of workers - #[clap(long, default_value = "3", global = true)] + #[arg(long, default_value = "3", global = true)] pub num_client_threads: u64, - #[clap(long, default_value = "", global = true)] + #[arg(long, default_value = "", global = true)] pub log_path: String, /// [Required for remote benchmark] /// Path where genesis.blob is stored when running remote benchmark - #[clap(long, default_value = "/tmp/genesis.blob", global = true)] + #[arg(long, default_value = "/tmp/genesis.blob", global = true)] pub genesis_blob_path: String, /// [Required for remote benchmark] /// Path where keypair for primary gas account is stored. The format of /// this file is same as what `iota keytool generate` outputs - #[clap(long, default_value = "", global = true)] + #[arg(long, default_value = "", global = true)] pub keystore_path: String, /// [Required for remote benchmark] /// Object id of the primary gas coin used for benchmark /// NOTE: THe remote network should have this coin in its genesis config /// with large enough gas. - #[clap(long, default_value = "", global = true)] + #[arg(long, default_value = "", global = true)] pub primary_gas_owner_id: String, - #[clap(long, default_value = "500", global = true)] + #[arg(long, default_value = "500", global = true)] pub gas_request_chunk_size: u64, /// Whether to run local or remote benchmark /// NOTE: For running remote benchmark we must have the following /// genesis_blob_path, keypair_path and primary_gas_id - #[clap(long, action = clap::ArgAction::Set, default_value = "true", global = true)] + #[arg(long, action = clap::ArgAction::Set, default_value = "true", global = true)] pub local: bool, /// Required in remote benchmark, namely when local = false /// Multiple fullnodes can be specified. - #[clap(long, num_args(1..), value_delimiter = ',', global = true)] + #[arg(long, num_args(1..), value_delimiter = ',', global = true)] pub fullnode_rpc_addresses: Vec, /// Whether to submit transactions to a fullnode. /// If true, use FullNodeProxy. /// Otherwise, use LocalValidatorAggregatorProxy. /// This param only matters when local = false, namely local runs always /// use a LocalValidatorAggregatorProxy. - #[clap(long, action = clap::ArgAction::Set, default_value = "false", global = true)] + #[arg(long, action = clap::ArgAction::Set, default_value = "false", global = true)] pub use_fullnode_for_execution: bool, /// True to use FullNodeReconfigObserver, /// Otherwise use EmbeddedReconfigObserver, - #[clap(long, action = clap::ArgAction::Set, default_value = "false", global = true)] + #[arg(long, action = clap::ArgAction::Set, default_value = "false", global = true)] pub use_fullnode_for_reconfig: bool, /// Default workload is 100% transfer object - #[clap(subcommand)] + #[command(subcommand)] pub run_spec: RunSpec, - #[clap(long, default_value = "127.0.0.1", global = true)] + #[arg(long, default_value = "127.0.0.1", global = true)] pub client_metric_host: String, - #[clap(long, default_value = "8081", global = true)] + #[arg(long, default_value = "8081", global = true)] pub client_metric_port: u16, /// Whether or no to download TXes during follow - #[clap(long, global = true)] + #[arg(long, global = true)] pub download_txes: bool, /// Number of transactions or duration to /// run the benchmark for. Default set to @@ -83,38 +83,37 @@ pub struct Opts { /// And if we wanted to run the test for /// 10,000 transactions we could set it to /// "10000" - #[clap(long, global = true, default_value = "unbounded")] + #[arg(long, global = true, default_value = "unbounded")] pub run_duration: Interval, /// Path where benchmark stats is stored - #[clap(long, default_value = "/tmp/bench_result", global = true)] + #[arg(long, default_value = "/tmp/bench_result", global = true)] pub benchmark_stats_path: String, /// Path where previous benchmark stats is stored to use for comparison - #[clap(long, default_value = "", global = true)] + #[arg(long, default_value = "", global = true)] pub compare_with: String, // Stat collection interval seconds - #[clap(long, default_value = "10", global = true)] + #[arg(long, default_value = "10", global = true)] pub stat_collection_interval: u64, // Enable stress stat collection. When enabled the sysinfo crate will be used // to gather system information. For example cpu usage will be polled every // 1 second and the P50/P99 usage statistics will be outputted either at // the end of the benchmark or periodically during a continuous run. - #[clap(long, action, global = true)] + #[arg(long, action, global = true)] pub stress_stat_collection: bool, // When starting multiple stress clients, stagger the start time by a random multiplier // between 0 and this value, times initialization time which is 1min. This helps to avoid // transaction conflicts between clients. - #[clap(long, default_value = "0", global = true)] + #[arg(long, default_value = "0", global = true)] pub staggered_start_max_multiplier: u32, - /// Start the stress test at a given protocol version. (Usually unnecessary /// if stress test is built at the same commit as the validators. - #[clap(long, global = true)] + #[arg(long, global = true)] pub protocol_version: Option, } #[derive(Debug, Clone, Parser, Eq, PartialEq, EnumString)] #[non_exhaustive] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub enum RunSpec { // Allow the ability to mix shared object and // single owner transactions in the benchmarking @@ -163,30 +162,30 @@ pub enum RunSpec { // `num_of_benchmark_groups = 2`, then we expect all the arguments under this // subcommand to contain two values on their vectors - one for each benchmark set. // If an argument doesn't contain the right number of values then it will panic. - #[clap(long, default_value = "1")] + #[arg(long, default_value = "1")] num_of_benchmark_groups: u32, // relative weight of shared counter // transaction in the benchmark workload - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] shared_counter: Vec, // relative weight of transfer object // transactions in the benchmark workload - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [1])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [1])] transfer_object: Vec, // relative weight of delegation transactions in the benchmark workload - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] delegation: Vec, // relative weight of batch payment transactions in the benchmark workload - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] batch_payment: Vec, // relative weight of adversarial transactions in the benchmark workload - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] adversarial: Vec, // relative weight of shared deletion transactions in the benchmark workload - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] shared_deletion: Vec, // relative weight of randomness transactions in the benchmark workload - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] randomness: Vec, // --- workload-specific options --- (TODO: use subcommands or similar) @@ -196,43 +195,43 @@ pub enum RunSpec { // counter. The way total number of counters to // create is computed roughly as: // total_shared_counters = max(1, qps * (1.0 - hotness/100.0)) - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [50])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [50])] shared_counter_hotness_factor: Vec, // The number of shared counters this stress client will create and use. // This parameter takes precedence over `shared_counter_hotness_factor`, meaning that when // this parameter is specified, `shared_counter_hotness_factor` is ignored when // deciding the number of shared counters to create. - #[clap(long, num_args(1..), value_delimiter = ',')] + #[arg(long, num_args(1..), value_delimiter = ',')] num_shared_counters: Option>, // Maximum gas price increment over the RGP for shared counter transactions. // The actual increment for each transaction is chosen at random a value between 0 and this // value. - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [0])] shared_counter_max_tip: Vec, // batch size use for batch payment workload - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [15])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [15])] batch_payment_size: Vec, // type and load % of adversarial transactions in the benchmark workload. // Format is "{adversarial_type}-{load_factor}". // `load_factor` is a number between 0.0 and 1.0 which dictates how much load per tx // Default is (0-0.5) implying random load at 50% load. See `AdversarialPayloadType` enum // for `adversarial_type` - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = ["0-1.0".to_string()])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = ["0-1.0".to_string()])] adversarial_cfg: Vec, // --- generic options --- // Target qps - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [1000])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [1000])] target_qps: Vec, // Number of workers - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [12])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [12])] num_workers: Vec, // Max in-flight ratio - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [5])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [5])] in_flight_ratio: Vec, // Setting the duration of each benchmark. Benchmarks will run in sequence. - #[clap(long, num_args(1..), value_delimiter = ',', default_values_t = [Interval::from_str("unbounded").unwrap()])] + #[arg(long, num_args(1..), value_delimiter = ',', default_values_t = [Interval::from_str("unbounded").unwrap()])] duration: Vec, }, } diff --git a/crates/iota-bridge-cli/src/lib.rs b/crates/iota-bridge-cli/src/lib.rs index 67a2706c776..dc7062f0dfa 100644 --- a/crates/iota-bridge-cli/src/lib.rs +++ b/crates/iota-bridge-cli/src/lib.rs @@ -47,9 +47,9 @@ use tracing::info; pub const SEPOLIA_BRIDGE_PROXY_ADDR: &str = "0xAE68F87938439afEEDd6552B0E83D2CbC2473623"; #[derive(Parser)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub struct Args { - #[clap(subcommand)] + #[command(subcommand)] pub command: BridgeCommand, } @@ -59,156 +59,156 @@ pub enum Network { } #[derive(Parser)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub enum BridgeCommand { - #[clap(name = "create-bridge-validator-key")] + #[command(name = "create-bridge-validator-key")] CreateBridgeValidatorKey { path: PathBuf }, - #[clap(name = "create-bridge-client-key")] + #[command(name = "create-bridge-client-key")] CreateBridgeClientKey { path: PathBuf, - #[clap(long = "use-ecdsa", default_value = "false")] + #[arg(long = "use-ecdsa", default_value = "false")] use_ecdsa: bool, }, /// Read bridge key from a file and print related information /// If `is-validator-key` is true, the key must be a secp256k1 key - #[clap(name = "examine-key")] + #[command(name = "examine-key")] ExamineKey { path: PathBuf, - #[clap(long = "is-validator-key")] + #[arg(long = "is-validator-key")] is_validator_key: bool, }, - #[clap(name = "create-bridge-node-config-template")] + #[command(name = "create-bridge-node-config-template")] CreateBridgeNodeConfigTemplate { path: PathBuf, - #[clap(long = "run-client")] + #[arg(long = "run-client")] run_client: bool, }, /// Governance client to facilitate and execute Bridge governance actions - #[clap(name = "governance")] + #[command(name = "governance")] Governance { /// Path of BridgeCliConfig - #[clap(long = "config-path")] + #[arg(long = "config-path")] config_path: PathBuf, - #[clap(long = "chain-id")] + #[arg(long = "chain-id")] chain_id: u8, - #[clap(subcommand)] + #[command(subcommand)] cmd: GovernanceClientCommands, /// If true, only collect signatures but not execute on chain - #[clap(long = "dry-run")] + #[arg(long = "dry-run")] dry_run: bool, }, /// View current status of Eth bridge - #[clap(name = "view-eth-bridge")] + #[command(name = "view-eth-bridge")] ViewEthBridge { - #[clap(long = "network")] + #[arg(long = "network")] network: Option, - #[clap(long = "bridge-proxy")] + #[arg(long = "bridge-proxy")] bridge_proxy: Option, - #[clap(long = "eth-rpc-url")] + #[arg(long = "eth-rpc-url")] eth_rpc_url: String, }, /// View current list of registered validators - #[clap(name = "view-bridge-registration")] + #[command(name = "view-bridge-registration")] ViewBridgeRegistration { - #[clap(long = "iota-rpc-url")] + #[arg(long = "iota-rpc-url")] iota_rpc_url: String, }, /// View current status of IOTA bridge - #[clap(name = "view-iota-bridge")] + #[command(name = "view-iota-bridge")] ViewIotaBridge { - #[clap(long = "iota-rpc-url")] + #[arg(long = "iota-rpc-url")] iota_rpc_url: String, - #[clap(long, default_value = "false")] + #[arg(long, default_value = "false")] hex: bool, - #[clap(long, default_value = "false")] + #[arg(long, default_value = "false")] ping: bool, }, /// Client to facilitate and execute Bridge actions - #[clap(name = "client")] + #[command(name = "client")] Client { /// Path of BridgeCliConfig - #[clap(long = "config-path")] + #[arg(long = "config-path")] config_path: PathBuf, - #[clap(subcommand)] + #[command(subcommand)] cmd: BridgeClientCommands, }, } #[derive(Parser)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub enum GovernanceClientCommands { - #[clap(name = "emergency-button")] + #[command(name = "emergency-button")] EmergencyButton { - #[clap(name = "nonce", long)] + #[arg(name = "nonce", long)] nonce: u64, - #[clap(name = "action-type", long)] + #[arg(name = "action-type", long)] action_type: EmergencyActionType, }, - #[clap(name = "update-committee-blocklist")] + #[command(name = "update-committee-blocklist")] UpdateCommitteeBlocklist { - #[clap(name = "nonce", long)] + #[arg(name = "nonce", long)] nonce: u64, - #[clap(name = "blocklist-type", long)] + #[arg(name = "blocklist-type", long)] blocklist_type: BlocklistType, - #[clap(name = "pubkey-hex", use_value_delimiter = true, long)] + #[arg(name = "pubkey-hex", use_value_delimiter = true, long)] pubkeys_hex: Vec, }, - #[clap(name = "update-limit")] + #[command(name = "update-limit")] UpdateLimit { - #[clap(name = "nonce", long)] + #[arg(name = "nonce", long)] nonce: u64, - #[clap(name = "sending-chain", long)] + #[arg(name = "sending-chain", long)] sending_chain: u8, - #[clap(name = "new-usd-limit", long)] + #[arg(name = "new-usd-limit", long)] new_usd_limit: u64, }, - #[clap(name = "update-asset-price")] + #[command(name = "update-asset-price")] UpdateAssetPrice { - #[clap(name = "nonce", long)] + #[arg(name = "nonce", long)] nonce: u64, - #[clap(name = "token-id", long)] + #[arg(name = "token-id", long)] token_id: u8, - #[clap(name = "new-usd-price", long)] + #[arg(name = "new-usd-price", long)] new_usd_price: u64, }, - #[clap(name = "add-tokens-on-iota")] + #[command(name = "add-tokens-on-iota")] AddTokensOnIota { - #[clap(name = "nonce", long)] + #[arg(name = "nonce", long)] nonce: u64, - #[clap(name = "token-ids", use_value_delimiter = true, long)] + #[arg(name = "token-ids", use_value_delimiter = true, long)] token_ids: Vec, - #[clap(name = "token-type-names", use_value_delimiter = true, long)] + #[arg(name = "token-type-names", use_value_delimiter = true, long)] token_type_names: Vec, - #[clap(name = "token-prices", use_value_delimiter = true, long)] + #[arg(name = "token-prices", use_value_delimiter = true, long)] token_prices: Vec, }, - #[clap(name = "add-tokens-on-evm")] + #[command(name = "add-tokens-on-evm")] AddTokensOnEvm { - #[clap(name = "nonce", long)] + #[arg(name = "nonce", long)] nonce: u64, - #[clap(name = "token-ids", use_value_delimiter = true, long)] + #[arg(name = "token-ids", use_value_delimiter = true, long)] token_ids: Vec, - #[clap(name = "token-type-names", use_value_delimiter = true, long)] + #[arg(name = "token-type-names", use_value_delimiter = true, long)] token_addresses: Vec, - #[clap(name = "token-prices", use_value_delimiter = true, long)] + #[arg(name = "token-prices", use_value_delimiter = true, long)] token_prices: Vec, - #[clap(name = "token-iota-decimals", use_value_delimiter = true, long)] + #[arg(name = "token-iota-decimals", use_value_delimiter = true, long)] token_iota_decimals: Vec, }, - #[clap(name = "upgrade-evm-contract")] + #[command(name = "upgrade-evm-contract")] UpgradeEVMContract { - #[clap(name = "nonce", long)] + #[arg(name = "nonce", long)] nonce: u64, - #[clap(name = "proxy-address", long)] + #[arg(name = "proxy-address", long)] proxy_address: EthAddress, /// The address of the new implementation contract - #[clap(name = "implementation-address", long)] + #[arg(name = "implementation-address", long)] implementation_address: EthAddress, /// Function selector with params types, e.g. `foo(uint256,bool,string)` - #[clap(name = "function-selector", long)] + #[arg(name = "function-selector", long)] function_selector: Option, /// Params to be passed to the function, e.g. `420,false,hello` - #[clap(name = "params", use_value_delimiter = true, long)] + #[arg(name = "params", use_value_delimiter = true, long)] params: Vec, }, } @@ -517,31 +517,31 @@ impl LoadedBridgeCliConfig { } } #[derive(Parser)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub enum BridgeClientCommands { - #[clap(name = "deposit-native-ether-on-eth")] + #[command(name = "deposit-native-ether-on-eth")] DepositNativeEtherOnEth { - #[clap(long)] + #[arg(long)] ether_amount: f64, - #[clap(long)] + #[arg(long)] target_chain: u8, - #[clap(long)] + #[arg(long)] iota_recipient_address: IotaAddress, }, - #[clap(name = "deposit-on-iota")] + #[command(name = "deposit-on-iota")] DepositOnIota { - #[clap(long)] + #[arg(long)] coin_object_id: ObjectID, - #[clap(long)] + #[arg(long)] coin_type: String, - #[clap(long)] + #[arg(long)] target_chain: u8, - #[clap(long)] + #[arg(long)] recipient_address: EthAddress, }, - #[clap(name = "claim-on-eth")] + #[command(name = "claim-on-eth")] ClaimOnEth { - #[clap(long)] + #[arg(long)] seq_num: u64, }, } diff --git a/crates/iota-bridge-indexer/src/main.rs b/crates/iota-bridge-indexer/src/main.rs index 4d96bad8a90..15055fd00b5 100644 --- a/crates/iota-bridge-indexer/src/main.rs +++ b/crates/iota-bridge-indexer/src/main.rs @@ -33,7 +33,7 @@ use tracing::info; #[derive(Parser, Clone, Debug)] struct Args { /// Path to a yaml config - #[clap(long, short)] + #[arg(long, short)] config_path: Option, } diff --git a/crates/iota-bridge/src/main.rs b/crates/iota-bridge/src/main.rs index ee238ba4165..81ebf611b97 100644 --- a/crates/iota-bridge/src/main.rs +++ b/crates/iota-bridge/src/main.rs @@ -19,11 +19,9 @@ use tracing::info; bin_version::bin_version!(); #[derive(Parser)] -#[clap(rename_all = "kebab-case")] -#[clap(name = env!("CARGO_BIN_NAME"))] -#[clap(version = VERSION)] +#[command(rename_all = "kebab-case", name = env!("CARGO_BIN_NAME"), version = VERSION)] struct Args { - #[clap(long)] + #[arg(long)] pub config_path: PathBuf, } diff --git a/crates/iota-cluster-test/src/config.rs b/crates/iota-cluster-test/src/config.rs index 29beab71456..1877c5999e4 100644 --- a/crates/iota-cluster-test/src/config.rs +++ b/crates/iota-cluster-test/src/config.rs @@ -17,35 +17,33 @@ pub enum Env { } #[derive(derive_more::Debug, Parser)] -#[clap(name = "", rename_all = "kebab-case")] +#[command(name = "", rename_all = "kebab-case")] pub struct ClusterTestOpt { - #[clap(value_enum)] + #[arg(value_enum)] pub env: Env, - #[clap(long)] + #[arg(long)] pub faucet_address: Option, - #[clap(long)] + #[arg(long)] pub fullnode_address: Option, - #[clap(long)] + #[arg(long)] pub epoch_duration_ms: Option, /// URL for the indexer RPC server - #[clap(long)] + #[arg(long)] pub indexer_address: Option, /// URL for the Indexer Postgres DB - #[clap(long)] + #[arg(long)] #[debug("{}", ObfuscatedPgAddress(pg_address))] pub pg_address: Option, - #[clap(long)] + #[arg(long)] pub config_dir: Option, /// URL for the indexer RPC server - #[clap(long)] + #[arg(long)] pub graphql_address: Option, /// Locations for local migration snapshots. - #[clap(long, name = "path")] - #[arg(num_args(0..))] + #[arg(long, name = "path", num_args(0..))] pub local_migration_snapshots: Vec, /// Remote migration snapshots. - #[clap(long, name = "iota|")] - #[arg(num_args(0..))] + #[arg(long, name = "iota|", num_args(0..))] pub remote_migration_snapshots: Vec, } diff --git a/crates/iota-core/src/generate_format.rs b/crates/iota-core/src/generate_format.rs index 559d9938812..306d3165bf1 100644 --- a/crates/iota-core/src/generate_format.rs +++ b/crates/iota-core/src/generate_format.rs @@ -196,12 +196,12 @@ enum Action { } #[derive(Debug, Parser)] -#[clap( +#[command( name = "IOTA format generator", about = "Trace serde (de)serialization to generate format descriptions for IOTA types" )] struct Options { - #[clap(value_enum, default_value = "Print", ignore_case = true)] + #[arg(value_enum, default_value = "Print", ignore_case = true)] action: Action, } diff --git a/crates/iota-faucet/src/faucet/mod.rs b/crates/iota-faucet/src/faucet/mod.rs index a3e6e471eb7..4421ed524a4 100644 --- a/crates/iota-faucet/src/faucet/mod.rs +++ b/crates/iota-faucet/src/faucet/mod.rs @@ -86,49 +86,49 @@ pub const DEFAULT_AMOUNT: u64 = 1_000_000_000; pub const DEFAULT_NUM_OF_COINS: usize = 1; #[derive(Parser, Clone)] -#[clap( +#[command( name = "IOTA Faucet", about = "Faucet for requesting test tokens on IOTA", rename_all = "kebab-case" )] pub struct FaucetConfig { - #[clap(long, default_value_t = 5003)] + #[arg(long, default_value_t = 5003)] pub port: u16, - #[clap(long, default_value = "127.0.0.1")] + #[arg(long, default_value = "127.0.0.1")] pub host_ip: Ipv4Addr, - #[clap(long, default_value_t = DEFAULT_AMOUNT)] + #[arg(long, default_value_t = DEFAULT_AMOUNT)] pub amount: u64, - #[clap(long, default_value_t = DEFAULT_NUM_OF_COINS)] + #[arg(long, default_value_t = DEFAULT_NUM_OF_COINS)] pub num_coins: usize, - #[clap(long, default_value_t = 10)] + #[arg(long, default_value_t = 10)] pub request_buffer_size: usize, - #[clap(long, default_value_t = 10)] + #[arg(long, default_value_t = 10)] pub max_request_per_second: u64, - #[clap(long, default_value_t = 60)] + #[arg(long, default_value_t = 60)] pub wallet_client_timeout_secs: u64, - #[clap(long)] + #[arg(long)] pub write_ahead_log: PathBuf, - #[clap(long, default_value_t = 300)] + #[arg(long, default_value_t = 300)] pub wal_retry_interval: u64, - #[clap(long, default_value_t = 10000)] + #[arg(long, default_value_t = 10000)] pub max_request_queue_length: u64, - #[clap(long, default_value_t = 500)] + #[arg(long, default_value_t = 500)] pub batch_request_size: u64, - #[clap(long, default_value_t = 300)] + #[arg(long, default_value_t = 300)] pub ttl_expiration: u64, - #[clap(long, action = clap::ArgAction::Set, default_value_t = false)] + #[arg(long, action = clap::ArgAction::Set, default_value_t = false)] pub batch_enabled: bool, } diff --git a/crates/iota-genesis-builder/examples/build_stardust_genesis.rs b/crates/iota-genesis-builder/examples/build_stardust_genesis.rs index 2eb01e6e3df..79717c36516 100644 --- a/crates/iota-genesis-builder/examples/build_stardust_genesis.rs +++ b/crates/iota-genesis-builder/examples/build_stardust_genesis.rs @@ -14,11 +14,11 @@ use iota_swarm_config::genesis_config::ValidatorGenesisConfigBuilder; use rand::rngs::OsRng; #[derive(Parser, Debug)] -#[clap( +#[command( about = "Example Tool for generating a genesis file from a Stardust Migration Objects snapshot" )] struct Cli { - #[clap(long, default_value_t = OBJECT_SNAPSHOT_FILE_PATH.to_string(), help = "Path to the Stardust Migration Objects snapshot file")] + #[arg(long, default_value_t = OBJECT_SNAPSHOT_FILE_PATH.to_string(), help = "Path to the Stardust Migration Objects snapshot file")] snapshot_path: String, } diff --git a/crates/iota-genesis-builder/examples/build_stardust_genesis_from_s3.rs b/crates/iota-genesis-builder/examples/build_stardust_genesis_from_s3.rs index 8c12bb1798b..231979ccb9f 100644 --- a/crates/iota-genesis-builder/examples/build_stardust_genesis_from_s3.rs +++ b/crates/iota-genesis-builder/examples/build_stardust_genesis_from_s3.rs @@ -11,10 +11,10 @@ use tracing::{Level, info}; use tracing_subscriber::FmtSubscriber; #[derive(Parser, Debug)] -#[clap(about = "Example that builds genesis in a temp folder with migration snapshots")] +#[command(about = "Example that builds genesis in a temp folder with migration snapshots")] struct Args { /// Remotely stored migration snapshots. - #[clap( + #[arg( long, name = "iota|", help = "Remote migration snapshots.", diff --git a/crates/iota-genesis-builder/examples/snapshot_add_test_outputs.rs b/crates/iota-genesis-builder/examples/snapshot_add_test_outputs.rs index e5b8398784f..0913782ed32 100644 --- a/crates/iota-genesis-builder/examples/snapshot_add_test_outputs.rs +++ b/crates/iota-genesis-builder/examples/snapshot_add_test_outputs.rs @@ -13,17 +13,17 @@ use iota_genesis_builder::stardust::{ use iota_types::{gas_coin::STARDUST_TOTAL_SUPPLY_IOTA, stardust::coin_type::CoinType}; #[derive(Parser, Debug)] -#[clap(about = "Tool for adding test data to IOTA Hornet full-snapshot")] +#[command(about = "Tool for adding test data to IOTA Hornet full-snapshot")] struct Cli { - #[clap(subcommand)] + #[command(subcommand)] snapshot: Snapshot, } #[derive(Subcommand, Debug)] enum Snapshot { - #[clap(about = "Parse an IOTA Hornet full-snapshot file")] + #[command(about = "Parse an IOTA Hornet full-snapshot file")] Iota { - #[clap(long, help = "Path to the IOTA Hornet full-snapshot file")] + #[arg(long, help = "Path to the IOTA Hornet full-snapshot file")] snapshot_path: String, }, } diff --git a/crates/iota-genesis-builder/examples/snapshot_only_test_outputs.rs b/crates/iota-genesis-builder/examples/snapshot_only_test_outputs.rs index 1051e28a5cd..eae82e48d02 100644 --- a/crates/iota-genesis-builder/examples/snapshot_only_test_outputs.rs +++ b/crates/iota-genesis-builder/examples/snapshot_only_test_outputs.rs @@ -19,19 +19,19 @@ use iota_types::{ const WITH_SAMPLING: bool = false; #[derive(Parser, Debug)] -#[clap(about = "Tool for generating IOTA Hornet full-snapshot file with test data")] +#[command(about = "Tool for generating IOTA Hornet full-snapshot file with test data")] struct Cli { - #[clap(subcommand)] + #[command(subcommand)] snapshot: Snapshot, } #[derive(Subcommand, Debug)] enum Snapshot { - #[clap(about = "Parse an IOTA Hornet full-snapshot file")] + #[command(about = "Parse an IOTA Hornet full-snapshot file")] Iota { - #[clap(long, help = "Path to the IOTA Hornet full-snapshot file")] + #[arg(long, help = "Path to the IOTA Hornet full-snapshot file")] snapshot_path: String, - #[clap(long, help = "Specify the delegator address")] + #[arg(long, help = "Specify the delegator address")] delegator: IotaAddress, }, } diff --git a/crates/iota-genesis-builder/src/main.rs b/crates/iota-genesis-builder/src/main.rs index 3b71f625926..d654d0f6c39 100644 --- a/crates/iota-genesis-builder/src/main.rs +++ b/crates/iota-genesis-builder/src/main.rs @@ -22,31 +22,31 @@ use tracing::Level; use tracing_subscriber::FmtSubscriber; #[derive(Parser, Debug)] -#[clap(about = "Tool for migrating IOTA Hornet full-snapshot file")] +#[command(about = "Tool for migrating IOTA Hornet full-snapshot file")] struct Cli { - #[clap(subcommand)] + #[command(subcommand)] snapshot: Snapshot, - #[clap(long, help = "Disable global snapshot verification")] + #[arg(long, help = "Disable global snapshot verification")] disable_global_snapshot_verification: bool, } #[derive(Subcommand, Debug)] enum Snapshot { - #[clap(about = "Migrate an IOTA Hornet full-snapshot file")] + #[command(about = "Migrate an IOTA Hornet full-snapshot file")] Iota { - #[clap(long, help = "Path to the IOTA Hornet full-snapshot file")] + #[arg(long, help = "Path to the IOTA Hornet full-snapshot file")] snapshot_path: String, - #[clap( + #[arg( long, help = "Path to the address swap map file. This must be a CSV file with two columns, where an entry contains in the first column an IotaAddress present in the Hornet full-snapshot and in the second column an (ed25519 hex) IOTA Address that will be used for the swap." )] address_swap_map_path: Option, - #[clap( + #[arg( long, help = "Path to the address swap split map file. This must be a CSV file with four columns, where an entry contains in the first column a (bech32) Address present in the Hornet full-snapshot, in the second column an (ed25519 hex) IOTA Address that will be used for the swap, in the third column a target amount of iota tokens to be split from the origin address to the destination address and in the fourth column the amount of timelocked iota tokens used for the same scope." )] address_swap_split_map_path: Option, - #[clap(long, value_parser = clap::value_parser!(MigrationTargetNetwork), help = "Target network for migration")] + #[arg(long, value_parser = clap::value_parser!(MigrationTargetNetwork), help = "Target network for migration")] target_network: MigrationTargetNetwork, }, } diff --git a/crates/iota-graphql-rpc/src/commands.rs b/crates/iota-graphql-rpc/src/commands.rs index 00585243954..f8ddacb7730 100644 --- a/crates/iota-graphql-rpc/src/commands.rs +++ b/crates/iota-graphql-rpc/src/commands.rs @@ -7,7 +7,7 @@ use std::path::PathBuf; use clap::*; #[derive(Parser)] -#[clap( +#[command( name = "iota-graphql-rpc", about = "IOTA GraphQL RPC", rename_all = "kebab-case", @@ -23,38 +23,38 @@ pub enum Command { }, GenerateSchema { /// Path to output GraphQL schema to, in SDL format. - #[clap(short, long)] + #[arg(short, long)] file: Option, }, StartServer { /// The title to display at the top of the page - #[clap(short, long)] + #[arg(short, long)] ide_title: Option, /// DB URL for data fetching - #[clap(short, long)] + #[arg(short, long)] db_url: Option, /// Pool size for DB connections - #[clap(long)] + #[arg(long)] db_pool_size: Option, /// Port to bind the server to - #[clap(short, long)] + #[arg(short, long)] port: Option, /// Host to bind the server to - #[clap(long)] + #[arg(long)] host: Option, /// Port to bind the prom server to - #[clap(long)] + #[arg(long)] prom_port: Option, /// Host to bind the prom server to - #[clap(long)] + #[arg(long)] prom_host: Option, /// Path to TOML file containing configuration for service. - #[clap(short, long)] + #[arg(short, long)] config: Option, /// RPC url to the Node for tx execution - #[clap(long)] + #[arg(long)] node_rpc_url: Option, }, } diff --git a/crates/iota-indexer/examples/index_genesis_transaction.rs b/crates/iota-indexer/examples/index_genesis_transaction.rs index 59ec702bde4..dc0e51b7aaf 100644 --- a/crates/iota-indexer/examples/index_genesis_transaction.rs +++ b/crates/iota-indexer/examples/index_genesis_transaction.rs @@ -18,16 +18,16 @@ use iota_swarm_config::genesis_config::ValidatorGenesisConfigBuilder; use rand::rngs::OsRng; #[derive(Parser, Debug)] -#[clap(about = "Example that indexes the genesis transaction into the database")] +#[command(about = "Example that indexes the genesis transaction into the database")] struct Args { /// Remotely stored migration snapshots. - #[clap( + #[arg( long, name = "iota|", help = "Remote migration snapshots.", default_values_t = vec![SnapshotUrl::Iota], + num_args(0..) )] - #[arg(num_args(0..))] migration_snapshots: Vec, } diff --git a/crates/iota-indexer/src/lib.rs b/crates/iota-indexer/src/lib.rs index 22c911f6664..0b6c58f39f5 100644 --- a/crates/iota-indexer/src/lib.rs +++ b/crates/iota-indexer/src/lib.rs @@ -47,45 +47,45 @@ pub mod test_utils; pub mod types; #[derive(Parser, Clone, Debug)] -#[clap( +#[command( name = "IOTA indexer", about = "An off-fullnode service serving data from IOTA protocol", rename_all = "kebab-case" )] pub struct IndexerConfig { - #[clap(long)] + #[arg(long)] pub db_url: Option>, - #[clap(long)] + #[arg(long)] pub db_user_name: Option, - #[clap(long)] + #[arg(long)] pub db_password: Option>, - #[clap(long)] + #[arg(long)] pub db_host: Option, - #[clap(long)] + #[arg(long)] pub db_port: Option, - #[clap(long)] + #[arg(long)] pub db_name: Option, - #[clap(long, default_value = "http://0.0.0.0:9000", global = true)] + #[arg(long, default_value = "http://0.0.0.0:9000", global = true)] pub rpc_client_url: String, - #[clap(long, default_value = Some("https://checkpoints.mainnet.iota.cafe"), global = true)] + #[arg(long, default_value = Some("https://checkpoints.mainnet.iota.cafe"), global = true)] pub remote_store_url: Option, - #[clap(long, default_value = "0.0.0.0", global = true)] + #[arg(long, default_value = "0.0.0.0", global = true)] pub client_metric_host: String, - #[clap(long, default_value = "9184", global = true)] + #[arg(long, default_value = "9184", global = true)] pub client_metric_port: u16, - #[clap(long, default_value = "0.0.0.0", global = true)] + #[arg(long, default_value = "0.0.0.0", global = true)] pub rpc_server_url: String, - #[clap(long, default_value = "9000", global = true)] + #[arg(long, default_value = "9000", global = true)] pub rpc_server_port: u16, - #[clap(long)] + #[arg(long)] pub reset_db: bool, - #[clap(long)] + #[arg(long)] pub fullnode_sync_worker: bool, - #[clap(long)] + #[arg(long)] pub rpc_server_worker: bool, - #[clap(long)] + #[arg(long)] pub data_ingestion_path: Option, - #[clap(long)] + #[arg(long)] pub analytical_worker: bool, } diff --git a/crates/iota-move-lsp/src/bin/move-analyzer.rs b/crates/iota-move-lsp/src/bin/move-analyzer.rs index 1faf3513773..4865c4fe484 100644 --- a/crates/iota-move-lsp/src/bin/move-analyzer.rs +++ b/crates/iota-move-lsp/src/bin/move-analyzer.rs @@ -9,7 +9,7 @@ use move_analyzer::analyzer; bin_version::bin_version!(); #[derive(Parser)] -#[clap( +#[command( name = env!("CARGO_BIN_NAME"), rename_all = "kebab-case", author, diff --git a/crates/iota-move/src/build.rs b/crates/iota-move/src/build.rs index 06d3c910b25..2bd347d8cd6 100644 --- a/crates/iota-move/src/build.rs +++ b/crates/iota-move/src/build.rs @@ -21,10 +21,10 @@ const STRUCT_LAYOUTS_FILENAME: &str = "struct_layouts.yaml"; pub struct Build { /// Include the contents of packages in dependencies that haven't been /// published (only relevant when dumping bytecode as base64) - #[clap(long, global = true)] + #[arg(long, global = true)] pub with_unpublished_dependencies: bool, /// Whether we are printing in base64. - #[clap(long, global = true)] + #[arg(long, global = true)] pub dump_bytecode_as_base64: bool, /// Don't specialize the package to the active chain when dumping bytecode /// as Base64. This allows building to proceed without a network connection @@ -36,12 +36,12 @@ pub struct Build { /// `entry` functions declared by modules in this package These layout /// schemas can be consumed by clients (e.g., the TypeScript SDK) to enable /// serialization/deserialization of transaction arguments and events. - #[clap(long, global = true)] + #[arg(long, global = true)] pub generate_struct_layouts: bool, /// The chain ID, if resolved. Required when the dump_bytecode_as_base64 is /// true, for automated address management, where package addresses are /// resolved for the respective chain in the Move.lock file. - #[clap(skip)] + #[arg(skip)] pub chain_id: Option, } diff --git a/crates/iota-move/src/coverage.rs b/crates/iota-move/src/coverage.rs index 836d28d36df..84e3bf47c2e 100644 --- a/crates/iota-move/src/coverage.rs +++ b/crates/iota-move/src/coverage.rs @@ -11,7 +11,7 @@ use move_package::BuildConfig; #[derive(Parser)] #[group(id = "iota-move-coverage")] pub struct Coverage { - #[clap(flatten)] + #[command(flatten)] pub coverage: coverage::Coverage, } diff --git a/crates/iota-move/src/disassemble.rs b/crates/iota-move/src/disassemble.rs index 42671f872b0..4e29995b07f 100644 --- a/crates/iota-move/src/disassemble.rs +++ b/crates/iota-move/src/disassemble.rs @@ -20,14 +20,14 @@ use move_package::BuildConfig; #[group(id = "iota-move-disassemmble")] pub struct Disassemble { /// Path to a .mv file to disassemble - #[clap(name = "module_path")] + #[arg(name = "module_path")] module_path: PathBuf, /// Whether to display the disassembly in raw Debug format - #[clap(long = "Xdebug")] + #[arg(long = "Xdebug")] debug: bool, - #[clap(short = 'i', long = "interactive")] + #[arg(short = 'i', long = "interactive")] interactive: bool, } diff --git a/crates/iota-move/src/lib.rs b/crates/iota-move/src/lib.rs index 6e3f4832bd7..04c94cb7800 100644 --- a/crates/iota-move/src/lib.rs +++ b/crates/iota-move/src/lib.rs @@ -38,9 +38,9 @@ pub enum Command { } #[derive(Parser)] pub struct Calib { - #[clap(name = "runs", short = 'r', long = "runs", default_value = "1")] + #[arg(name = "runs", short = 'r', long = "runs", default_value = "1")] runs: usize, - #[clap(name = "summarize", short = 's', long = "summarize")] + #[arg(name = "summarize", short = 's', long = "summarize")] summarize: bool, } diff --git a/crates/iota-move/src/main.rs b/crates/iota-move/src/main.rs index 17933267102..b4129d7a6f9 100644 --- a/crates/iota-move/src/main.rs +++ b/crates/iota-move/src/main.rs @@ -15,7 +15,7 @@ use tracing::debug; bin_version::bin_version!(); #[derive(Parser)] -#[clap( +#[command( name = env!("CARGO_BIN_NAME"), about = "IOTA Move CLI", rename_all = "kebab-case", @@ -24,20 +24,20 @@ bin_version::bin_version!(); )] struct Args { /// Path to a package which the command should be run with respect to. - #[clap(long = "path", short = 'p', global = true)] + #[arg(long = "path", short = 'p', global = true)] pub package_path: Option, /// If true, run the Move bytecode verifier on the bytecode from a /// successful build - #[clap(long = "path", short = 'p', global = true)] + #[arg(long = "path", short = 'p', global = true)] pub run_bytecode_verifier: bool, /// If true, print build diagnostics to stderr--no printing if false - #[clap(long = "path", short = 'p', global = true)] + #[arg(long = "path", short = 'p', global = true)] pub print_diags_to_stderr: bool, /// Package build options - #[clap(flatten)] + #[command(flatten)] pub build_config: MoveBuildConfig, /// Subcommands. - #[clap(subcommand)] + #[command(subcommand)] pub cmd: iota_move::Command, } diff --git a/crates/iota-move/src/manage_package.rs b/crates/iota-move/src/manage_package.rs index 4f2f5d64e2b..e377c9c5bd0 100644 --- a/crates/iota-move/src/manage_package.rs +++ b/crates/iota-move/src/manage_package.rs @@ -23,23 +23,23 @@ const NO_LOCK_FILE: &str = "Expected a `Move.lock` file to exist in the package #[derive(Parser)] #[group(id = "iota-move-manage-package")] pub struct ManagePackage { - #[clap(long)] + #[arg(long)] /// The environment to associate this package information with (consider /// using `iota client active-env`). pub environment: String, - #[clap(long = "network-id")] + #[arg(long = "network-id")] /// The network chain identifer. Use '35834a8a' for mainnet. pub chain_id: String, - #[clap(long = "original-id", value_parser = ObjectID::from_hex_literal)] + #[arg(long = "original-id", value_parser = ObjectID::from_hex_literal)] /// The original address (Object ID) where this package is published. pub original_id: ObjectID, - #[clap(long = "latest-id", value_parser = ObjectID::from_hex_literal)] + #[arg(long = "latest-id", value_parser = ObjectID::from_hex_literal)] /// The most recent address (Object ID) where this package is published. It /// is the same as 'original-id' if the package is immutable and /// published once. It is different from 'original-id' if the package has /// been upgraded to a different address. pub latest_id: ObjectID, - #[clap(long = "version-number")] + #[arg(long = "version-number")] /// The version number of the published package. It is '1' if the package is /// immutable and published once. It is some number greater than '1' if /// the package has been upgraded once or more. diff --git a/crates/iota-move/src/migrate.rs b/crates/iota-move/src/migrate.rs index 315b08053b3..5c72c5def7b 100644 --- a/crates/iota-move/src/migrate.rs +++ b/crates/iota-move/src/migrate.rs @@ -11,7 +11,7 @@ use move_package::BuildConfig as MoveBuildConfig; #[derive(Parser)] #[group(id = "iota-move-migrate")] pub struct Migrate { - #[clap(flatten)] + #[command(flatten)] pub migrate: migrate::Migrate, } diff --git a/crates/iota-move/src/new.rs b/crates/iota-move/src/new.rs index cc4ae3a721d..c7c4f7d107e 100644 --- a/crates/iota-move/src/new.rs +++ b/crates/iota-move/src/new.rs @@ -17,7 +17,7 @@ const IOTA_PKG_PATH: &str = "{ git = \"https://github.com/iotaledger/iota.git\", #[derive(Parser)] #[group(id = "iota-move-new")] pub struct New { - #[clap(flatten)] + #[command(flatten)] pub new: new::New, } diff --git a/crates/iota-move/src/unit_test.rs b/crates/iota-move/src/unit_test.rs index 39a7855ca2b..2bfb09a79e4 100644 --- a/crates/iota-move/src/unit_test.rs +++ b/crates/iota-move/src/unit_test.rs @@ -34,7 +34,7 @@ const MAX_UNIT_TEST_INSTRUCTIONS: u64 = 1_000_000; #[derive(Parser)] #[group(id = "iota-move-test")] pub struct Test { - #[clap(flatten)] + #[command(flatten)] pub test: test::Test, } diff --git a/crates/iota-node/src/main.rs b/crates/iota-node/src/main.rs index 995b03d366e..eb63a09ba27 100644 --- a/crates/iota-node/src/main.rs +++ b/crates/iota-node/src/main.rs @@ -20,21 +20,23 @@ use tracing::{error, info}; bin_version::bin_version!(); #[derive(Parser)] -#[clap(rename_all = "kebab-case")] -#[clap(name = env!("CARGO_BIN_NAME"))] -#[clap(version = VERSION)] -#[clap(group(ArgGroup::new("exclusive").required(false)))] +#[command( + rename_all = "kebab-case", + version = VERSION, + group(ArgGroup::new("exclusive").required(false)), + name = env!("CARGO_BIN_NAME")) +] struct Args { - #[clap(long)] + #[arg(long)] pub config_path: PathBuf, - #[clap(long, help = "Specify address to listen on")] + #[arg(long, help = "Specify address to listen on")] listen_address: Option, - #[clap(long, group = "exclusive")] + #[arg(long, group = "exclusive")] run_with_range_epoch: Option, - #[clap(long, group = "exclusive")] + #[arg(long, group = "exclusive")] run_with_range_checkpoint: Option, } diff --git a/crates/iota-open-rpc/src/generate_json_rpc_spec.rs b/crates/iota-open-rpc/src/generate_json_rpc_spec.rs index 80dce7b85bc..c7c7e3b5305 100644 --- a/crates/iota-open-rpc/src/generate_json_rpc_spec.rs +++ b/crates/iota-open-rpc/src/generate_json_rpc_spec.rs @@ -28,12 +28,12 @@ enum Action { } #[derive(Debug, Parser)] -#[clap( +#[command( name = "IOTA format generator", about = "Trace serde (de)serialization to generate format descriptions for IOTA types" )] struct Options { - #[clap(value_enum, default_value = "Record", ignore_case = true)] + #[arg(value_enum, default_value = "Record", ignore_case = true)] action: Action, } diff --git a/crates/iota-proxy/src/main.rs b/crates/iota-proxy/src/main.rs index 1ac5c60a4c8..68beb3901ef 100644 --- a/crates/iota-proxy/src/main.rs +++ b/crates/iota-proxy/src/main.rs @@ -47,11 +47,9 @@ static APP_USER_AGENT: &str = const_str::concat!( ); #[derive(Parser, Debug)] -#[clap(rename_all = "kebab-case")] -#[clap(name = env!("CARGO_BIN_NAME"))] -#[clap(version = VERSION)] +#[command(name = env!("CARGO_BIN_NAME"), rename_all = "kebab-case", version = VERSION)] struct Args { - #[clap( + #[arg( long, short, default_value = "./iota-proxy.yaml", diff --git a/crates/iota-rosetta/src/main.rs b/crates/iota-rosetta/src/main.rs index 1f17a61a950..0280178fd82 100644 --- a/crates/iota-rosetta/src/main.rs +++ b/crates/iota-rosetta/src/main.rs @@ -32,42 +32,42 @@ use serde_json::{Value, json}; use tracing::{info, log::warn}; #[derive(Parser)] -#[clap(name = "iota-rosetta", rename_all = "kebab-case", author, version)] +#[command(name = "iota-rosetta", rename_all = "kebab-case", author, version)] pub enum RosettaServerCommand { GenerateRosettaCLIConfig { - #[clap(long)] + #[arg(long)] keystore_path: Option, - #[clap(long, default_value = "localnet")] + #[arg(long, default_value = "localnet")] env: IotaEnv, - #[clap(long, default_value = "http://rosetta-online:9002")] + #[arg(long, default_value = "http://rosetta-online:9002")] online_url: String, - #[clap(long, default_value = "http://rosetta-offline:9003")] + #[arg(long, default_value = "http://rosetta-offline:9003")] offline_url: String, }, StartOnlineRemoteServer { - #[clap(long, default_value = "localnet")] + #[arg(long, default_value = "localnet")] env: IotaEnv, - #[clap(long, default_value = "0.0.0.0:9002")] + #[arg(long, default_value = "0.0.0.0:9002")] addr: SocketAddr, - #[clap(long)] + #[arg(long)] full_node_url: String, - #[clap(long, default_value = "/data")] + #[arg(long, default_value = "/data")] data_path: PathBuf, }, StartOnlineServer { - #[clap(long, default_value = "localnet")] + #[arg(long, default_value = "localnet")] env: IotaEnv, - #[clap(long, default_value = "0.0.0.0:9002")] + #[arg(long, default_value = "0.0.0.0:9002")] addr: SocketAddr, - #[clap(long)] + #[arg(long)] node_config: Option, - #[clap(long, default_value = "/data")] + #[arg(long, default_value = "/data")] data_path: PathBuf, }, StartOfflineServer { - #[clap(long, default_value = "localnet")] + #[arg(long, default_value = "localnet")] env: IotaEnv, - #[clap(long, default_value = "0.0.0.0:9003")] + #[arg(long, default_value = "0.0.0.0:9003")] addr: SocketAddr, }, } diff --git a/crates/iota-rpc-loadgen/src/main.rs b/crates/iota-rpc-loadgen/src/main.rs index a35042865c1..fc9c90b3178 100644 --- a/crates/iota-rpc-loadgen/src/main.rs +++ b/crates/iota-rpc-loadgen/src/main.rs @@ -27,115 +27,115 @@ use crate::{ }; #[derive(Parser)] -#[clap( +#[command( name = "IOTA RPC Load Generator", version = "0.1", about = "A load test application for IOTA RPC" )] struct Opts { // TODO(chris): support running multiple commands at once - #[clap(subcommand)] + #[command(subcommand)] pub command: ClapCommand, - #[clap(long, default_value_t = 1)] + #[arg(long, default_value_t = 1)] pub num_threads: usize, - #[clap(long, default_value_t = true)] + #[arg(long, default_value_t = true)] pub cross_validate: bool, - #[clap(long, num_args(1..), default_value = "http://127.0.0.1:9000")] + #[arg(long, num_args(1..), default_value = "http://127.0.0.1:9000")] pub urls: Vec, /// the path to log file directory - #[clap(long, default_value = "~/.iota/iota_config/logs")] + #[arg(long, default_value = "~/.iota/iota_config/logs")] logs_directory: String, - #[clap(long, default_value = "~/.iota/loadgen/data")] + #[arg(long, default_value = "~/.iota/loadgen/data")] data_directory: String, } #[derive(Parser)] pub struct CommonOptions { - #[clap(short, long, default_value_t = 0)] + #[arg(short, long, default_value_t = 0)] pub repeat: usize, - #[clap(short, long, default_value_t = 0)] + #[arg(short, long, default_value_t = 0)] pub interval_in_ms: u64, /// different chunks will be executed concurrently on the same thread - #[clap(long, default_value_t = 1)] + #[arg(long, default_value_t = 1)] num_chunks_per_thread: usize, } #[derive(Parser)] pub enum ClapCommand { - #[clap(name = "dry-run")] + #[command(name = "dry-run")] DryRun { - #[clap(flatten)] + #[command(flatten)] common: CommonOptions, }, - #[clap(name = "get-checkpoints")] + #[command(name = "get-checkpoints")] GetCheckpoints { /// Default to start from checkpoint 0 - #[clap(short, long, default_value_t = 0)] + #[arg(short, long, default_value_t = 0)] start: u64, /// inclusive, uses `getLatestCheckpointSequenceNumber` if `None` - #[clap(short, long)] + #[arg(short, long)] end: Option, - #[clap(long)] + #[arg(long)] skip_verify_transactions: bool, - #[clap(long)] + #[arg(long)] skip_verify_objects: bool, // Whether to record data from checkpoint - #[clap(long)] + #[arg(long)] skip_record: bool, - #[clap(flatten)] + #[command(flatten)] common: CommonOptions, }, - #[clap(name = "pay-iota")] + #[command(name = "pay-iota")] PayIota { // TODO(chris) customize recipients and amounts - #[clap(flatten)] + #[command(flatten)] common: CommonOptions, }, - #[clap(name = "query-transaction-blocks")] + #[command(name = "query-transaction-blocks")] QueryTransactionBlocks { - #[clap(long, ignore_case = true)] + #[arg(long, ignore_case = true)] address_type: AddressQueryType, - #[clap(flatten)] + #[command(flatten)] common: CommonOptions, }, - #[clap(name = "multi-get-transaction-blocks")] + #[command(name = "multi-get-transaction-blocks")] MultiGetTransactionBlocks { - #[clap(flatten)] + #[command(flatten)] common: CommonOptions, }, - #[clap(name = "multi-get-objects")] + #[command(name = "multi-get-objects")] MultiGetObjects { - #[clap(flatten)] + #[command(flatten)] common: CommonOptions, }, - #[clap(name = "get-object")] + #[command(name = "get-object")] GetObject { - #[clap(long)] + #[arg(long)] chunk_size: usize, - #[clap(flatten)] + #[command(flatten)] common: CommonOptions, }, - #[clap(name = "get-all-balances")] + #[command(name = "get-all-balances")] GetAllBalances { - #[clap(long)] + #[arg(long)] chunk_size: usize, - #[clap(flatten)] + #[command(flatten)] common: CommonOptions, }, - #[clap(name = "get-reference-gas-price")] + #[command(name = "get-reference-gas-price")] GetReferenceGasPrice { - #[clap(flatten)] + #[command(flatten)] common: CommonOptions, }, } diff --git a/crates/iota-single-node-benchmark/src/command.rs b/crates/iota-single-node-benchmark/src/command.rs index 60d98fc9f94..609ce4baad8 100644 --- a/crates/iota-single-node-benchmark/src/command.rs +++ b/crates/iota-single-node-benchmark/src/command.rs @@ -8,7 +8,7 @@ use clap::{Parser, Subcommand, ValueEnum}; use strum::EnumIter; #[derive(Parser)] -#[clap( +#[command( name = "iota-single-node-benchmark", about = "Benchmark a single validator node", rename_all = "kebab-case", @@ -46,7 +46,7 @@ pub struct Command { help = "Which component to benchmark" )] pub component: Component, - #[clap(subcommand)] + #[command(subcommand)] pub workload: WorkloadKind, } diff --git a/crates/iota-surfer/src/main.rs b/crates/iota-surfer/src/main.rs index 483b319375d..b8909cb1922 100644 --- a/crates/iota-surfer/src/main.rs +++ b/crates/iota-surfer/src/main.rs @@ -8,15 +8,15 @@ use clap::Parser; use tracing::info; #[derive(Parser)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] struct Args { - #[clap(long, help = "Number of seconds to surf, default to 30")] + #[arg(long, help = "Number of seconds to surf, default to 30")] pub run_duration: Option, - #[clap(long, help = "Number of seconds per epoch, default to 15")] + #[arg(long, help = "Number of seconds per epoch, default to 15")] pub epoch_duration: Option, - #[clap(long, help = "List of package paths to surf")] + #[arg(long, help = "List of package paths to surf")] packages: Vec, } diff --git a/crates/iota-tool/src/commands.rs b/crates/iota-tool/src/commands.rs index cad48ee406d..cd69944e63f 100644 --- a/crates/iota-tool/src/commands.rs +++ b/crates/iota-tool/src/commands.rs @@ -189,22 +189,22 @@ pub enum ToolCommand { #[command(name = "dump-packages")] DumpPackages { /// Connection information for a GraphQL service. - #[clap(long, short)] + #[arg(long, short)] rpc_url: String, /// Path to a non-existent directory that can be created and filled with /// package information. - #[clap(long, short)] + #[arg(long, short)] output_dir: PathBuf, /// Only fetch packages that were created before this checkpoint (given /// by its sequence number). - #[clap(long)] + #[arg(long)] before_checkpoint: Option, /// If false (default), log level will be overridden to "off", and /// output will be reduced to necessary status information. - #[clap(short, long = "verbose")] + #[arg(short, long = "verbose")] verbose: bool, }, @@ -253,36 +253,36 @@ pub enum ToolCommand { db_checkpoint_path: PathBuf, }, - #[clap( + #[command( name = "download-db-snapshot", about = "Downloads the legacy database snapshot via cloud object store, outputs to local disk" )] DownloadDBSnapshot { - #[clap(long = "epoch", conflicts_with = "latest")] + #[arg(long = "epoch", conflicts_with = "latest")] epoch: Option, - #[clap( + #[arg( long = "path", help = "the path to write the downloaded snapshot files" )] path: PathBuf, /// skip downloading indexes dir - #[clap(long = "skip-indexes")] + #[arg(long = "skip-indexes")] skip_indexes: bool, /// Number of parallel downloads to perform. Defaults to a reasonable /// value based on number of available logical cores. - #[clap(long = "num-parallel-downloads")] + #[arg(long = "num-parallel-downloads")] num_parallel_downloads: Option, /// Network to download snapshot for. Defaults to "mainnet". /// If `--snapshot-bucket` or `--archive-bucket` is not specified, /// the value of this flag is used to construct default bucket names. - #[clap(long = "network", default_value = "mainnet")] + #[arg(long = "network", default_value = "mainnet")] network: Chain, /// Snapshot bucket name. If not specified, defaults are /// based on value of `--network` flag. - #[clap(long = "snapshot-bucket", conflicts_with = "no_sign_request")] + #[arg(long = "snapshot-bucket", conflicts_with = "no_sign_request")] snapshot_bucket: Option, /// Snapshot bucket type - #[clap( + #[arg( long = "snapshot-bucket-type", conflicts_with = "no_sign_request", help = "Required if --no-sign-request is not set" @@ -290,13 +290,13 @@ pub enum ToolCommand { snapshot_bucket_type: Option, /// Path to snapshot directory on local filesystem. /// Only applicable if `--snapshot-bucket-type` is "file". - #[clap( + #[arg( long = "snapshot-path", help = "only used for testing, when --snapshot-bucket-type=FILE" )] snapshot_path: Option, /// If true, no authentication is needed for snapshot restores - #[clap( + #[arg( long = "no-sign-request", conflicts_with_all = &["snapshot_bucket", "snapshot_bucket_type"], help = "if set, no authentication is needed for snapshot restore" @@ -304,7 +304,7 @@ pub enum ToolCommand { no_sign_request: bool, /// Download snapshot of the latest available epoch. /// If `--epoch` is specified, then this flag gets ignored. - #[clap( + #[arg( long = "latest", conflicts_with = "epoch", help = "defaults to latest available snapshot in chosen bucket" @@ -312,40 +312,40 @@ pub enum ToolCommand { latest: bool, /// If false (default), log level will be overridden to "off", /// and output will be reduced to necessary status information. - #[clap(long = "verbose")] + #[arg(long = "verbose")] verbose: bool, }, // Restore from formal (slim, DB agnostic) snapshot. - #[clap( + #[command( name = "download-formal-snapshot", about = "Downloads formal database snapshot via cloud object store, outputs to local disk" )] DownloadFormalSnapshot { - #[clap(long = "epoch", conflicts_with = "latest")] + #[arg(long = "epoch", conflicts_with = "latest")] epoch: Option, - #[clap(long = "genesis")] + #[arg(long = "genesis")] genesis: PathBuf, - #[clap(long = "path")] + #[arg(long = "path")] path: PathBuf, /// Number of parallel downloads to perform. Defaults to a reasonable /// value based on number of available logical cores. - #[clap(long = "num-parallel-downloads")] + #[arg(long = "num-parallel-downloads")] num_parallel_downloads: Option, /// Verification mode to employ. - #[clap(long = "verify", default_value = "normal")] + #[arg(long = "verify", default_value = "normal")] verify: Option, /// Network to download snapshot for. Defaults to "mainnet". /// If `--snapshot-bucket` or `--archive-bucket` is not specified, /// the value of this flag is used to construct default bucket names. - #[clap(long = "network", default_value = "mainnet")] + #[arg(long = "network", default_value = "mainnet")] network: Chain, /// Snapshot bucket name. If not specified, defaults are /// based on value of `--network` flag. - #[clap(long = "snapshot-bucket", conflicts_with = "no_sign_request")] + #[arg(long = "snapshot-bucket", conflicts_with = "no_sign_request")] snapshot_bucket: Option, /// Snapshot bucket type - #[clap( + #[arg( long = "snapshot-bucket-type", conflicts_with = "no_sign_request", help = "Required if --no-sign-request is not set" @@ -353,10 +353,10 @@ pub enum ToolCommand { snapshot_bucket_type: Option, /// Path to snapshot directory on local filesystem. /// Only applicable if `--snapshot-bucket-type` is "file". - #[clap(long = "snapshot-path")] + #[arg(long = "snapshot-path")] snapshot_path: Option, /// If true, no authentication is needed for snapshot restores - #[clap( + #[arg( long = "no-sign-request", conflicts_with_all = &["snapshot_bucket", "snapshot_bucket_type"], help = "if set, no authentication is needed for snapshot restore" @@ -364,7 +364,7 @@ pub enum ToolCommand { no_sign_request: bool, /// Download snapshot of the latest available epoch. /// If `--epoch` is specified, then this flag gets ignored. - #[clap( + #[arg( long = "latest", conflicts_with = "epoch", help = "defaults to latest available snapshot in chosen bucket" @@ -372,7 +372,7 @@ pub enum ToolCommand { latest: bool, /// If false (default), log level will be overridden to "off", /// and output will be reduced to necessary status information. - #[clap(long = "verbose")] + #[arg(long = "verbose")] verbose: bool, /// If provided, all checkpoint summaries from genesis to the end of the @@ -381,11 +381,11 @@ pub enum ToolCommand { /// will be performed. If omitted, only end of epoch checkpoint /// summaries will be downloaded, and (if --verify is provided) /// will be verified via committee signature. - #[clap(long = "all-checkpoints")] + #[arg(long = "all-checkpoints")] all_checkpoints: bool, }, - #[clap(name = "replay")] + #[command(name = "replay")] Replay { #[arg(long = "rpc")] rpc_url: Option, diff --git a/crates/iota-transactional-test-runner/src/args.rs b/crates/iota-transactional-test-runner/src/args.rs index 82ff6ecc97f..706f21687f9 100644 --- a/crates/iota-transactional-test-runner/src/args.rs +++ b/crates/iota-transactional-test-runner/src/args.rs @@ -29,89 +29,89 @@ pub const IOTA_ARGS_LONG: &str = "iota-args"; #[derive(Clone, Debug, clap::Parser)] pub struct IotaRunArgs { - #[clap(long = "sender")] + #[arg(long = "sender")] pub sender: Option, - #[clap(long = "gas-price")] + #[arg(long = "gas-price")] pub gas_price: Option, - #[clap(long = "summarize")] + #[arg(long = "summarize")] pub summarize: bool, } #[derive(Debug, clap::Parser, Default)] pub struct IotaPublishArgs { - #[clap(long = "sender")] + #[arg(long = "sender")] pub sender: Option, - #[clap(long = "upgradeable", action = clap::ArgAction::SetTrue)] + #[arg(long = "upgradeable", action = clap::ArgAction::SetTrue)] pub upgradeable: bool, - #[clap(long = "dependencies", num_args(1..))] + #[arg(long = "dependencies", num_args(1..))] pub dependencies: Vec, - #[clap(long = "gas-price")] + #[arg(long = "gas-price")] pub gas_price: Option, } #[derive(Debug, clap::Parser)] pub struct IotaInitArgs { - #[clap(long = "accounts", num_args(1..))] + #[arg(long = "accounts", num_args(1..))] pub accounts: Option>, - #[clap(long = "protocol-version")] + #[arg(long = "protocol-version")] pub protocol_version: Option, - #[clap(long = "max-gas")] + #[arg(long = "max-gas")] pub max_gas: Option, - #[clap(long = "move-binary-format-version")] + #[arg(long = "move-binary-format-version")] pub move_binary_format_version: Option, - #[clap(long = "simulator")] + #[arg(long = "simulator")] pub simulator: bool, - #[clap(long = "custom-validator-account")] + #[arg(long = "custom-validator-account")] pub custom_validator_account: bool, - #[clap(long = "reference-gas-price")] + #[arg(long = "reference-gas-price")] pub reference_gas_price: Option, - #[clap(long = "default-gas-price")] + #[arg(long = "default-gas-price")] pub default_gas_price: Option, - #[clap(long = "object-snapshot-min-checkpoint-lag")] + #[arg(long = "object-snapshot-min-checkpoint-lag")] pub object_snapshot_min_checkpoint_lag: Option, - #[clap(long = "object-snapshot-max-checkpoint-lag")] + #[arg(long = "object-snapshot-max-checkpoint-lag")] pub object_snapshot_max_checkpoint_lag: Option, - #[clap(long = "flavor")] + #[arg(long = "flavor")] pub flavor: Option, } #[derive(Debug, clap::Parser)] pub struct ViewObjectCommand { - #[clap(value_parser = parse_fake_id)] + #[arg(value_parser = parse_fake_id)] pub id: FakeID, } #[derive(Debug, clap::Parser)] pub struct TransferObjectCommand { - #[clap(value_parser = parse_fake_id)] + #[arg(value_parser = parse_fake_id)] pub id: FakeID, - #[clap(long = "recipient")] + #[arg(long = "recipient")] pub recipient: String, - #[clap(long = "sender")] + #[arg(long = "sender")] pub sender: Option, - #[clap(long = "gas-budget")] + #[arg(long = "gas-budget")] pub gas_budget: Option, - #[clap(long = "gas-price")] + #[arg(long = "gas-price")] pub gas_price: Option, } #[derive(Debug, clap::Parser)] pub struct ConsensusCommitPrologueCommand { - #[clap(long = "timestamp-ms")] + #[arg(long = "timestamp-ms")] pub timestamp_ms: u64, } #[derive(Debug, clap::Parser)] pub struct ProgrammableTransactionCommand { - #[clap(long = "sender")] + #[arg(long = "sender")] pub sender: Option, - #[clap(long = "gas-budget")] + #[arg(long = "gas-budget")] pub gas_budget: Option, - #[clap(long = "gas-price")] + #[arg(long = "gas-price")] pub gas_price: Option, - #[clap(long = "dev-inspect")] + #[arg(long = "dev-inspect")] pub dev_inspect: bool, - #[clap( + #[arg( long = "inputs", value_parser = ParsedValue::::parse, num_args(1..), @@ -122,62 +122,62 @@ pub struct ProgrammableTransactionCommand { #[derive(Debug, clap::Parser)] pub struct UpgradePackageCommand { - #[clap(long = "package")] + #[arg(long = "package")] pub package: String, - #[clap(long = "upgrade-capability", value_parser = parse_fake_id)] + #[arg(long = "upgrade-capability", value_parser = parse_fake_id)] pub upgrade_capability: FakeID, - #[clap(long = "dependencies", num_args(1..))] + #[arg(long = "dependencies", num_args(1..))] pub dependencies: Vec, - #[clap(long = "sender")] + #[arg(long = "sender")] pub sender: String, - #[clap(long = "gas-budget")] + #[arg(long = "gas-budget")] pub gas_budget: Option, - #[clap(long = "syntax")] + #[arg(long = "syntax")] pub syntax: Option, - #[clap(long = "policy", default_value="compatible", value_parser = parse_policy)] + #[arg(long = "policy", default_value="compatible", value_parser = parse_policy)] pub policy: u8, - #[clap(long = "gas-price")] + #[arg(long = "gas-price")] pub gas_price: Option, } #[derive(Debug, clap::Parser)] pub struct StagePackageCommand { - #[clap(long = "syntax")] + #[arg(long = "syntax")] pub syntax: Option, - #[clap(long = "dependencies", num_args(1..))] + #[arg(long = "dependencies", num_args(1..))] pub dependencies: Vec, } #[derive(Debug, clap::Parser)] pub struct SetAddressCommand { pub address: String, - #[clap(value_parser = ParsedValue::::parse)] + #[arg(value_parser = ParsedValue::::parse)] pub input: ParsedValue, } #[derive(Debug, clap::Parser)] pub struct AdvanceClockCommand { - #[clap(long = "duration-ns")] + #[arg(long = "duration-ns")] pub duration_ns: u64, } #[derive(Debug, clap::Parser)] pub struct RunGraphqlCommand { - #[clap(long = "show-usage")] + #[arg(long = "show-usage")] pub show_usage: bool, - #[clap(long = "show-headers")] + #[arg(long = "show-headers")] pub show_headers: bool, - #[clap(long = "show-service-version")] + #[arg(long = "show-service-version")] pub show_service_version: bool, - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] pub cursors: Vec, } #[derive(Debug, clap::Parser)] pub struct ForceObjectSnapshotCatchup { - #[clap(long = "start-cp")] + #[arg(long = "start-cp")] pub start_cp: u64, - #[clap(long = "end-cp")] + #[arg(long = "end-cp")] pub end_cp: u64, } @@ -193,11 +193,11 @@ pub struct AdvanceEpochCommand { #[derive(Debug, clap::Parser)] pub struct SetRandomStateCommand { - #[clap(long = "randomness-round")] + #[arg(long = "randomness-round")] pub randomness_round: u64, - #[clap(long = "random-bytes")] + #[arg(long = "random-bytes")] pub random_bytes: String, - #[clap(long = "randomness-initial-version")] + #[arg(long = "randomness-initial-version")] pub randomness_initial_version: u64, } diff --git a/crates/iota/src/client_commands.rs b/crates/iota/src/client_commands.rs index b3bd252de87..a2021c0477d 100644 --- a/crates/iota/src/client_commands.rs +++ b/crates/iota/src/client_commands.rs @@ -104,50 +104,50 @@ mod profiler_tests; pub const GAS_SAFE_OVERHEAD: u64 = 1000; #[derive(Parser)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub enum IotaClientCommands { /// Default address used for commands when none specified - #[clap(name = "active-address")] + #[command(name = "active-address")] ActiveAddress, /// Default environment used for commands when none specified - #[clap(name = "active-env")] + #[command(name = "active-env")] ActiveEnv, /// Obtain the Addresses managed by the client. - #[clap(name = "addresses")] + #[command(name = "addresses")] Addresses { /// Sort by alias instead of address - #[clap(long, short = 's')] + #[arg(long, short = 's')] sort_by_alias: bool, }, /// List the coin balance of an address - #[clap(name = "balance")] + #[command(name = "balance")] Balance { /// Address (or its alias) #[arg(value_parser)] address: Option, /// Show balance for the specified coin (e.g., 0x2::iota::IOTA). /// All coins will be shown if none is passed. - #[clap(long, required = false)] + #[arg(long, required = false)] coin_type: Option, /// Show a list with each coin's object ID and balance - #[clap(long, required = false)] + #[arg(long, required = false)] with_coins: bool, }, /// Call Move function - #[clap(name = "call")] + #[command(name = "call")] Call { /// Object ID of the package, which contains the module - #[clap(long)] + #[arg(long)] package: ObjectID, /// The name of the module in the package - #[clap(long)] + #[arg(long)] module: String, /// Function name in module - #[clap(long)] + #[arg(long)] function: String, /// Type arguments to the generic function being called. /// All must be specified, or the call will fail. - #[clap( + #[arg( long, value_parser = parse_iota_type_tag, num_args(1..), @@ -155,29 +155,29 @@ pub enum IotaClientCommands { type_args: Vec, /// Simplified ordered args like in the function syntax /// ObjectIDs, Addresses must be hex strings - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] args: Vec, /// Optional gas price for this call. Currently use only for testing and /// not in production environments. - #[clap(hide = true)] + #[arg(hide = true)] gas_price: Option, - #[clap(flatten)] + #[command(flatten)] opts: OptsWithGas, }, /// Query the chain identifier from the rpc endpoint. - #[clap(name = "chain-identifier")] + #[command(name = "chain-identifier")] ChainIdentifier, /// Query a dynamic field by its address. - #[clap(name = "dynamic-field")] + #[command(name = "dynamic-field")] DynamicFieldQuery { /// The ID of the parent object - #[clap(name = "object_id")] + #[arg(name = "object_id")] id: ObjectID, /// Optional paging cursor - #[clap(long)] + #[arg(long)] cursor: Option, /// Maximum item returned per page - #[clap(long, default_value = "50")] + #[arg(long, default_value = "50")] limit: usize, }, /// List all IOTA environments @@ -188,10 +188,10 @@ pub enum IotaClientCommands { /// BCS serialized transaction data bytes without its type tag, as /// base64 encoded string. This is the output of iota client command /// using --serialize-unsigned-transaction. - #[clap(long)] + #[arg(long)] tx_bytes: String, /// A list of Base64 encoded signatures `flag || signature || pubkey`. - #[clap(long)] + #[arg(long)] signatures: Vec, }, /// Execute a combined serialized SenderSignedData string. @@ -199,39 +199,37 @@ pub enum IotaClientCommands { /// BCS serialized sender signed data, as base64 encoded string. This is /// the output of iota client command using /// --serialize-signed-transaction. - #[clap(long)] + #[arg(long)] signed_tx_bytes: String, }, /// Request gas coin from faucet. By default, it will use the active address /// and the active network. - #[clap[name = "faucet"]] + #[command(name = "faucet")] Faucet { /// Address (or its alias) - #[clap(long)] - #[arg(value_parser)] + #[arg(long, value_parser)] address: Option, /// The url to the faucet - #[clap(long)] + #[arg(long)] url: Option, }, /// Obtain all gas objects owned by the address. /// An address' alias can be used instead of the address. - #[clap(name = "gas")] + #[command(name = "gas")] Gas { /// Address (or its alias) owning the objects - #[clap(name = "owner_address")] - #[arg(value_parser)] + #[arg(name = "owner_address", value_parser)] address: Option, }, /// Merge two coin objects into one coin MergeCoin { /// The address of the coin to merge into. - #[clap(long)] + #[arg(long)] primary_coin: ObjectID, /// The address of the coin to be merged. - #[clap(long)] + #[arg(long)] coin_to_merge: ObjectID, - #[clap(flatten)] + #[command(flatten)] opts: OptsWithGas, }, /// Generate new address and keypair with optional key scheme {ed25519 | @@ -240,72 +238,72 @@ pub enum IotaClientCommands { /// word18 | word21 | word24} which defaults to word12, and optional /// derivation path which defaults to m/44'/4218'/0'/0'/0' for ed25519, /// m/54'/4218'/0'/0/0 for secp256k1 or m/74'/4218'/0'/0/0 for secp256r1. - #[clap(name = "new-address")] + #[command(name = "new-address")] NewAddress { - #[clap(long, default_value_t = SignatureScheme::ED25519)] + #[arg(long, default_value_t = SignatureScheme::ED25519)] key_scheme: SignatureScheme, /// The alias must start with a letter and can contain only letters, /// digits, hyphens (-), or underscores (_). - #[clap(long)] + #[arg(long)] alias: Option, - #[clap(long)] + #[arg(long)] word_length: Option, - #[clap(long)] + #[arg(long)] derivation_path: Option, }, /// Add new IOTA environment. - #[clap(name = "new-env")] + #[command(name = "new-env")] NewEnv { /// The alias for the environment. - #[clap(long)] + #[arg(long)] alias: String, /// The RPC Url, for example http://127.0.0.1:9000. - #[clap(long, value_hint = ValueHint::Url)] + #[arg(long, value_hint = ValueHint::Url)] rpc: String, /// Optional WebSocket Url, for example ws://127.0.0.1:9000. - #[clap(long, value_hint = ValueHint::Url)] + #[arg(long, value_hint = ValueHint::Url)] ws: Option, - #[clap(long, help = "Basic auth in the format of username:password")] + #[arg(long, help = "Basic auth in the format of username:password")] basic_auth: Option, /// Optional faucet Url, for example http://127.0.0.1:9123/v1/gas. - #[clap(long, value_hint = ValueHint::Url)] + #[arg(long, value_hint = ValueHint::Url)] faucet: Option, }, /// Get object info - #[clap(name = "object")] + #[command(name = "object")] Object { /// Object ID of the object to fetch - #[clap(name = "object_id")] + #[arg(name = "object_id")] id: ObjectID, /// Return the bcs serialized version of the object - #[clap(long)] + #[arg(long)] bcs: bool, }, /// Obtain all objects owned by the address. It also accepts an address by /// its alias. - #[clap(name = "objects")] + #[command(name = "objects")] Objects { /// Address owning the object. If no address is provided, it will show /// all objects owned by `iota client active-address`. - #[clap(name = "owner_address")] + #[arg(name = "owner_address")] address: Option, }, /// Pay coins to recipients following specified amounts, with input coins. /// Length of recipients must be the same as that of amounts. - #[clap(name = "pay")] + #[command(name = "pay")] Pay { /// The input coins to be used for pay recipients, following the /// specified amounts. - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] input_coins: Vec, /// The recipient addresses, must be of same length as amounts. /// Aliases of addresses are also accepted as input. - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] recipients: Vec, /// The amounts to be paid, following the order of recipients. - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] amounts: Vec, - #[clap(flatten)] + #[command(flatten)] opts: OptsWithGas, }, /// Pay all residual IOTA coins to the recipient with input coins, after @@ -314,13 +312,13 @@ pub enum IotaClientCommands { PayAllIota { /// The input coins to be used for pay recipients, including the gas /// coin. - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] input_coins: Vec, /// The recipient address (or its alias if it's an address in the /// keystore). - #[clap(long)] + #[arg(long)] recipient: KeyIdentity, - #[clap(flatten)] + #[command(flatten)] opts: Opts, }, /// Pay IOTA coins to recipients following following specified amounts, with @@ -330,161 +328,161 @@ pub enum IotaClientCommands { PayIota { /// The input coins to be used for pay recipients, including the gas /// coin. - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] input_coins: Vec, /// The recipient addresses, must be of same length as amounts. /// Aliases of addresses are also accepted as input. - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] recipients: Vec, /// The amounts to be paid, following the order of recipients. - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] amounts: Vec, - #[clap(flatten)] + #[command(flatten)] opts: Opts, }, /// Run a PTB from the provided args - #[clap(name = "ptb")] + #[command(name = "ptb")] PTB(PTB), /// Publish Move modules - #[clap(name = "publish")] + #[command(name = "publish")] Publish { /// Path to directory containing a Move package - #[clap(name = "package_path", global = true, default_value = ".")] + #[arg(name = "package_path", global = true, default_value = ".")] package_path: PathBuf, /// Package build options - #[clap(flatten)] + #[command(flatten)] build_config: MoveBuildConfig, - #[clap(flatten)] + #[command(flatten)] opts: OptsWithGas, /// Publish the package without checking whether compiling dependencies /// from source results in bytecode matching the dependencies /// found on-chain. - #[clap(long)] + #[arg(long)] skip_dependency_verification: bool, /// Also publish transitive dependencies that have not already been /// published. - #[clap(long)] + #[arg(long)] with_unpublished_dependencies: bool, }, /// Split a coin object into multiple coins. - #[clap(group(ArgGroup::new("split").required(true).args(&["amounts", "count"])))] + #[command(group(ArgGroup::new("split").required(true).args(&["amounts", "count"])))] SplitCoin { /// ID of the coin object to split - #[clap(long)] + #[arg(long)] coin_id: ObjectID, /// Specific amounts to split out from the coin - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] amounts: Option>, /// Count of equal-size coins to split into - #[clap(long)] + #[arg(long)] count: Option, - #[clap(flatten)] + #[command(flatten)] opts: OptsWithGas, }, /// Switch active address and env (e.g. testnet, devnet, localnet, ...). - #[clap(name = "switch")] + #[command(name = "switch")] Switch { /// An address to be used as the active address for subsequent /// commands. It accepts also the alias of the address. - #[clap(long)] + #[arg(long)] address: Option, /// The alias of the env (e.g. testnet, devnet, localnet, ...) to be /// used for subsequent commands. - #[clap(long)] + #[arg(long)] env: Option, }, /// Get a transaction block with the effects, events and object changes of /// its execution - #[clap(name = "tx-block")] + #[command(name = "tx-block")] TransactionBlock { /// Digest of the transaction block - #[clap(name = "digest")] + #[arg(name = "digest")] digest: TransactionDigest, }, /// Transfer object - #[clap(name = "transfer")] + #[command(name = "transfer")] Transfer { /// Recipient address (or its alias if it's an address in the keystore) - #[clap(long)] + #[arg(long)] to: KeyIdentity, /// ID of the object to transfer - #[clap(long)] + #[arg(long)] object_id: ObjectID, - #[clap(flatten)] + #[command(flatten)] opts: OptsWithGas, }, /// Upgrade Move modules - #[clap(name = "upgrade")] + #[command(name = "upgrade")] Upgrade { /// Path to directory containing a Move package - #[clap(name = "package_path", global = true, default_value = ".")] + #[arg(name = "package_path", global = true, default_value = ".")] package_path: PathBuf, /// ID of the upgrade capability for the package being upgraded. - #[clap(long)] + #[arg(long)] upgrade_capability: ObjectID, /// Package build options - #[clap(flatten)] + #[command(flatten)] build_config: MoveBuildConfig, - #[clap(flatten)] + #[command(flatten)] opts: OptsWithGas, /// Publish the package without checking whether compiling dependencies /// from source results in bytecode matching the dependencies /// found on-chain. - #[clap(long)] + #[arg(long)] skip_dependency_verification: bool, /// Also publish transitive dependencies that have not already been /// published. - #[clap(long)] + #[arg(long)] with_unpublished_dependencies: bool, }, /// Run the bytecode verifier on the package - #[clap(name = "verify-bytecode-meter")] + #[command(name = "verify-bytecode-meter")] VerifyBytecodeMeter { /// Path to directory containing a Move package, (defaults to the /// current directory) - #[clap(name = "package", long, global = true)] + #[arg(name = "package", long, global = true)] package_path: Option, /// Protocol version to use for the bytecode verifier (defaults to the /// latest protocol version) - #[clap(name = "protocol-version", long)] + #[arg(name = "protocol-version", long)] protocol_version: Option, /// Paths to specific pre-compiled module bytecode to verify (instead of /// an entire package). Multiple modules can be verified by /// passing multiple --module flags. They will be treated as if /// they were one package (subject to the overall package limit). - #[clap(name = "module", long, action = clap::ArgAction::Append, global = true)] + #[arg(name = "module", long, action = clap::ArgAction::Append, global = true)] module_paths: Vec, /// Package build options - #[clap(flatten)] + #[command(flatten)] build_config: MoveBuildConfig, }, /// Verify local Move packages against on-chain packages, and optionally /// their dependencies. - #[clap(name = "verify-source")] + #[command(name = "verify-source")] VerifySource { /// Path to directory containing a Move package - #[clap(name = "package_path", global = true, default_value = ".")] + #[arg(name = "package_path", global = true, default_value = ".")] package_path: PathBuf, /// Package build options - #[clap(flatten)] + #[command(flatten)] build_config: MoveBuildConfig, /// Verify on-chain dependencies. - #[clap(long)] + #[arg(long)] verify_deps: bool, /// Don't verify source (only valid if --verify-deps is enabled). - #[clap(long)] + #[arg(long)] skip_source: bool, /// If specified, override the addresses for the package's own modules /// with this address. Only works for unpublished modules (whose /// addresses are currently 0x0). - #[clap(long)] + #[arg(long)] address_override: Option, }, /// Profile the gas usage of a transaction. Unless an output filepath is not /// specified, outputs a file /// `gas_profile_{tx_digest}_{unix_timestamp}.json` which can be opened in a /// flamegraph tool such as speedscope. - #[clap(name = "profile-transaction")] + #[command(name = "profile-transaction")] ProfileTransaction { /// The digest of the transaction to replay #[arg(long, short)] @@ -500,7 +498,7 @@ pub enum IotaClientCommands { }, /// Replay a given transaction to view transaction effects. Set environment /// variable MOVE_VM_STEP=1 to debug. - #[clap(name = "replay-transaction")] + #[command(name = "replay-transaction")] ReplayTransaction { /// The digest of the transaction to replay #[arg(long, short)] @@ -521,7 +519,7 @@ pub enum IotaClientCommands { protocol_version: Option, }, /// Replay transactions listed in a file. - #[clap(name = "replay-batch")] + #[command(name = "replay-batch")] ReplayBatch { /// The path to the file of transaction digests to replay, with one /// digest per line @@ -582,7 +580,7 @@ pub struct Opts { /// If not provided, all fields are displayed. /// The fields are: effects, input, events, object_changes, /// balance_changes. - #[clap(long, required = false, num_args = 0.., value_parser = parse_emit_option, default_value = "effects,input,events,object_changes,balance_changes")] + #[arg(long, required = false, num_args = 0.., value_parser = parse_emit_option, default_value = "effects,input,events,object_changes,balance_changes")] pub emit: HashSet, } @@ -592,9 +590,9 @@ pub struct OptsWithGas { /// ID of the gas object for gas payment. /// If not provided, a gas object with at least gas_budget value will be /// selected - #[clap(long)] + #[arg(long)] pub gas: Option, - #[clap(flatten)] + #[command(flatten)] pub rest: Opts, } diff --git a/crates/iota/src/client_ptb/ptb.rs b/crates/iota/src/client_ptb/ptb.rs index e179fd914a2..f81eed6b211 100644 --- a/crates/iota/src/client_ptb/ptb.rs +++ b/crates/iota/src/client_ptb/ptb.rs @@ -33,9 +33,9 @@ use crate::{ }; #[derive(Clone, Debug, Args)] -#[clap(disable_help_flag = true)] +#[command(disable_help_flag = true)] pub struct PTB { - #[clap(trailing_var_arg = true, allow_hyphen_values = true)] + #[arg(trailing_var_arg = true, allow_hyphen_values = true)] pub args: Vec, } diff --git a/crates/iota/src/console.rs b/crates/iota/src/console.rs index f40cdb7a51f..3f1e3a66967 100644 --- a/crates/iota/src/console.rs +++ b/crates/iota/src/console.rs @@ -26,12 +26,12 @@ const IOTA: &str = " ____ __ ______ __ /___/\\____/\\__/\\__,_/ \\____/\\____/_/ /_/____/\\____/_/\\___/"; #[derive(Parser)] -#[clap(name = "", rename_all = "kebab-case", no_binary_name = true)] +#[command(name = "", rename_all = "kebab-case", no_binary_name = true)] pub struct ConsoleOpts { - #[clap(subcommand)] + #[command(subcommand)] pub command: IotaClientCommands, /// Returns command outputs in JSON format. - #[clap(long, global = true)] + #[arg(long, global = true)] pub json: bool, } diff --git a/crates/iota/src/fire_drill.rs b/crates/iota/src/fire_drill.rs index eb27a382853..889df2b8002 100644 --- a/crates/iota/src/fire_drill.rs +++ b/crates/iota/src/fire_drill.rs @@ -48,13 +48,13 @@ pub enum FireDrill { #[derive(Parser)] pub struct MetadataRotation { /// Path to iota node config. - #[clap(long = "iota-node-config-path")] + #[arg(long = "iota-node-config-path")] iota_node_config_path: PathBuf, /// Path to account key file. - #[clap(long = "account-key-path")] + #[arg(long = "account-key-path")] account_key_path: PathBuf, /// Jsonrpc url for a reliable fullnode. - #[clap(long = "fullnode-rpc-url")] + #[arg(long = "fullnode-rpc-url")] fullnode_rpc_url: String, } diff --git a/crates/iota/src/genesis_ceremony.rs b/crates/iota/src/genesis_ceremony.rs index a1366c4499d..c235d0f159c 100644 --- a/crates/iota/src/genesis_ceremony.rs +++ b/crates/iota/src/genesis_ceremony.rs @@ -36,12 +36,12 @@ use crate::genesis_inspector::examine_genesis_checkpoint; pub struct Ceremony { /// The directory where the Genesis builder will be stored. Defaults to the /// current directory. - #[clap(long)] + #[arg(long)] path: Option, /// The protocol version to use for this snapshot. - #[clap(long, default_value_t = MAX_PROTOCOL_VERSION)] + #[arg(long, default_value_t = MAX_PROTOCOL_VERSION)] protocol_version: u64, - #[clap(subcommand)] + #[command(subcommand)] command: CeremonyCommand, } @@ -60,44 +60,44 @@ pub enum CeremonyCommand { /// Add a validator to the Genesis builder. AddValidator { /// The name of the validator. - #[clap(long)] + #[arg(long)] name: String, /// The path to the BLS12381 authority key file for the validator. - #[clap(long)] + #[arg(long)] authority_key_file: PathBuf, /// The path to the Ed25519 network key file for the consensus protocol. - #[clap(long)] + #[arg(long)] protocol_key_file: PathBuf, /// The path to the Ed25519 network key file for the account. - #[clap(long)] + #[arg(long)] account_key_file: PathBuf, /// The path to the Ed25519 network key file. - #[clap(long)] + #[arg(long)] network_key_file: PathBuf, /// The network address. This must be a TCP address in ASCII format. - #[clap(long)] + #[arg(long)] network_address: Multiaddr, /// The peer-to-peer address. This must be a UDP address in ASCII /// format. - #[clap(long)] + #[arg(long)] p2p_address: Multiaddr, /// The primary address. This must be a UDP address in ASCII /// format. - #[clap(long)] + #[arg(long)] primary_address: Multiaddr, /// An optional description of the validator. - #[clap(long)] + #[arg(long)] description: Option, /// An optional URL pointing to an image for the validator. - #[clap(long)] + #[arg(long)] image_url: Option, /// An optional URL pointing to the validator webpage. - #[clap(long)] + #[arg(long)] project_url: Option, }, /// Initialize token distribution schedule. InitTokenDistributionSchedule { - #[clap( + #[arg( long, help = "The path to the csv file with the token allocations", name = "token_allocations.csv" @@ -108,20 +108,19 @@ pub enum CeremonyCommand { ListValidators, /// Initialize the validator delegations. InitDelegations { - #[clap(long, help = "Path to the delegations file.", name = "delegations.csv")] + #[arg(long, help = "Path to the delegations file.", name = "delegations.csv")] delegations_path: PathBuf, }, /// Build the Genesis checkpoint. BuildUnsignedCheckpoint { - #[clap( + #[arg( long, help = "Define paths to local migration snapshots.", - name = "path" + name = "path", + num_args(0..) )] - #[arg(num_args(0..))] local_migration_snapshots: Vec, - #[clap(long, name = "iota|", help = "Remote migration snapshots.")] - #[arg(num_args(0..))] + #[arg(long, name = "iota|", help = "Remote migration snapshots.", num_args(0..))] remote_migration_snapshots: Vec, }, /// Examine the details of the built Genesis checkpoint. @@ -129,7 +128,7 @@ pub enum CeremonyCommand { /// Verify and sign the built Genesis checkpoint. VerifyAndSign { /// The path to a key file which will be used to sign the checkpoint. - #[clap(long)] + #[arg(long)] key_file: PathBuf, }, /// Create the Genesis blob file from the current configuration. diff --git a/crates/iota/src/iota_commands.rs b/crates/iota/src/iota_commands.rs index adf45932813..bf50f21c480 100644 --- a/crates/iota/src/iota_commands.rs +++ b/crates/iota/src/iota_commands.rs @@ -86,7 +86,7 @@ pub struct IndexerFeatureArgs { /// and value: `--with-indexer=6124` or `--with-indexer=0.0.0.0`, or /// `--with-indexer=0.0.0.0:9124` The indexer will be started in writer /// mode and reader mode. - #[clap(long, + #[arg(long, default_missing_value = "0.0.0.0:9124", num_args = 0..=1, require_equals = true, @@ -101,7 +101,7 @@ pub struct IndexerFeatureArgs { /// `--with-graphql=0.0.0.0:9125` Note that GraphQL requires a running /// indexer, which will be enabled by default if the `--with-indexer` /// flag is not set. - #[clap( + #[arg( long, default_missing_value = "0.0.0.0:9125", num_args = 0..=1, @@ -111,23 +111,23 @@ pub struct IndexerFeatureArgs { with_graphql: Option, /// Port for the Indexer Postgres DB. Default port is 5432. - #[clap(long, default_value = "5432")] + #[arg(long, default_value = "5432")] pg_port: u16, /// Hostname for the Indexer Postgres DB. Default host is localhost. - #[clap(long, default_value = "localhost")] + #[arg(long, default_value = "localhost")] pg_host: String, /// DB name for the Indexer Postgres DB. Default DB name is iota_indexer. - #[clap(long, default_value = "iota_indexer")] + #[arg(long, default_value = "iota_indexer")] pg_db_name: String, /// DB username for the Indexer Postgres DB. Default username is postgres. - #[clap(long, default_value = "postgres")] + #[arg(long, default_value = "postgres")] pg_user: String, /// DB password for the Indexer Postgres DB. Default password is postgrespw. - #[clap(long, default_value = "postgrespw")] + #[arg(long, default_value = "postgrespw")] pg_password: String, } @@ -147,7 +147,7 @@ impl IndexerFeatureArgs { } #[derive(Parser)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub enum IotaCommand { /// Start a local network in two modes: saving state between re-runs and not /// saving state between re-runs. Please use (--help) to see the full @@ -160,7 +160,7 @@ pub enum IotaCommand { /// generate the genesis blob, and start the network. /// /// Note that if you want to start an indexer, Postgres DB is required. - #[clap(name = "start")] + #[command(name = "start")] Start { /// Config directory that will be used to store network config, node db, /// keystore. @@ -168,7 +168,7 @@ pub enum IotaCommand { /// be used to start this process. Use with caution as the `-f` flag /// will overwrite the existing config directory. We can use any config /// dir that is generated by the `iota genesis`. - #[clap(long = "network.config")] + #[arg(long = "network.config")] config_dir: Option, /// A new genesis is created each time this flag is set, and state is @@ -179,7 +179,7 @@ pub enum IotaCommand { /// To run with persisted state, do not pass this flag and use the `iota /// genesis` command to generate a genesis that can be used to /// start the network with. - #[clap(long)] + #[arg(long)] force_regenesis: bool, /// Start a faucet with default host and port: 0.0.0.0:9123. This flag @@ -187,7 +187,7 @@ pub enum IotaCommand { /// When providing a specific value, please use the = sign between the /// flag and value: `--with-faucet=6124` or /// `--with-faucet=0.0.0.0`, or `--with-faucet=0.0.0.0:9123` - #[clap( + #[arg( long, default_missing_value = "0.0.0.0:9123", num_args = 0..=1, @@ -198,15 +198,15 @@ pub enum IotaCommand { /// Set the amount of nanos that the faucet will put in an object. /// Defaults to `200000000000`(200 IOTA). - #[clap(long)] + #[arg(long)] faucet_amount: Option, #[cfg(feature = "indexer")] - #[clap(flatten)] + #[command(flatten)] indexer_feature_args: IndexerFeatureArgs, /// Port to start the Fullnode RPC server on. Default port is 9000. - #[clap(long, default_value = "9000")] + #[arg(long, default_value = "9000")] fullnode_rpc_port: u16, /// Set the epoch duration. Can only be used when `--force-regenesis` @@ -214,7 +214,7 @@ pub enum IotaCommand { /// be auto-generated. When this flag is not set but /// `--force-regenesis` is set, the epoch duration will be set to 60 /// seconds. - #[clap(long)] + #[arg(long)] epoch_duration_ms: Option, /// Make the fullnode dump executed checkpoints as files to this @@ -226,37 +226,35 @@ pub enum IotaCommand { data_ingestion_dir: Option, /// Start the network without a fullnode - #[clap(long = "no-full-node")] + #[arg(long = "no-full-node")] no_full_node: bool, /// The path to local migration snapshot files - #[clap(long, name = "path")] - #[arg(num_args(0..))] + #[arg(long, name = "path", num_args(0..))] local_migration_snapshots: Vec, /// Remotely stored migration snapshots. - #[clap(long, name = "iota|")] - #[arg(num_args(0..))] + #[arg(long, name = "iota|", num_args(0..))] remote_migration_snapshots: Vec, - #[clap(long, help = "Specify the delegator address")] + #[arg(long, help = "Specify the delegator address")] delegator: Option, }, /// Bootstrap and initialize a new iota network - #[clap(name = "genesis")] + #[command(name = "genesis")] Genesis { - #[clap(long, help = "Start genesis with a given config file")] + #[arg(long, help = "Start genesis with a given config file")] from_config: Option, - #[clap( + #[arg( long, help = "Build a genesis config, write it to the specified path, and exit" )] write_config: Option, - #[clap(long)] + #[arg(long)] working_dir: Option, - #[clap(short, long, help = "Forces overwriting existing configuration")] + #[arg(short, long, help = "Forces overwriting existing configuration")] force: bool, - #[clap(long = "epoch-duration-ms")] + #[arg(long = "epoch-duration-ms")] epoch_duration_ms: Option, - #[clap( + #[arg( long, value_name = "ADDR", num_args(1..), @@ -264,116 +262,114 @@ pub enum IotaCommand { help = "A list of ip addresses to generate a genesis suitable for benchmarks" )] benchmark_ips: Option>, - #[clap( + #[arg( long, help = "Creates an extra faucet configuration for iota persisted runs." )] with_faucet: bool, - #[clap( + #[arg( long, help = "The number of validators in the network.", default_value_t = DEFAULT_NUMBER_OF_AUTHORITIES )] num_validators: usize, /// The path to local migration snapshot files - #[clap(long, name = "path")] - #[arg(num_args(0..))] + #[arg(long, name = "path", num_args(0..))] local_migration_snapshots: Vec, /// Remotely stored migration snapshots. - #[clap(long, name = "iota|")] - #[arg(num_args(0..))] + #[arg(long, name = "iota|", num_args(0..))] remote_migration_snapshots: Vec, - #[clap(long, help = "Specify the delegator address")] + #[arg(long, help = "Specify the delegator address")] delegator: Option, }, /// Create an IOTA Genesis Ceremony with multiple remote validators. GenesisCeremony(Ceremony), /// IOTA keystore tool. - #[clap(name = "keytool")] + #[command(name = "keytool")] KeyTool { - #[clap(long)] + #[arg(long)] keystore_path: Option, /// Return command outputs in json format - #[clap(long, global = true)] + #[arg(long, global = true)] json: bool, /// Subcommands. - #[clap(subcommand)] + #[command(subcommand)] cmd: KeyToolCommand, }, /// Start IOTA interactive console. - #[clap(name = "console")] + #[command(name = "console")] Console { /// Sets the file storing the state of our user accounts (an empty one /// will be created if missing) - #[clap(long = "client.config")] + #[arg(long = "client.config")] config: Option, }, /// Client for interacting with the IOTA network. - #[clap(name = "client")] + #[command(name = "client")] Client { /// Sets the file storing the state of our user accounts (an empty one /// will be created if missing) - #[clap(long = "client.config")] + #[arg(long = "client.config")] config: Option, - #[clap(subcommand)] + #[command(subcommand)] cmd: Option, /// Return command outputs in json format. - #[clap(long, global = true)] + #[arg(long, global = true)] json: bool, - #[clap(short = 'y', long = "yes")] + #[arg(short = 'y', long = "yes")] accept_defaults: bool, }, /// A tool for validators and validator candidates. - #[clap(name = "validator")] + #[command(name = "validator")] Validator { /// Sets the file storing the state of our user accounts (an empty one /// will be created if missing) - #[clap(long = "client.config")] + #[arg(long = "client.config")] config: Option, - #[clap(subcommand)] + #[command(subcommand)] cmd: Option, /// Return command outputs in json format. - #[clap(long, global = true)] + #[arg(long, global = true)] json: bool, - #[clap(short = 'y', long = "yes")] + #[arg(short = 'y', long = "yes")] accept_defaults: bool, }, /// Tool to build and test Move applications. - #[clap(name = "move")] + #[command(name = "move")] Move { /// Path to a package which the command should be run with respect to. - #[clap(long = "path", short = 'p', global = true)] + #[arg(long = "path", short = 'p', global = true)] package_path: Option, /// Sets the file storing the state of our user accounts (an empty one /// will be created if missing) Only used when the /// `--dump-bytecode-as-base64` is set. - #[clap(long = "client.config")] + #[arg(long = "client.config")] config: Option, /// Package build options - #[clap(flatten)] + #[command(flatten)] build_config: BuildConfig, /// Subcommands. - #[clap(subcommand)] + #[command(subcommand)] cmd: iota_move::Command, }, /// Command to initialize the bridge committee, usually used when /// running local bridge cluster. - #[clap(name = "bridge-committee-init")] + #[command(name = "bridge-committee-init")] BridgeInitialize { - #[clap(long = "network.config")] + #[arg(long = "network.config")] network_config: Option, - #[clap(long = "client.config")] + #[arg(long = "client.config")] client_config: Option, - #[clap(long = "bridge_committee.config")] + #[arg(long = "bridge_committee.config")] bridge_committee_config_path: PathBuf, }, /// Tool for Fire Drill FireDrill { - #[clap(subcommand)] + #[command(subcommand)] fire_drill: FireDrill, }, /// Invoke IOTA's move-analyzer via CLI - #[clap(name = "analyzer", hide = true)] + #[command(name = "analyzer", hide = true)] Analyzer, /// Generate completion files for various shells #[cfg(feature = "gen-completions")] diff --git a/crates/iota/src/keytool.rs b/crates/iota/src/keytool.rs index 50f940abd9a..ca05ccd35f8 100644 --- a/crates/iota/src/keytool.rs +++ b/crates/iota/src/keytool.rs @@ -61,7 +61,7 @@ use tracing::info; use crate::key_identity::{KeyIdentity, get_identity_address_from_keystore}; #[derive(Subcommand)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub enum KeyToolCommand { /// Convert private key in Hex or Base64 to new format (Bech32 /// encoded 33 byte flag || private key starting with "iotaprivkey"). @@ -73,21 +73,21 @@ pub enum KeyToolCommand { /// signature is provided, verify the signature against the transaction /// and output the result. DecodeOrVerifyTx { - #[clap(long)] + #[arg(long)] tx_bytes: String, - #[clap(long)] + #[arg(long)] sig: Option, - #[clap(long, default_value = "0")] + #[arg(long, default_value = "0")] cur_epoch: u64, }, /// Given a Base64 encoded MultiSig signature, decode its components. /// If tx_bytes is passed in, verify the multisig. DecodeMultiSig { - #[clap(long)] + #[arg(long)] multisig: MultiSig, - #[clap(long)] + #[arg(long)] tx_bytes: Option, - #[clap(long, default_value = "0")] + #[arg(long, default_value = "0")] cur_epoch: u64, }, /// Output the private key of the given key identity in IOTA CLI Keystore as @@ -128,7 +128,7 @@ pub enum KeyToolCommand { /// Sets an alias for this address. The alias must start with a letter /// and can contain only letters, digits, hyphens (-), or underscores /// (_). - #[clap(long)] + #[arg(long)] alias: Option, input_string: String, key_scheme: SignatureScheme, @@ -138,17 +138,17 @@ pub enum KeyToolCommand { /// name in iota.keystore. List { /// Sort by alias - #[clap(long, short = 's')] + #[arg(long, short = 's')] sort_by_alias: bool, }, /// To MultiSig IOTA Address. Pass in a list of all public keys `flag || pk` /// in Base64. See `keytool list` for example public keys. MultiSigAddress { - #[clap(long)] + #[arg(long)] threshold: ThresholdUnit, - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] pks: Vec, - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] weights: Vec, }, /// Provides a list of participating signatures (`flag || sig || pk` encoded @@ -162,13 +162,13 @@ pub enum KeyToolCommand { /// e.g. for [pk1, pk2, pk3, pk4, pk5], [sig1, sig2, sig5] is valid, but /// [sig2, sig1, sig5] is invalid. MultiSigCombinePartialSig { - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] sigs: Vec, - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] pks: Vec, - #[clap(long, num_args(1..))] + #[arg(long, num_args(1..))] weights: Vec, - #[clap(long)] + #[arg(long)] threshold: ThresholdUnit, }, /// Read the content at the provided file path. The accepted format can be @@ -182,11 +182,11 @@ pub enum KeyToolCommand { /// serialized transaction bytes itself and its intent. If intent is absent, /// default will be used. Sign { - #[clap(long)] + #[arg(long)] address: KeyIdentity, - #[clap(long)] + #[arg(long)] data: String, - #[clap(long)] + #[arg(long)] intent: Option, }, /// Creates a signature by leveraging AWS KMS. Pass in a key-id to leverage @@ -196,13 +196,13 @@ pub enum KeyToolCommand { /// Base64 encoded of the BCS serialized transaction bytes itself and /// its intent. If intent is absent, default will be used. SignKMS { - #[clap(long)] + #[arg(long)] data: String, - #[clap(long)] + #[arg(long)] keyid: String, - #[clap(long)] + #[arg(long)] intent: Option, - #[clap(long)] + #[arg(long)] base64pk: String, }, /// Update an old alias to a new one. @@ -219,15 +219,15 @@ pub enum KeyToolCommand { // /// create a test transaction, use the ephemeral key to sign and execute it // /// by assembling to a serialized zkLogin signature. // ZkLoginSignAndExecuteTx { - // #[clap(long)] + // #[arg(long)] // max_epoch: EpochId, - // #[clap(long, default_value = "devnet")] + // #[arg(long, default_value = "devnet")] // network: String, - // #[clap(long, default_value = "false")] + // #[arg(long, default_value = "false")] // fixed: bool, // if true, use a fixed kp generated from [0; 32] seed. - // #[clap(long, default_value = "false")] + // #[arg(long, default_value = "false")] // test_multisig: bool, // if true, use a multisig address with zklogin and a traditional - // kp. #[clap(long, default_value = "false")] + // kp. #[arg(long, default_value = "false")] // sign_with_sk: bool, /* if true, execute tx with the traditional sig (in the multisig), // * otherwise with the zklogin sig. */ // }, @@ -235,21 +235,21 @@ pub enum KeyToolCommand { // /// not work (for Facebook). All the inputs required here are printed from // /// the command above. // ZkLoginEnterToken { - // #[clap(long)] + // #[arg(long)] // parsed_token: String, - // #[clap(long)] + // #[arg(long)] // max_epoch: EpochId, - // #[clap(long)] + // #[arg(long)] // jwt_randomness: String, - // #[clap(long)] + // #[arg(long)] // kp_bigint: String, - // #[clap(long)] + // #[arg(long)] // ephemeral_key_identifier: IotaAddress, - // #[clap(long, default_value = "devnet")] + // #[arg(long, default_value = "devnet")] // network: String, - // #[clap(long, default_value = "false")] + // #[arg(long, default_value = "false")] // test_multisig: bool, - // #[clap(long, default_value = "false")] + // #[arg(long, default_value = "false")] // sign_with_sk: bool, // }, // /// Given a zkLogin signature, parse it if valid. If `bytes` provided, @@ -260,20 +260,20 @@ pub enum KeyToolCommand { // /// --curr-epoch 10 // ZkLoginSigVerify { // /// The Base64 of the serialized zkLogin signature. - // #[clap(long)] + // #[arg(long)] // sig: String, // /// The Base64 of the BCS encoded TransactionData or PersonalMessage. - // #[clap(long)] + // #[arg(long)] // bytes: Option, // /// Either 0 for TransactionData or 3 for PersonalMessage. - // #[clap(long)] + // #[arg(long)] // intent_scope: u8, // /// The current epoch for the network to verify the signature's // /// max_epoch against. - // #[clap(long)] + // #[arg(long)] // cur_epoch: Option, // /// The network to verify the signature for, determines ZkLoginEnv. - // #[clap(long, default_value = "devnet")] + // #[arg(long, default_value = "devnet")] // network: String, // }, // /// TESTING ONLY: Generate a fixed ephemeral key and its JWT token with test @@ -283,10 +283,10 @@ pub enum KeyToolCommand { // ZkLoginInsecureSignPersonalMessage { // /// The base64 encoded string of the message to sign, without the intent // /// message wrapping. - // #[clap(long)] + // #[arg(long)] // data: String, // /// The max epoch used for the zklogin signature validity. - // #[clap(long)] + // #[arg(long)] // max_epoch: EpochId, // }, } diff --git a/crates/iota/src/main.rs b/crates/iota/src/main.rs index e8007c31328..9dd70e610bb 100644 --- a/crates/iota/src/main.rs +++ b/crates/iota/src/main.rs @@ -15,7 +15,7 @@ use tracing::debug; bin_version::bin_version!(); #[derive(Parser)] -#[clap( +#[command( name = env!("CARGO_BIN_NAME"), about = env!("CARGO_PKG_DESCRIPTION"), rename_all = "kebab-case", @@ -24,7 +24,7 @@ bin_version::bin_version!(); propagate_version = true, )] struct Args { - #[clap(subcommand)] + #[command(subcommand)] command: IotaCommand, } diff --git a/crates/iota/src/validator_commands.rs b/crates/iota/src/validator_commands.rs index 0a38394d04a..acfc36db9ca 100644 --- a/crates/iota/src/validator_commands.rs +++ b/crates/iota/src/validator_commands.rs @@ -68,11 +68,11 @@ mod validator_tests; const DEFAULT_GAS_BUDGET: u64 = 200_000_000; // 0.2 IOTA #[derive(Parser)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub enum IotaValidatorCommand { /// Generate a `validator.info` file and 4 key pair files (account, network, /// authority, protocol). - #[clap(name = "make-validator-info")] + #[command(name = "make-validator-info")] MakeValidatorInfo { name: String, description: String, @@ -84,143 +84,143 @@ pub enum IotaValidatorCommand { /// Submit an on-chain transaction to become a validator candidate. The /// parameter is the file path to the `validator.info` generated by /// `MakeValidatorInfo`. - #[clap(name = "become-candidate")] + #[command(name = "become-candidate")] BecomeCandidate { - #[clap(name = "validator-info-path")] + #[arg(name = "validator-info-path")] file: PathBuf, - #[clap(name = "gas-budget", long)] + #[arg(name = "gas-budget", long)] gas_budget: Option, }, /// Once you collect enough staking amount, run this command to become a /// pending validator. A pending validator will become active and join /// the committee starting from next epoch. - #[clap(name = "join-committee")] + #[command(name = "join-committee")] JoinCommittee { /// Gas budget for this transaction. - #[clap(name = "gas-budget", long)] + #[arg(name = "gas-budget", long)] gas_budget: Option, }, /// Leave committee starting with the next epoch. - #[clap(name = "leave-committee")] + #[command(name = "leave-committee")] LeaveCommittee { /// Gas budget for this transaction. - #[clap(name = "gas-budget", long)] + #[arg(name = "gas-budget", long)] gas_budget: Option, }, /// Display metadata about the validator. - #[clap(name = "display-metadata")] + #[command(name = "display-metadata")] DisplayMetadata { - #[clap(name = "validator-address")] + #[arg(name = "validator-address")] validator_address: Option, - #[clap(name = "json", long)] + #[arg(name = "json", long)] json: Option, }, /// Update the validator metadata. - #[clap(name = "update-metadata")] + #[command(name = "update-metadata")] UpdateMetadata { - #[clap(subcommand)] + #[command(subcommand)] metadata: MetadataUpdate, /// Gas budget for this transaction. - #[clap(name = "gas-budget", long)] + #[arg(name = "gas-budget", long)] gas_budget: Option, }, /// Update gas price that is used to calculate Reference Gas Price - #[clap(name = "update-gas-price")] + #[command(name = "update-gas-price")] UpdateGasPrice { /// Optional when sender is the validator itself and it holds the Cap /// object. Required when sender is not the validator itself. /// Validator's OperationCap ID can be found by using the /// `display-metadata` subcommand. - #[clap(name = "operation-cap-id", long)] + #[arg(name = "operation-cap-id", long)] operation_cap_id: Option, - #[clap(name = "gas-price")] + #[arg(name = "gas-price")] gas_price: u64, /// Gas budget for this transaction. - #[clap(name = "gas-budget", long)] + #[arg(name = "gas-budget", long)] gas_budget: Option, }, /// Report or un-report a validator as bad or non-performant. - #[clap(name = "report-validator")] + #[command(name = "report-validator")] ReportValidator { /// Optional when sender is reporter validator itself and it holds the /// Cap object. Required when sender is not the reporter /// validator itself. Validator's OperationCap ID can be found /// by using the `display-metadata` subcommand. - #[clap(name = "operation-cap-id", long)] + #[arg(name = "operation-cap-id", long)] operation_cap_id: Option, /// The IOTA Address of the validator is being reported or un-reported - #[clap(name = "reportee-address")] + #[arg(name = "reportee-address")] reportee_address: IotaAddress, /// If true, undo an existing report. - #[clap(name = "undo-report", long)] + #[arg(name = "undo-report", long)] undo_report: Option, /// Gas budget for this transaction. - #[clap(name = "gas-budget", long)] + #[arg(name = "gas-budget", long)] gas_budget: Option, }, /// Serialize the payload that is used to generate Proof of Possession. /// This is useful to take the payload offline for an Authority protocol /// keypair to sign. - #[clap(name = "serialize-payload-pop")] + #[command(name = "serialize-payload-pop")] SerializePayloadForPoP { /// Authority account address encoded in hex with 0x prefix. - #[clap(name = "account-address", long)] + #[arg(name = "account-address", long)] account_address: IotaAddress, /// Authority public key encoded in hex. - #[clap(name = "protocol-public-key", long)] + #[arg(name = "protocol-public-key", long)] authority_public_key: AuthorityPublicKeyBytes, }, /// Print out the serialized data of a transaction that sets the gas price /// quote for a validator. DisplayGasPriceUpdateRawTxn { /// Address of the transaction sender. - #[clap(name = "sender-address", long)] + #[arg(name = "sender-address", long)] sender_address: IotaAddress, /// Object ID of a validator's OperationCap, used for setting gas price /// and reportng validators. - #[clap(name = "operation-cap-id", long)] + #[arg(name = "operation-cap-id", long)] operation_cap_id: ObjectID, /// Gas price to be set to. - #[clap(name = "new-gas-price", long)] + #[arg(name = "new-gas-price", long)] new_gas_price: u64, /// Gas budget for this transaction. - #[clap(name = "gas-budget", long)] + #[arg(name = "gas-budget", long)] gas_budget: Option, }, /// IOTA native bridge committee member registration. - #[clap(name = "register-bridge-committee")] + #[command(name = "register-bridge-committee")] RegisterBridgeCommittee { /// Path to Bridge Authority Key file. - #[clap(long)] + #[arg(long)] bridge_authority_key_path: PathBuf, /// Bridge authority URL which clients collects action signatures from. - #[clap(long)] + #[arg(long)] bridge_authority_url: String, /// If true, only print the unsigned transaction and do not execute it. /// This is useful for offline signing. - #[clap(name = "print-only", long, default_value = "false")] + #[arg(name = "print-only", long, default_value = "false")] print_unsigned_transaction_only: bool, /// Must present if `print_unsigned_transaction_only` is true. - #[clap(long)] + #[arg(long)] validator_address: Option, /// Gas budget for this transaction. - #[clap(name = "gas-budget", long)] + #[arg(name = "gas-budget", long)] gas_budget: Option, }, /// Update IOTA native bridge committee node url. UpdateBridgeCommitteeNodeUrl { /// New node url to be registered in the on chain bridge object. - #[clap(long)] + #[arg(long)] bridge_authority_url: String, /// If true, only print the unsigned transaction and do not execute it. /// This is useful for offline signing. - #[clap(name = "print-only", long, default_value = "false")] + #[arg(name = "print-only", long, default_value = "false")] print_unsigned_transaction_only: bool, /// Must be present if `print_unsigned_transaction_only` is true. - #[clap(long)] + #[arg(long)] validator_address: Option, /// Gas budget for this transaction. - #[clap(name = "gas-budget", long)] + #[arg(name = "gas-budget", long)] gas_budget: Option, }, /// Get a list of the validators in the network. Use the `display-metadata` @@ -1162,7 +1162,7 @@ async fn get_pending_candidate_summary( } #[derive(Subcommand)] -#[clap(rename_all = "kebab-case")] +#[command(rename_all = "kebab-case")] pub enum MetadataUpdate { /// Update name. Effectuate immediately. Name { name: String }, @@ -1180,18 +1180,18 @@ pub enum MetadataUpdate { P2pAddress { p2p_address: Multiaddr }, /// Update Network Public Key. Effectuate from next epoch. NetworkPubKey { - #[clap(name = "network-key-path")] + #[arg(name = "network-key-path")] file: PathBuf, }, /// Update Protocol Public Key. Effectuate from next epoch. ProtocolPubKey { - #[clap(name = "protocol-key-path")] + #[arg(name = "protocol-key-path")] file: PathBuf, }, /// Update Authority Public Key and Proof and Possession. Effectuate from /// next epoch. AuthorityPubKey { - #[clap(name = "authority-key-path")] + #[arg(name = "authority-key-path")] file: PathBuf, }, } diff --git a/examples/tic-tac-toe/cli/src/client.rs b/examples/tic-tac-toe/cli/src/client.rs index 10f32085f8f..a8fc7f71fcb 100644 --- a/examples/tic-tac-toe/cli/src/client.rs +++ b/examples/tic-tac-toe/cli/src/client.rs @@ -42,11 +42,11 @@ use crate::{ #[derive(Parser, Debug)] pub struct Connection { /// The IOTA CLI config file, (default: ~/.iota/iota_config/client.yaml) - #[clap(long)] + #[arg(long)] config: Option, /// Object ID of the game's package. - #[clap(long, short, env = "PKG")] + #[arg(long, short, env = "PKG")] package_id: ObjectID, } diff --git a/examples/tic-tac-toe/cli/src/command.rs b/examples/tic-tac-toe/cli/src/command.rs index fbaff4ab3b8..5e4c42f2e74 100644 --- a/examples/tic-tac-toe/cli/src/command.rs +++ b/examples/tic-tac-toe/cli/src/command.rs @@ -19,18 +19,18 @@ pub enum Command { /// Start a new game of tic-tac-toe. New { /// Use the shared version of the game (default). - #[clap(long, short)] + #[arg(long, short)] shared: bool, /// Use the multi-sig version of the game. - #[clap(long, short, conflicts_with("shared"))] + #[arg(long, short, conflicts_with("shared"))] multi_sig: bool, /// For a shared game, this is the opponent's address. For a multi-sig /// game, it is their public key. opponent: String, - #[clap(flatten)] + #[command(flatten)] conn: Connection, }, @@ -40,14 +40,14 @@ pub enum Command { game: ObjectID, /// The row to place the move in. - #[clap(long, short, value_parser = clap::value_parser!(u8).range(0..3))] + #[arg(long, short, value_parser = clap::value_parser!(u8).range(0..3))] row: u8, /// The column to place the move in. - #[clap(long, short, value_parser = clap::value_parser!(u8).range(0..3))] + #[arg(long, short, value_parser = clap::value_parser!(u8).range(0..3))] col: u8, - #[clap(flatten)] + #[command(flatten)] conn: Connection, }, @@ -56,7 +56,7 @@ pub enum Command { /// ID of the game to view. game: ObjectID, - #[clap(flatten)] + #[command(flatten)] conn: Connection, }, @@ -65,7 +65,7 @@ pub enum Command { /// ID of the game to delete. game: ObjectID, - #[clap(flatten)] + #[command(flatten)] conn: Connection, }, } diff --git a/examples/tic-tac-toe/cli/src/main.rs b/examples/tic-tac-toe/cli/src/main.rs index 1b9e8b0682c..fffd224b36c 100644 --- a/examples/tic-tac-toe/cli/src/main.rs +++ b/examples/tic-tac-toe/cli/src/main.rs @@ -7,12 +7,12 @@ use clap::Parser; use tic_tac_toe::command::Command; #[derive(Parser, Debug)] -#[clap( +#[command( name = env!("CARGO_BIN_NAME"), about = "A CLI for playing tic-tac-toe on-chain.", )] struct Args { - #[clap(subcommand)] + #[command(subcommand)] command: Command, }