Skip to content

Commit

Permalink
fix(Prover CLI): status batch bugs (#1865)
Browse files Browse the repository at this point in the history
## What ❔

<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->

1. Fix the case where the prover job is in `in_gpu_proof` status.
2. Fix `BatchData` default implementation.
3. Fix `From<Vec<WitnessJobStatus>>` and `From<Vec<ProverJobFriInfo>>`

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

1. It panics when you run the `status batch` command in a GPU prover:

```
in_gpu_proof
thread 'main' panicked at /home/admin/zksync-era-2/prover/prover_dal/src/fri_prover_dal.rs:679:64:
called `Result::unwrap()` on an `Err` value: VariantNotFound
```
2. Recursion tip `AggregationRoundInfo` in `BatchData` default
implementation was wrong.
3. `InProgress` and `Successful` status were mixed up in
`From<Vec<WitnessJobStatus>>` and `From<Vec<ProverJobFriInfo>>`

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [x] 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`.
- [x] Linkcheck has been run via `zk linkcheck`.

---------

Co-authored-by: Joaquin Carletti <[email protected]>
Co-authored-by: Joaquin Carletti <[email protected]>
Co-authored-by: AnastasiiaVashchuk <[email protected]>
Co-authored-by: Artem Fomiuk <[email protected]>
  • Loading branch information
5 people authored May 14, 2024
1 parent 0bd27a1 commit 09682f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions core/lib/basic_types/src/prover_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ pub enum ProverJobStatus {
Skipped,
#[strum(serialize = "ignored")]
Ignored,
#[strum(serialize = "in_gpu_proof")]
InGPUProof,
}

#[derive(Debug, Clone, strum::Display, strum::EnumString, strum::AsRefStr)]
Expand Down
11 changes: 8 additions & 3 deletions prover/prover_cli/src/commands/status/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Default for BatchData {
recursion_tip: Task::RecursionTip {
status: TaskStatus::default(),
aggregation_round_info: AggregationRoundInfo {
round: AggregationRound::Scheduler,
round: AggregationRound::RecursionTip,
prover_jobs_status: TaskStatus::default(),
},
},
Expand Down Expand Up @@ -120,14 +120,19 @@ impl From<Vec<ProverJobFriInfo>> for TaskStatus {
fn from(jobs_vector: Vec<ProverJobFriInfo>) -> Self {
if jobs_vector.is_empty() {
TaskStatus::JobsNotFound
} else if jobs_vector
.iter()
.all(|job| matches!(job.status, ProverJobStatus::InGPUProof))
{
TaskStatus::Custom("In GPU ⚡️".to_owned())
} else if jobs_vector
.iter()
.all(|job| matches!(job.status, ProverJobStatus::Queued))
{
TaskStatus::Queued
} else if jobs_vector
.iter()
.all(|job| matches!(job.status, ProverJobStatus::InProgress(_)))
.all(|job| matches!(job.status, ProverJobStatus::Successful(_)))
{
TaskStatus::Successful
} else {
Expand Down Expand Up @@ -167,7 +172,7 @@ impl From<Vec<WitnessJobStatus>> for TaskStatus {
TaskStatus::WaitingForProofs
} else if status_vector
.iter()
.all(|job| matches!(job, WitnessJobStatus::InProgress))
.all(|job| matches!(job, WitnessJobStatus::Successful(_)))
{
TaskStatus::Successful
} else {
Expand Down

0 comments on commit 09682f2

Please sign in to comment.