From db1f236253d20ee7dd015f9d35194f89ac7c5ad5 Mon Sep 17 00:00:00 2001 From: sifnoc Date: Wed, 13 Mar 2024 16:30:16 +0000 Subject: [PATCH] fix: set instance value as zero for using in range check --- kzg_prover/benches/kzg.rs | 9 +++++---- kzg_prover/bin/gen_commit_and_proofs.rs | 2 +- kzg_prover/bin/gen_verifier.rs | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/kzg_prover/benches/kzg.rs b/kzg_prover/benches/kzg.rs index cef51cd4..871e9e83 100644 --- a/kzg_prover/benches/kzg.rs +++ b/kzg_prover/benches/kzg.rs @@ -75,13 +75,14 @@ fn bench_kzg< b.iter_batched( || circuit.clone(), // Setup function: clone the circuit for each iteration |circuit| { - full_prover(¶ms, &pk, circuit, &[vec![]]); + full_prover(¶ms, &pk, circuit, &[vec![Fp::zero()]]); }, criterion::BatchSize::SmallInput, // Choose an appropriate batch size ); }); - let (zk_snark_proof, advice_polys, omega) = full_prover(¶ms, &pk, circuit, &[vec![]]); + let (zk_snark_proof, advice_polys, omega) = + full_prover(¶ms, &pk, circuit, &[vec![Fp::zero()]]); let poly_length = 1 << u64::from(K); @@ -267,7 +268,7 @@ fn criterion_benchmark(_c: &mut Criterion) { #[cfg(not(feature = "no_range_check"))] { const K: u32 = 18; - const N_USERS: usize = (1 << 17) + (1 << 16) - 6; + const N_USERS: usize = (1 << K) - 6; bench_kzg::< K, N_USERS, @@ -279,7 +280,7 @@ fn criterion_benchmark(_c: &mut Criterion) { #[cfg(not(feature = "no_range_check"))] { const K: u32 = 17; - const N_USERS: usize = (1 << 16) - 6; + const N_USERS: usize = (1 << K) - 6; bench_kzg::< K, N_USERS, diff --git a/kzg_prover/bin/gen_commit_and_proofs.rs b/kzg_prover/bin/gen_commit_and_proofs.rs index 09171d3e..d44618b6 100644 --- a/kzg_prover/bin/gen_commit_and_proofs.rs +++ b/kzg_prover/bin/gen_commit_and_proofs.rs @@ -69,7 +69,7 @@ fn main() { .unwrap(); // Create a proof - let instances = vec![Fp::one(); 1]; // This instance is necessary to verify proof on solidity verifier. + let instances = vec![Fp::zero(); 1]; // This instance is necessary to verify proof on solidity verifier. let (zk_snark_proof, advice_polys, omega) = full_prover( ¶ms, &pk, diff --git a/kzg_prover/bin/gen_verifier.rs b/kzg_prover/bin/gen_verifier.rs index 3adffb7f..ea0c5810 100644 --- a/kzg_prover/bin/gen_verifier.rs +++ b/kzg_prover/bin/gen_verifier.rs @@ -69,7 +69,7 @@ fn main() { // 2. Generate Snark Proof for range check // // the instance values has to be at least more than one due to verifier contract that generated from SolidityGenerator. - let instances: Vec = vec![Fp::one(); 1]; + let instances: Vec = vec![Fp::zero(); 1]; let mut transcript = Keccak256Transcript::new(Vec::new()); let result = create_proof::<_, ProverSHPLONK<_>, _, _, _, _>(