From 15194b0a461f84c0c4ca1f955f2edd3fb0fe2488 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 14 Apr 2022 14:27:47 +0200 Subject: [PATCH] banking-bench: Migrate to clap 3.1.8 (cherry picked from commit 2c7699eb8cadba5ba9057ffecdb376434ae7225b) # Conflicts: # Cargo.lock --- Cargo.lock | 46 +++++++++++++++++++++++++++++++++++++++ banking-bench/Cargo.toml | 2 +- banking-bench/src/main.rs | 29 +++++++++++++----------- 3 files changed, 63 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bce4b603c3171f..0194eccb015a18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -706,9 +706,15 @@ dependencies = [ [[package]] name = "clap" +<<<<<<< HEAD version = "3.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c167e37342afc5f33fd87bbc870cedd020d2a6dffa05d45ccd9241fbdd146db" +======= +version = "3.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71c47df61d9e16dc010b55dba1952a57d8c215dbb533fd13cdd13369aac73b1c" +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) dependencies = [ "atty", "bitflags", @@ -3459,12 +3465,16 @@ dependencies = [ name = "rbpf-cli" version = "1.10.12" dependencies = [ +<<<<<<< HEAD "bv", "clap 3.1.12", "gimli", "goblin 0.5.1", "itertools", "log", +======= + "clap 3.1.8", +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) "serde", "serde_json", "solana-bpf-loader-program", @@ -4287,7 +4297,11 @@ dependencies = [ name = "solana-banking-bench" version = "1.10.12" dependencies = [ +<<<<<<< HEAD "clap 2.34.0", +======= + "clap 3.1.8", +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) "crossbeam-channel", "log", "rand 0.7.3", @@ -4352,7 +4366,11 @@ dependencies = [ name = "solana-bench-streamer" version = "1.10.12" dependencies = [ +<<<<<<< HEAD "clap 2.34.0", +======= + "clap 3.1.8", +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) "crossbeam-channel", "solana-net-utils", "solana-streamer", @@ -4449,7 +4467,11 @@ version = "1.10.12" dependencies = [ "bzip2", "cargo_metadata", +<<<<<<< HEAD "clap 3.1.12", +======= + "clap 3.1.8", +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) "regex", "serial_test", "solana-download-utils", @@ -4462,7 +4484,11 @@ name = "solana-cargo-test-bpf" version = "1.10.12" dependencies = [ "cargo_metadata", +<<<<<<< HEAD "clap 3.1.12", +======= + "clap 3.1.8", +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) ] [[package]] @@ -4738,7 +4764,11 @@ name = "solana-dos" version = "1.10.12" dependencies = [ "bincode", +<<<<<<< HEAD "clap 3.1.12", +======= + "clap 3.1.8", +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) "log", "rand 0.7.3", "serde", @@ -5167,7 +5197,11 @@ name = "solana-log-analyzer" version = "1.10.12" dependencies = [ "byte-unit", +<<<<<<< HEAD "clap 2.34.0", +======= + "clap 3.1.8", +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) "serde", "serde_json", "solana-logger 1.10.12", @@ -5244,7 +5278,11 @@ dependencies = [ name = "solana-net-shaper" version = "1.10.12" dependencies = [ +<<<<<<< HEAD "clap 2.34.0", +======= + "clap 3.1.8", +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) "rand 0.7.3", "serde", "serde_json", @@ -5256,7 +5294,11 @@ name = "solana-net-utils" version = "1.10.12" dependencies = [ "bincode", +<<<<<<< HEAD "clap 2.34.0", +======= + "clap 3.1.8", +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) "crossbeam-channel", "log", "nix 0.23.1", @@ -5333,7 +5375,11 @@ dependencies = [ name = "solana-poh-bench" version = "1.10.12" dependencies = [ +<<<<<<< HEAD "clap 2.34.0", +======= + "clap 3.1.8", +>>>>>>> 2c7699eb8 (banking-bench: Migrate to clap 3.1.8) "log", "rand 0.7.3", "rayon", diff --git a/banking-bench/Cargo.toml b/banking-bench/Cargo.toml index f94cabdfc47809..8c0626f5b1f995 100644 --- a/banking-bench/Cargo.toml +++ b/banking-bench/Cargo.toml @@ -9,7 +9,7 @@ homepage = "https://solana.com/" publish = false [dependencies] -clap = "2.33.1" +clap = "3.1.8" crossbeam-channel = "0.5" log = "0.4.14" rand = "0.7.0" diff --git a/banking-bench/src/main.rs b/banking-bench/src/main.rs index 2231a0423b3952..0bd919312ffdd8 100644 --- a/banking-bench/src/main.rs +++ b/banking-bench/src/main.rs @@ -1,6 +1,6 @@ #![allow(clippy::integer_arithmetic)] use { - clap::{crate_description, crate_name, value_t, App, Arg}, + clap::{crate_description, crate_name, Arg, Command}, crossbeam_channel::{unbounded, Receiver}, log::*, rand::{thread_rng, Rng}, @@ -109,55 +109,58 @@ fn bytes_as_usize(bytes: &[u8]) -> usize { fn main() { solana_logger::setup(); - let matches = App::new(crate_name!()) + let matches = Command::new(crate_name!()) .about(crate_description!()) .version(solana_version::version!()) .arg( - Arg::with_name("num_chunks") + Arg::new("num_chunks") .long("num-chunks") .takes_value(true) .value_name("SIZE") .help("Number of transaction chunks."), ) .arg( - Arg::with_name("packets_per_chunk") + Arg::new("packets_per_chunk") .long("packets-per-chunk") .takes_value(true) .value_name("SIZE") .help("Packets per chunk"), ) .arg( - Arg::with_name("skip_sanity") + Arg::new("skip_sanity") .long("skip-sanity") .takes_value(false) .help("Skip transaction sanity execution"), ) .arg( - Arg::with_name("same_payer") + Arg::new("same_payer") .long("same-payer") .takes_value(false) .help("Use the same payer for transfers"), ) .arg( - Arg::with_name("iterations") + Arg::new("iterations") .long("iterations") .takes_value(true) .help("Number of iterations"), ) .arg( - Arg::with_name("num_threads") + Arg::new("num_threads") .long("num-threads") .takes_value(true) .help("Number of iterations"), ) .get_matches(); - let num_threads = - value_t!(matches, "num_threads", usize).unwrap_or(BankingStage::num_threads() as usize); + let num_threads = matches + .value_of_t::("num_threads") + .unwrap_or(BankingStage::num_threads() as usize); // a multiple of packet chunk duplicates to avoid races - let num_chunks = value_t!(matches, "num_chunks", usize).unwrap_or(16); - let packets_per_chunk = value_t!(matches, "packets_per_chunk", usize).unwrap_or(192); - let iterations = value_t!(matches, "iterations", usize).unwrap_or(1000); + let num_chunks = matches.value_of_t::("num_chunks").unwrap_or(16); + let packets_per_chunk = matches + .value_of_t::("packets_per_chunk") + .unwrap_or(192); + let iterations = matches.value_of_t::("iterations").unwrap_or(1000); let total_num_transactions = num_chunks * num_threads * packets_per_chunk; let mint_total = 1_000_000_000_000;