Skip to content

Commit

Permalink
fix: oldest unpicked batch (#692)
Browse files Browse the repository at this point in the history
## What ❔

Set sealed batch number if no unpicked job were found

## Why ❔

Sometimes there is no such jobs in db, so it remains the same.

## 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.
- [ ] Documentation comments have been added / updated.
- [x] Code has been formatted via `zk fmt` and `zk lint`.
- [x] Spellcheck has been run via `cargo spellcheck
--cfg=./spellcheck/era.cfg --code 1`.
  • Loading branch information
Artemka374 authored Jan 10, 2024
1 parent 604fdb9 commit a6c869d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions core/lib/zksync_core/src/house_keeper/fri_prover_queue_monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,24 @@ impl PeriodicJob for FriProverStatsReporter {

let mut db_conn = self.db_connection_pool.access_storage().await.unwrap();

if let Some(l1_batch_number) = db_conn
let oldest_unpicked_batch = match db_conn
.proof_generation_dal()
.get_oldest_unpicked_batch()
.await
{
metrics::gauge!("fri_prover.oldest_unpicked_batch", l1_batch_number.0 as f64)
}
Some(l1_batch_number) => l1_batch_number.0 as f64,
// if there is no unpicked batch in database, we use sealed batch number as a result
None => {
db_conn
.blocks_dal()
.get_sealed_l1_batch_number()
.await
.unwrap()
.unwrap()
.0 as f64
}
};
metrics::gauge!("fri_prover.oldest_unpicked_batch", oldest_unpicked_batch);

if let Some(l1_batch_number) = db_conn
.proof_generation_dal()
Expand Down

0 comments on commit a6c869d

Please sign in to comment.