Skip to content

Commit

Permalink
Add and fix some documentations and a minor optimization (#36)
Browse files Browse the repository at this point in the history
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
  • Loading branch information
lovesh and Pratyush committed Feb 2, 2023
1 parent 765b38b commit 23a2af0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### Improvements

- [\#36](https://github.com/arkworks-rs/groth16/pull/36) Documentation updates and minor optimization in setup.

### Bug fixes

## v0.3.0
Expand Down
22 changes: 13 additions & 9 deletions src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ where
cs.finalize();
end_timer!(lc_time);

// Following is the mapping of symbols from the Groth16 paper to this implementation
// l -> num_instance_variables
// m -> qap_num_variables
// x -> t
// t(x) - zt
// u_i(x) -> a
// v_i(x) -> b
// w_i(x) -> c

///////////////////////////////////////////////////////////////////////////
let domain_time = start_timer!(|| "Constructing evaluation domain");

Expand Down Expand Up @@ -157,9 +166,9 @@ where
.map(|((a, b), c)| (beta * a + &(alpha * b) + c) * &gamma_inverse)
.collect::<Vec<_>>();

let l = cfg_iter!(a)
.zip(&b)
.zip(&c)
let l = cfg_iter!(a[num_instance_variables..])
.zip(&b[num_instance_variables..])
.zip(&c[num_instance_variables..])
.map(|((a, b), c)| (beta * a + &(alpha * b) + c) * &delta_inverse)
.collect::<Vec<_>>();

Expand Down Expand Up @@ -218,12 +227,7 @@ where

// Compute the L-query
let l_time = start_timer!(|| "Calculate L");
let l_query = FixedBase::msm::<E::G1>(
scalar_bits,
g1_window,
&g1_table,
&l[num_instance_variables..],
);
let l_query = FixedBase::msm::<E::G1>(scalar_bits, g1_window, &g1_table, &l);
drop(l);
end_timer!(l_time);

Expand Down
2 changes: 1 addition & 1 deletion src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use ark_std::{
use rayon::prelude::*;

/// Create a Groth16 proof that is zero-knowledge.
/// This method samples randomness for zero knowledges via `rng`.
/// This method samples randomness for zero knowledge via `rng`.
pub fn create_random_proof<E, C, R>(
circuit: C,
pk: &ProvingKey<E>,
Expand Down
4 changes: 2 additions & 2 deletions tests/mimc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ impl<'a, F: Field> ConstraintSynthesizer<F> for MiMCDemo<'a, F> {
}

#[test]
fn test_mimc_gm_17() {
// We're going to use the Groth-Maller17 proving system.
fn test_mimc_groth16() {
// We're going to use the Groth16 proving system.
use ark_groth16::{
create_random_proof, generate_random_parameters, prepare_verifying_key, verify_proof,
};
Expand Down

0 comments on commit 23a2af0

Please sign in to comment.