This commit is contained in:
Collin Jackson 2024-11-08 13:31:29 -08:00
parent 46a3713d7d
commit 14cefed23b
2 changed files with 43 additions and 22 deletions

View File

@ -32,12 +32,17 @@ jobs:
with: with:
workspaces: ./clients/cli workspaces: ./clients/cli
- name: Build CLI - name: Format
working-directory: clients/cli
run: |
rustfmt src/**/*.rs --check --edition 2021
- name: Build
working-directory: clients/cli working-directory: clients/cli
run: | run: |
cargo build --profile=ci-build cargo build --profile=ci-build
- name: Run cargo clippy on CLI - name: Run cargo clippy
working-directory: clients/cli working-directory: clients/cli
run: | run: |
cargo clippy --profile=ci-build --no-deps --all-targets --workspace -- -D warnings cargo clippy --profile=ci-build --no-deps --all-targets --workspace -- -D warnings

View File

@ -32,8 +32,8 @@ use nexus_core::{
init_circuit_trace, key::CanonicalSerialize, pp::gen_vm_pp, prove_seq_step, types::*, init_circuit_trace, key::CanonicalSerialize, pp::gen_vm_pp, prove_seq_step, types::*,
}, },
}; };
use rand::RngCore;
use zstd::stream::Encoder; use zstd::stream::Encoder;
use rand::{ RngCore };
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
struct Args { struct Args {
@ -128,8 +128,16 @@ async fn main() {
let max_retries = 5; let max_retries = 5;
loop { loop {
if let Err(e) = client.send(Message::Binary(registration.encode_to_vec())).await { if let Err(e) = client
eprintln!("Failed to send message: {:?}, attempt {}/{}", e, retries + 1, max_retries); .send(Message::Binary(registration.encode_to_vec()))
.await
{
eprintln!(
"Failed to send message: {:?}, attempt {}/{}",
e,
retries + 1,
max_retries
);
retries += 1; retries += 1;
if retries >= max_retries { if retries >= max_retries {
@ -255,7 +263,10 @@ async fn main() {
let proof_cycles_hertz = k as f64 * 1000.0 / progress_duration.as_millis() as f64; let proof_cycles_hertz = k as f64 * 1000.0 / progress_duration.as_millis() as f64;
track( track(
"progress".into(), "progress".into(),
format!("Proved step {} at {:.2} proof cycles/sec.", step, proof_cycles_hertz), format!(
"Proved step {} at {:.2} proof cycles/sec.",
step, proof_cycles_hertz
),
&ws_addr_string, &ws_addr_string,
json!({ json!({
"completed_fraction": completed_fraction, "completed_fraction": completed_fraction,
@ -273,9 +284,13 @@ 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.send(Message::Binary(progress.encode_to_vec())).await {
if let Err(e) = client.send(Message::Binary(progress.encode_to_vec())).await { eprintln!(
eprintln!("Failed to send message: {:?}, attempt {}/{}", e, retries + 1, max_retries); "Failed to send message: {:?}, attempt {}/{}",
e,
retries + 1,
max_retries
);
retries += 1; retries += 1;
if retries >= max_retries { if retries >= max_retries {
@ -285,9 +300,6 @@ async fn main() {
// Add a delay before retrying // Add a delay before retrying
tokio::time::sleep(tokio::time::Duration::from_secs(u64::pow(2, retries))).await; tokio::time::sleep(tokio::time::Duration::from_secs(u64::pow(2, retries))).await;
} else {
break;
}
} }
if step == end - 1 { if step == end - 1 {
@ -305,14 +317,18 @@ async fn main() {
})), })),
}; };
let duration = SystemTime::now().duration_since(start_time).unwrap(); let duration = SystemTime::now().duration_since(start_time).unwrap();
let proof_cycles_hertz = cycles_proven as f64 * 1000.0 / duration.as_millis() as f64; let proof_cycles_hertz =
cycles_proven as f64 * 1000.0 / duration.as_millis() as f64;
client client
.send(Message::Binary(response.encode_to_vec())) .send(Message::Binary(response.encode_to_vec()))
.await .await
.unwrap(); .unwrap();
track( track(
"proof".into(), "proof".into(),
format!("Proof sent! Overall speed was {:.2} proof cycles/sec.", proof_cycles_hertz), format!(
"Proof sent! Overall speed was {:.2} proof cycles/sec.",
proof_cycles_hertz
),
&ws_addr_string, &ws_addr_string,
json!({ json!({
"proof_duration_sec": duration.as_secs(), "proof_duration_sec": duration.as_secs(),