diff --git a/Cargo.lock b/Cargo.lock index 11f64241c1..f5506c4b10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1957,9 +1957,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.15.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7baab56125e25686df467fe470785512329883aab42696d661247aca2a2896e4" +checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" dependencies = [ "console 0.14.1", "lazy_static", @@ -2637,9 +2637,9 @@ dependencies = [ [[package]] name = "number_prefix" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" diff --git a/cli-output/Cargo.toml b/cli-output/Cargo.toml index c27c8d466a..d1523d2ae9 100644 --- a/cli-output/Cargo.toml +++ b/cli-output/Cargo.toml @@ -15,7 +15,7 @@ chrono = { version = "0.4.11", features = ["serde"] } console = "0.14.1" humantime = "2.0.1" Inflector = "0.11.4" -indicatif = "0.15.0" +indicatif = "0.16.2" serde = "1.0.126" serde_derive = "1.0.103" serde_json = "1.0.56" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 047ca61945..65e360c731 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -20,7 +20,7 @@ console = "0.14.1" dirs-next = "2.0.0" log = "0.4.11" Inflector = "0.11.4" -indicatif = "0.15.0" +indicatif = "0.16.2" humantime = "2.0.1" num-traits = "0.2" pretty-hex = "0.2.1" diff --git a/cli/src/cluster_query.rs b/cli/src/cluster_query.rs index 9c275983c9..ff5d0cc0f7 100644 --- a/cli/src/cluster_query.rs +++ b/cli/src/cluster_query.rs @@ -737,12 +737,10 @@ pub fn process_catchup( if let Some(rpc_addr) = contact_info.rpc { break rpc_addr; } - progress_bar.set_message(&format!("RPC service not found for {}", node_pubkey)); + progress_bar.set_message(format!("RPC service not found for {}", node_pubkey)); } else { - progress_bar.set_message(&format!( - "Contact information not found for {}", - node_pubkey - )); + progress_bar + .set_message(format!("Contact information not found for {}", node_pubkey)); } sleep(Duration::from_secs(sleep_interval as u64)); }; @@ -758,7 +756,7 @@ pub fn process_catchup( Ok(reported_node_pubkey) => break reported_node_pubkey, Err(err) => { if let ClientErrorKind::Reqwest(err) = err.kind() { - progress_bar.set_message(&format!("Connection failed: {}", err)); + progress_bar.set_message(format!("Connection failed: {}", err)); sleep(Duration::from_secs(sleep_interval as u64)); continue; } @@ -858,7 +856,7 @@ pub fn process_catchup( } }; - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "{} slot(s) {} (us:{} them:{}){}", slot_distance.abs(), if slot_distance >= 0 { @@ -1134,7 +1132,7 @@ pub fn process_show_block_production( }; let progress_bar = new_spinner_progress_bar(); - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "Fetching confirmed blocks between slots {} and {}...", start_slot, end_slot )); @@ -1197,7 +1195,7 @@ pub fn process_show_block_production( let mut leader_slot_count = HashMap::new(); let mut leader_skipped_slots = HashMap::new(); - progress_bar.set_message(&format!("Fetching leader schedule for epoch {}...", epoch)); + progress_bar.set_message(format!("Fetching leader schedule for epoch {}...", epoch)); let leader_schedule = rpc_client .get_leader_schedule_with_commitment(Some(start_slot), CommitmentConfig::finalized())?; if leader_schedule.is_none() { @@ -1216,7 +1214,7 @@ pub fn process_show_block_production( } } - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "Processing {} slots containing {} blocks and {} empty slots...", total_slots, total_blocks_produced, total_slots_skipped )); @@ -1610,9 +1608,8 @@ pub fn process_live_slots(config: &CliConfig) -> ProcessResult { "{:?} | root slot advancing at {:.2} slots/second", new_info, slots_per_second ) - } - .to_owned(); - slot_progress.set_message(&message); + }; + slot_progress.set_message(message.clone()); if let Some(previous) = current { let slot_delta: i64 = new_info.slot as i64 - previous.slot as i64; diff --git a/cli/src/program.rs b/cli/src/program.rs index b10a80c1d1..baee084e17 100644 --- a/cli/src/program.rs +++ b/cli/src/program.rs @@ -2012,7 +2012,7 @@ fn send_and_confirm_transactions_with_spinner( .ok(); } pending_transactions.insert(transaction.signatures[0], transaction); - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "[{}/{}] Transactions sent", pending_transactions.len(), num_transactions @@ -2050,7 +2050,7 @@ fn send_and_confirm_transactions_with_spinner( } slot = rpc_client.get_slot()?; - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "[{}/{}] Transactions confirmed. Retrying in {} slots", num_transactions - pending_transactions.len(), num_transactions, diff --git a/client/Cargo.toml b/client/Cargo.toml index fa0a854be2..bdeda9be24 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -14,7 +14,7 @@ base64 = "0.13.0" bincode = "1.3.1" bs58 = "0.4.0" clap = "2.33.0" -indicatif = "0.15.0" +indicatif = "0.16.2" jsonrpc-core = "17.0.0" log = "0.4.11" net2 = "0.2.37" diff --git a/client/src/rpc_client.rs b/client/src/rpc_client.rs index c54ef4ad94..0b3f11608d 100644 --- a/client/src/rpc_client.rs +++ b/client/src/rpc_client.rs @@ -1846,7 +1846,7 @@ impl RpcClient { let progress_bar = new_spinner_progress_bar(); - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "[{}/{}] Finalizing transaction {}", confirmations, desired_confirmations, signature, )); @@ -1899,7 +1899,7 @@ impl RpcClient { return Ok(()); } - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "[{}/{}] Finalizing transaction {}", min(confirmations + 1, desired_confirmations), desired_confirmations, diff --git a/download-utils/Cargo.toml b/download-utils/Cargo.toml index ee3f4baa61..801cef581b 100644 --- a/download-utils/Cargo.toml +++ b/download-utils/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" [dependencies] bzip2 = "0.3.3" console = "0.14.1" -indicatif = "0.15.0" +indicatif = "0.16.2" log = "0.4.11" reqwest = { version = "0.11.2", default-features = false, features = ["blocking", "rustls-tls", "json"] } solana-sdk = { path = "../sdk", version = "=1.8.0" } diff --git a/download-utils/src/lib.rs b/download-utils/src/lib.rs index da31b0d343..ec870fc9e5 100644 --- a/download-utils/src/lib.rs +++ b/download-utils/src/lib.rs @@ -78,7 +78,7 @@ pub fn download_file<'a, 'b>( let progress_bar = new_spinner_progress_bar(); if use_progress_bar { - progress_bar.set_message(&format!("{}Downloading {}...", TRUCK, url)); + progress_bar.set_message(format!("{}Downloading {}...", TRUCK, url)); } let response = reqwest::blocking::Client::new() @@ -108,7 +108,7 @@ pub fn download_file<'a, 'b>( ) .progress_chars("=> "), ); - progress_bar.set_message(&format!("{}Downloading~ {}", TRUCK, url)); + progress_bar.set_message(format!("{}Downloading~ {}", TRUCK, url)); } else { info!("Downloading {} bytes from {}", download_size, url); } diff --git a/install/Cargo.toml b/install/Cargo.toml index 424195c7e6..875c616c7d 100644 --- a/install/Cargo.toml +++ b/install/Cargo.toml @@ -18,7 +18,7 @@ clap = { version = "2.33.1" } console = "0.14.1" ctrlc = { version = "3.1.5", features = ["termination"] } dirs-next = "2.0.0" -indicatif = "0.15.0" +indicatif = "0.16.2" lazy_static = "1.4.0" nix = "0.19.0" reqwest = { version = "0.11.2", default-features = false, features = ["blocking", "rustls-tls", "json"] } diff --git a/install/src/command.rs b/install/src/command.rs index efe7d7bc0e..26d8b6960c 100644 --- a/install/src/command.rs +++ b/install/src/command.rs @@ -94,7 +94,7 @@ fn download_to_temp( let client = reqwest::blocking::Client::new(); let progress_bar = new_spinner_progress_bar(); - progress_bar.set_message(&format!("{}Downloading...", TRUCK)); + progress_bar.set_message(format!("{}Downloading...", TRUCK)); let response = client.get(url.as_str()).send()?; let download_size = { @@ -114,7 +114,7 @@ fn download_to_temp( ) .progress_chars("=> "), ); - progress_bar.set_message(&format!("{}Downloading", TRUCK)); + progress_bar.set_message(format!("{}Downloading", TRUCK)); struct DownloadProgress { progress_bar: ProgressBar, @@ -158,7 +158,7 @@ fn extract_release_archive( use tar::Archive; let progress_bar = new_spinner_progress_bar(); - progress_bar.set_message(&format!("{}Extracting...", PACKAGE)); + progress_bar.set_message(format!("{}Extracting...", PACKAGE)); if extract_dir.exists() { let _ = fs::remove_dir_all(&extract_dir); @@ -694,7 +694,7 @@ pub fn deploy( // Confirm the `json_rpc_url` is good and that `from_keypair` is a valid account let rpc_client = RpcClient::new(json_rpc_url.to_string()); let progress_bar = new_spinner_progress_bar(); - progress_bar.set_message(&format!("{}Checking cluster...", LOOKING_GLASS)); + progress_bar.set_message(format!("{}Checking cluster...", LOOKING_GLASS)); let balance = rpc_client .get_balance(&from_keypair.pubkey()) .map_err(|err| { @@ -743,7 +743,7 @@ pub fn deploy( println_name_value("Update target:", &release_target); let progress_bar = new_spinner_progress_bar(); - progress_bar.set_message(&format!("{}Deploying update...", PACKAGE)); + progress_bar.set_message(format!("{}Deploying update...", PACKAGE)); // Construct an update manifest for the release let mut update_manifest = SignedUpdateManifest { @@ -825,7 +825,7 @@ pub fn gc(config_file: &str) -> Result<(), String> { .template("{spinner:.green}{wide_msg} [{bar:40.cyan/blue}] {pos}/{len} ({eta})") .progress_chars("=> "), ); - progress_bar.set_message(&format!("{}Removing old releases", RECYCLING)); + progress_bar.set_message(format!("{}Removing old releases", RECYCLING)); for (release, _modified_type) in old_releases { progress_bar.inc(1); let _ = fs::remove_dir_all(&release); @@ -919,7 +919,7 @@ pub fn init_or_update(config_file: &str, is_init: bool, check_only: bool) -> Res match explicit_release { ExplicitRelease::Semver(current_release_semver) => { let progress_bar = new_spinner_progress_bar(); - progress_bar.set_message(&format!("{}Checking for updates...", LOOKING_GLASS)); + progress_bar.set_message(format!("{}Checking for updates...", LOOKING_GLASS)); let github_release = check_for_newer_github_release( semver::VersionReq::parse(&format!( @@ -1041,7 +1041,7 @@ pub fn init_or_update(config_file: &str, is_init: bool, check_only: bool) -> Res } } else { let progress_bar = new_spinner_progress_bar(); - progress_bar.set_message(&format!("{}Checking for updates...", LOOKING_GLASS)); + progress_bar.set_message(format!("{}Checking for updates...", LOOKING_GLASS)); let rpc_client = RpcClient::new(config.json_rpc_url.clone()); let update_manifest = get_update_manifest(&rpc_client, &config.update_manifest_pubkey)?; progress_bar.finish_and_clear(); diff --git a/programs/bpf/Cargo.lock b/programs/bpf/Cargo.lock index af0f05a366..02bdd2bba7 100644 --- a/programs/bpf/Cargo.lock +++ b/programs/bpf/Cargo.lock @@ -1383,9 +1383,9 @@ dependencies = [ [[package]] name = "indicatif" -version = "0.15.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7baab56125e25686df467fe470785512329883aab42696d661247aca2a2896e4" +checksum = "2d207dc617c7a380ab07ff572a6e52fa202a2a8f355860ac9c38e23f8196be1b" dependencies = [ "console 0.14.1", "lazy_static", @@ -1829,9 +1829,9 @@ dependencies = [ [[package]] name = "number_prefix" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" diff --git a/tokens/Cargo.toml b/tokens/Cargo.toml index 4c67f8ce49..c9792e8ef4 100644 --- a/tokens/Cargo.toml +++ b/tokens/Cargo.toml @@ -17,7 +17,7 @@ csv = "1.1.3" ctrlc = { version = "3.1.5", features = ["termination"] } dirs-next = "2.0.0" indexmap = "1.5.1" -indicatif = "0.15.0" +indicatif = "0.16.2" pickledb = "0.4.1" serde = { version = "1.0", features = ["derive"] } solana-account-decoder = { path = "../account-decoder", version = "=1.8.0" } diff --git a/tokens/src/commands.rs b/tokens/src/commands.rs index 29e83b662a..96a93d6d19 100644 --- a/tokens/src/commands.rs +++ b/tokens/src/commands.rs @@ -593,7 +593,7 @@ fn finalize_transactions( while opt_confirmations.is_some() { if let Some(confirmations) = opt_confirmations { - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "[{}/{}] Finalizing transactions", confirmations, 32, )); diff --git a/validator/Cargo.toml b/validator/Cargo.toml index 0aee30c8cd..95c13cca40 100644 --- a/validator/Cargo.toml +++ b/validator/Cargo.toml @@ -18,7 +18,7 @@ clap = "2.33.1" console = "0.14.1" core_affinity = "0.5.10" fd-lock = "2.0.0" -indicatif = "0.15.0" +indicatif = "0.16.2" jsonrpc-core = "17.0.0" jsonrpc-core-client = { version = "17.0.0", features = ["ipc", "ws"] } jsonrpc-derive = "17.0.0" diff --git a/validator/src/dashboard.rs b/validator/src/dashboard.rs index d3051afe1a..f3e9066793 100644 --- a/validator/src/dashboard.rs +++ b/validator/src/dashboard.rs @@ -143,7 +143,7 @@ impl Dashboard { ) }; - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "{}{}{}| \ Processed Slot: {} | Confirmed Slot: {} | Finalized Slot: {} | \ Snapshot Slot: {} | \ @@ -172,7 +172,7 @@ impl Dashboard { } Err(err) => { progress_bar - .abandon_with_message(&format!("RPC connection failure: {}", err)); + .abandon_with_message(format!("RPC connection failure: {}", err)); break; } } @@ -197,7 +197,7 @@ async fn wait_for_validator_startup( match admin_rpc_service::connect(&ledger_path).await { Ok(new_admin_client) => admin_client = Some(new_admin_client), Err(err) => { - progress_bar.set_message(&format!("Unable to connect to validator: {}", err)); + progress_bar.set_message(format!("Unable to connect to validator: {}", err)); thread::sleep(refresh_interval); continue; } @@ -216,22 +216,21 @@ async fn wait_for_validator_startup( } .await { - Ok((None, _)) => progress_bar.set_message(&"RPC service not available"), + Ok((None, _)) => progress_bar.set_message("RPC service not available"), Ok((Some(rpc_addr), start_time)) => return Some((rpc_addr, start_time)), Err(err) => { progress_bar - .set_message(&format!("Failed to get validator info: {}", err)); + .set_message(format!("Failed to get validator info: {}", err)); } } } else { - progress_bar - .set_message(&format!("Validator startup: {:?}...", start_progress)); + progress_bar.set_message(format!("Validator startup: {:?}...", start_progress)); } } Err(err) => { admin_client = None; progress_bar - .set_message(&format!("Failed to get validator start progress: {}", err)); + .set_message(format!("Failed to get validator start progress: {}", err)); } } thread::sleep(refresh_interval); diff --git a/validator/src/lib.rs b/validator/src/lib.rs index 4ac27d8833..bafe98aeb8 100644 --- a/validator/src/lib.rs +++ b/validator/src/lib.rs @@ -5,7 +5,7 @@ use { console::style, indicatif::{ProgressDrawTarget, ProgressStyle}, log::*, - std::{env, process::exit, thread::JoinHandle}, + std::{borrow::Cow, env, fmt::Display, process::exit, thread::JoinHandle}, }; pub mod admin_rpc_service; @@ -117,7 +117,7 @@ pub struct ProgressBar { } impl ProgressBar { - pub fn set_message(&self, msg: &str) { + pub fn set_message> + Display>(&self, msg: T) { if self.is_term { self.progress_bar.set_message(msg); } else { @@ -125,7 +125,7 @@ impl ProgressBar { } } - pub fn abandon_with_message(&self, msg: &str) { + pub fn abandon_with_message> + Display>(&self, msg: T) { if self.is_term { self.progress_bar.abandon_with_message(msg); } else { diff --git a/validator/src/main.rs b/validator/src/main.rs index a1dc8c2c8e..f2a7fc6e47 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -160,7 +160,7 @@ fn wait_for_restart_window( None => true, Some(current_epoch) => current_epoch != epoch_info.epoch, } { - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "Fetching leader schedule for epoch {}...", epoch_info.epoch )); @@ -285,7 +285,7 @@ fn wait_for_restart_window( } }; - progress_bar.set_message(&format!( + progress_bar.set_message(format!( "{} | Processed Slot: {} | Snapshot Slot: {} | {:.2}% delinquent stake | {}", { let elapsed =