Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
feat: Remove cached commitments, add BWIP to docs (matter-labs#2400)
Browse files Browse the repository at this point in the history
## What ❔

Remove lazy loading of commitments in BWG
Add BWIP to docs

## Why ❔

It is not needed, because it is called only once

## 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).
- [x] 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`.
  • Loading branch information
Artemka374 authored and irnb committed Jul 12, 2024
1 parent 960f2e3 commit 9ceaac3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion prover/prover_fri/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ installation as a pre-requisite, alongside these machine specs:
2. Run the server. In the root of the repository:

```console
zk server --components=api,eth,tree,state_keeper,housekeeper,commitment_generator,proof_data_handler
zk server --components=api,eth,tree,state_keeper,housekeeper,commitment_generator,proof_data_handler,vm_runner_bwip
```

Note that it will produce a first l1 batch that can be proven (should be batch 0).
Expand Down
17 changes: 6 additions & 11 deletions prover/vk_setup_data_generator_server_fri/src/commitment_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::{str::FromStr, sync::Mutex};
use anyhow::Context as _;
use hex::ToHex;
use once_cell::sync::Lazy;
use structopt::lazy_static::lazy_static;
use zkevm_test_harness::witness::recursive_aggregation::{
compute_leaf_vks_and_params_commitment, compute_node_vk_commitment,
};
Expand All @@ -24,14 +23,6 @@ use crate::{

static KEYSTORE: Lazy<Mutex<Option<Keystore>>> = Lazy::new(|| Mutex::new(None));

lazy_static! {
// TODO: do not initialize a static const with data read in runtime.
static ref COMMITMENTS: Lazy<L1VerifierConfig> = Lazy::new(|| {
let keystore = KEYSTORE.lock().unwrap().clone().unwrap_or_default();
circuit_commitments(&keystore).unwrap()
});
}

fn circuit_commitments(keystore: &Keystore) -> anyhow::Result<L1VerifierConfig> {
let commitments = generate_commitments(keystore).context("generate_commitments()")?;
Ok(L1VerifierConfig {
Expand Down Expand Up @@ -108,8 +99,12 @@ pub fn get_cached_commitments(setup_data_path: Option<String>) -> L1VerifierConf
let mut keystore_lock = KEYSTORE.lock().unwrap();
*keystore_lock = Some(keystore);
}
tracing::info!("Using cached commitments {:?}", **COMMITMENTS);
**COMMITMENTS

let keystore = KEYSTORE.lock().unwrap().clone().unwrap_or_default();
let commitments = circuit_commitments(&keystore).unwrap();

tracing::info!("Using cached commitments {:?}", commitments);
commitments
}

#[test]
Expand Down

0 comments on commit 9ceaac3

Please sign in to comment.