Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
mm-zk committed Feb 19, 2024
1 parent 16fba65 commit 8c084c9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
10 changes: 1 addition & 9 deletions prover/prover_fri/tests/basic_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,7 @@ async fn prover_and_assert_base_layer(
let circuit_setup_data =
generate_setup_data_common(&keystore, true, circuit.numeric_circuit_type())
.context("generate_cpu_base_layers_setup_data()")?;
let setup_data = Arc::new(GoldilocksProverSetupData {
setup_base: circuit_setup_data.setup_base,
setup: circuit_setup_data.setup,
vk: circuit_setup_data.vk,
setup_tree: circuit_setup_data.setup_tree,
vars_hint: circuit_setup_data.vars_hint,
wits_hint: circuit_setup_data.wits_hint,
finalization_hint: circuit_setup_data.finalization_hint,
});
let setup_data = Arc::new(circuit_setup_data.into());
let setup_key = ProverServiceDataKey::new(circuit_id, aggregation_round);
let prover_job = ProverJob::new(block_number, expected_proof_id, circuit_wrapper, setup_key);
let artifacts = Prover::prove(
Expand Down
15 changes: 15 additions & 0 deletions prover/vk_setup_data_generator_server_fri/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![feature(allocator_api)]

use serde::{Deserialize, Serialize};
use zkevm_test_harness::compute_setups::CircuitSetupData;
use zksync_prover_fri_types::circuit_definitions::boojum::{
algebraic_props::{round_function::AbsorptionModeOverwrite, sponge::GenericAlgebraicSponge},
cs::{
Expand Down Expand Up @@ -67,6 +68,20 @@ pub type GoldilocksProverSetupData = ProverSetupData<
>,
>;

impl From<CircuitSetupData> for GoldilocksProverSetupData {
fn from(circuit_setup_data: CircuitSetupData) -> Self {
Self {
setup_base: circuit_setup_data.setup_base,
setup: circuit_setup_data.setup,
vk: circuit_setup_data.vk,
setup_tree: circuit_setup_data.setup_tree,
vars_hint: circuit_setup_data.vars_hint,
wits_hint: circuit_setup_data.wits_hint,
finalization_hint: circuit_setup_data.finalization_hint,
}
}
}

#[cfg(feature = "gpu")]
#[derive(Debug, Serialize, Deserialize)]
#[serde(bound = "F: serde::Serialize + serde::de::DeserializeOwned")]
Expand Down
11 changes: 5 additions & 6 deletions prover/vk_setup_data_generator_server_fri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,12 @@ fn print_stats(digests: HashMap<String, String>) -> anyhow::Result<()> {

fn keystore_from_optional_path(path: Option<String>, setup_path: Option<String>) -> Keystore {
if let Some(path) = path {
Keystore::new_with_optional_setup_path(path, setup_path)
} else {
if setup_path.is_some() {
panic!("--setup_path must not be set when --path is not set");
}
Keystore::default()
return Keystore::new_with_optional_setup_path(path, setup_path);
}
if setup_path.is_some() {
panic!("--setup_path must not be set when --path is not set");
}
Keystore::default()
}

fn generate_setup_keys(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,8 @@ impl SetupDataGenerator for CPUSetupDataGenerator {
let circuit_setup_data =
generate_setup_data_common(&self.keystore, is_base_layer, numeric_circuit)?;

let prover_setup_data = GoldilocksProverSetupData {
setup_base: circuit_setup_data.setup_base,
setup: circuit_setup_data.setup,
vk: circuit_setup_data.vk,
setup_tree: circuit_setup_data.setup_tree,
vars_hint: circuit_setup_data.vars_hint,
wits_hint: circuit_setup_data.wits_hint,
finalization_hint: circuit_setup_data.finalization_hint,
};
let prover_setup_data: GoldilocksProverSetupData = circuit_setup_data.into();

Ok(bincode::serialize(&prover_setup_data).expect("Failed serializing setup data"))
}

Expand Down

0 comments on commit 8c084c9

Please sign in to comment.