From 2ee606c951010589ebe6ce08b0741cd10f4eef69 Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Fri, 8 Nov 2024 13:37:55 -0800 Subject: [PATCH] fix lints --- clients/cli/src/analytics.rs | 2 +- clients/cli/src/config.rs | 2 +- clients/cli/src/prover.rs | 44 ++++++++++++++++-------------------- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/clients/cli/src/analytics.rs b/clients/cli/src/analytics.rs index 190f180..effd2ee 100644 --- a/clients/cli/src/analytics.rs +++ b/clients/cli/src/analytics.rs @@ -44,7 +44,7 @@ pub fn track( let client = reqwest::Client::new(); let _ = client .post("https://api.mixpanel.com/track?ip=1") - .body(format!("[{}]", body.to_string())) + .body(format!("[{}]", body)) .header(ACCEPT, "text/plain") .header(CONTENT_TYPE, "application/json") .send() diff --git a/clients/cli/src/config.rs b/clients/cli/src/config.rs index 042ab71..50a7f5f 100644 --- a/clients/cli/src/config.rs +++ b/clients/cli/src/config.rs @@ -1,7 +1,7 @@ #[cfg(debug_assertions)] pub fn analytics_token(_ws_addr_string: &str) -> String { // Use one of the tokens in the release version if debugging analytics - return "".into(); + "".into() } #[cfg(not(debug_assertions))] diff --git a/clients/cli/src/prover.rs b/clients/cli/src/prover.rs index 6342149..40a2be4 100644 --- a/clients/cli/src/prover.rs +++ b/clients/cli/src/prover.rs @@ -118,7 +118,7 @@ async fn main() { contents: Some(prover_request::Contents::Registration( ProverRequestRegistration { prover_type: ProverType::Volunteer.into(), - prover_id: prover_id.clone().into(), + prover_id: prover_id.clone(), estimated_proof_cycles_hertz: None, }, )), @@ -127,29 +127,25 @@ async fn main() { let mut retries = 0; let max_retries = 5; - loop { - if let Err(e) = client - .send(Message::Binary(registration.encode_to_vec())) - .await - { - eprintln!( - "Failed to send message: {:?}, attempt {}/{}", - e, - retries + 1, - max_retries - ); + while let Err(e) = client + .send(Message::Binary(registration.encode_to_vec())) + .await + { + eprintln!( + "Failed to send message: {:?}, attempt {}/{}", + e, + retries + 1, + max_retries + ); - retries += 1; - if retries >= max_retries { - eprintln!("Max retries reached, exiting..."); - break; - } - - // Add a delay before retrying - tokio::time::sleep(tokio::time::Duration::from_secs(u64::pow(2, retries))).await; - } else { + retries += 1; + if retries >= max_retries { + eprintln!("Max retries reached, exiting..."); break; } + + // Add a delay before retrying + tokio::time::sleep(tokio::time::Duration::from_secs(u64::pow(2, retries))).await; } track( @@ -188,7 +184,7 @@ async fn main() { ); let mut vm: NexusVM = - parse_elf(&elf_bytes.as_ref()).expect("error loading and parsing RISC-V instruction"); + parse_elf(elf_bytes.as_ref()).expect("error loading and parsing RISC-V instruction"); vm.syscalls.set_input(&input); // TODO(collinjackson): Get outputs @@ -252,10 +248,10 @@ async fn main() { completed_fraction = steps_proven as f32 / steps_to_prove as f32; let progress = ProverRequest { contents: Some(prover_request::Contents::Progress(Progress { - completed_fraction: completed_fraction, + completed_fraction, steps_in_trace: total_steps as i32, steps_to_prove: steps_to_prove as i32, - steps_proven: steps_proven as i32, + steps_proven, })), }; let progress_duration = SystemTime::now().duration_since(progress_time).unwrap();