Skip to content

Commit

Permalink
fix: set instance value as zero for using in range check
Browse files Browse the repository at this point in the history
  • Loading branch information
sifnoc committed Mar 13, 2024
1 parent b26fda0 commit db1f236
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions kzg_prover/benches/kzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ fn bench_kzg<
b.iter_batched(
|| circuit.clone(), // Setup function: clone the circuit for each iteration
|circuit| {
full_prover(&params, &pk, circuit, &[vec![]]);
full_prover(&params, &pk, circuit, &[vec![Fp::zero()]]);
},
criterion::BatchSize::SmallInput, // Choose an appropriate batch size
);
});

let (zk_snark_proof, advice_polys, omega) = full_prover(&params, &pk, circuit, &[vec![]]);
let (zk_snark_proof, advice_polys, omega) =
full_prover(&params, &pk, circuit, &[vec![Fp::zero()]]);

let poly_length = 1 << u64::from(K);

Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion kzg_prover/bin/gen_commit_and_proofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
&params,
&pk,
Expand Down
2 changes: 1 addition & 1 deletion kzg_prover/bin/gen_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Fr> = vec![Fp::one(); 1];
let instances: Vec<Fr> = vec![Fp::zero(); 1];
let mut transcript = Keccak256Transcript::new(Vec::new());

let result = create_proof::<_, ProverSHPLONK<_>, _, _, _, _>(
Expand Down

0 comments on commit db1f236

Please sign in to comment.