fix lints

This commit is contained in:
Collin Jackson 2024-11-08 13:37:55 -08:00
parent 14cefed23b
commit 2ee606c951
3 changed files with 22 additions and 26 deletions

View File

@ -44,7 +44,7 @@ pub fn track(
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let _ = client let _ = client
.post("https://api.mixpanel.com/track?ip=1") .post("https://api.mixpanel.com/track?ip=1")
.body(format!("[{}]", body.to_string())) .body(format!("[{}]", body))
.header(ACCEPT, "text/plain") .header(ACCEPT, "text/plain")
.header(CONTENT_TYPE, "application/json") .header(CONTENT_TYPE, "application/json")
.send() .send()

View File

@ -1,7 +1,7 @@
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
pub fn analytics_token(_ws_addr_string: &str) -> String { pub fn analytics_token(_ws_addr_string: &str) -> String {
// Use one of the tokens in the release version if debugging analytics // Use one of the tokens in the release version if debugging analytics
return "".into(); "".into()
} }
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]

View File

@ -118,7 +118,7 @@ async fn main() {
contents: Some(prover_request::Contents::Registration( contents: Some(prover_request::Contents::Registration(
ProverRequestRegistration { ProverRequestRegistration {
prover_type: ProverType::Volunteer.into(), prover_type: ProverType::Volunteer.into(),
prover_id: prover_id.clone().into(), prover_id: prover_id.clone(),
estimated_proof_cycles_hertz: None, estimated_proof_cycles_hertz: None,
}, },
)), )),
@ -127,29 +127,25 @@ async fn main() {
let mut retries = 0; let mut retries = 0;
let max_retries = 5; let max_retries = 5;
loop { while let Err(e) = client
if let Err(e) = client .send(Message::Binary(registration.encode_to_vec()))
.send(Message::Binary(registration.encode_to_vec())) .await
.await {
{ eprintln!(
eprintln!( "Failed to send message: {:?}, attempt {}/{}",
"Failed to send message: {:?}, attempt {}/{}", e,
e, retries + 1,
retries + 1, max_retries
max_retries );
);
retries += 1; retries += 1;
if retries >= max_retries { if retries >= max_retries {
eprintln!("Max retries reached, exiting..."); 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 {
break; break;
} }
// Add a delay before retrying
tokio::time::sleep(tokio::time::Duration::from_secs(u64::pow(2, retries))).await;
} }
track( track(
@ -188,7 +184,7 @@ async fn main() {
); );
let mut vm: NexusVM<MerkleTrie> = let mut vm: NexusVM<MerkleTrie> =
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); vm.syscalls.set_input(&input);
// TODO(collinjackson): Get outputs // TODO(collinjackson): Get outputs
@ -252,10 +248,10 @@ async fn main() {
completed_fraction = steps_proven as f32 / steps_to_prove as f32; completed_fraction = steps_proven as f32 / steps_to_prove as f32;
let progress = ProverRequest { let progress = ProverRequest {
contents: Some(prover_request::Contents::Progress(Progress { contents: Some(prover_request::Contents::Progress(Progress {
completed_fraction: completed_fraction, completed_fraction,
steps_in_trace: total_steps as i32, steps_in_trace: total_steps as i32,
steps_to_prove: steps_to_prove 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(); let progress_duration = SystemTime::now().duration_since(progress_time).unwrap();