Skip to content

Commit

Permalink
fix(prover_cli): Fix Minor Bugs in Prover CLI (#2264)
Browse files Browse the repository at this point in the history
This PR fixes bugs in the Prover CLI:
- The status command was not displaying correctly for more than one
batch.
- The witness job status was incorrectly set to "in progress" when some
batches were in the queue and others were waiting for proofs.
- The config command failed if there was no configuration file. Now, it
creates one if it’s not found.


## Checklist

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [x] Code has been formatted via `zk fmt` and `zk lint`.
- [x] Spellcheck has been run via `zk spellcheck`.
  • Loading branch information
ColoCarletti authored Jun 19, 2024
1 parent c828217 commit 440f2a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions prover/prover_cli/src/commands/status/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub(crate) async fn run(args: Args, config: ProverCLIConfig) -> anyhow::Result<(
if let Status::Custom(msg) = batch_data.compressor.witness_generator_jobs_status() {
if msg.contains("Sent to server") {
println!("> Proof sent to server ✅");
return Ok(());
continue;
}
}

Expand All @@ -48,7 +48,7 @@ pub(crate) async fn run(args: Args, config: ProverCLIConfig) -> anyhow::Result<(
.witness_generator_jobs_status();
if matches!(basic_witness_generator_status, Status::JobsNotFound) {
println!("> No batch found. 🚫");
return Ok(());
continue;
}

if !args.verbose {
Expand Down
10 changes: 5 additions & 5 deletions prover/prover_cli/src/commands/status/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ impl From<Vec<WitnessJobStatus>> for Status {
fn from(status_vector: Vec<WitnessJobStatus>) -> Self {
if status_vector.is_empty() {
Status::JobsNotFound
} else if status_vector
.iter()
.all(|job| matches!(job, WitnessJobStatus::Queued))
{
Status::Queued
} else if status_vector
.iter()
.all(|job| matches!(job, WitnessJobStatus::WaitingForProofs))
{
Status::WaitingForProofs
} else if status_vector.iter().all(|job| {
matches!(job, WitnessJobStatus::Queued)
|| matches!(job, WitnessJobStatus::WaitingForProofs)
}) {
Status::Queued
} else if status_vector
.iter()
.all(|job| matches!(job, WitnessJobStatus::Successful(_)))
Expand Down
2 changes: 1 addition & 1 deletion prover/prover_cli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn update_envfile(
let prefix = format!("{}=", key.as_ref());
let kv = format!("{}={}", key.as_ref(), value.as_ref());
let swapfile = path.as_ref().with_extension(".swp");
let mut out = std::io::BufWriter::new(std::fs::File::create_new(&swapfile)?);
let mut out = std::io::BufWriter::new(std::fs::File::create(&swapfile)?);
let mut found = false;

std::fs::read_to_string(path)
Expand Down

0 comments on commit 440f2a7

Please sign in to comment.