From 9cada1a17469e876cbf82d923e3d59f21576ec94 Mon Sep 17 00:00:00 2001 From: EmilLuta Date: Mon, 27 Nov 2023 18:49:04 +0100 Subject: [PATCH] fix(house_keeper): Emit the correct circuit_id for aggregation round 2 (#547) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ This is us hardcoding the circuit_id to 2 for aggregation_round 2. This fix is useless as soon as we change the config (not expected anytime soon). A real fix will follow where we address what is saved in database layer and this patch will be removed altogether. ## Why ❔ This is necessary to enable autoscaler to work (emits the correct data for prover groups, which in turn can be picked by autoscaler). ## 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`. --- .../src/house_keeper/fri_prover_queue_monitor.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/lib/zksync_core/src/house_keeper/fri_prover_queue_monitor.rs b/core/lib/zksync_core/src/house_keeper/fri_prover_queue_monitor.rs index f962cf94a2e5..ba731ede944f 100644 --- a/core/lib/zksync_core/src/house_keeper/fri_prover_queue_monitor.rs +++ b/core/lib/zksync_core/src/house_keeper/fri_prover_queue_monitor.rs @@ -34,6 +34,19 @@ impl PeriodicJob for FriProverStatsReporter { let stats = conn.fri_prover_jobs_dal().get_prover_jobs_stats().await; for ((circuit_id, aggregation_round), stats) in stats.into_iter() { + // BEWARE, HERE BE DRAGONS. + // In database, the circuit_id stored is the circuit for which the aggregation is done, + // not the circuit which is running. + // There is a single node level aggregation circuit, which is circuit 2. + // This can aggregate multiple leaf nodes (which may belong to different circuits). + // This reporting is a hacky forced way to use circuit_id 2 which will solve autoscalers. + // A proper fix will be later provided to solve this at database level. + let circuit_id = if aggregation_round == 2 { + 2 + } else { + circuit_id + }; + let group_id = self .config .get_group_id_for_circuit_id_and_aggregation_round(circuit_id, aggregation_round)