Browse Source

fix: use latest names for groth16 traits/types

pull/3/head
Georgios Konstantopoulos 3 years ago
parent
commit
c32270a285
5 changed files with 9 additions and 9 deletions
  1. +1
    -1
      Cargo.toml
  2. +1
    -1
      src/circom/mod.rs
  3. +4
    -4
      src/circom/qap.rs
  4. +1
    -1
      src/lib.rs
  5. +2
    -2
      src/zkey.rs

+ 1
- 1
Cargo.toml

@ -15,7 +15,7 @@ ark-ec = { version = "0.3.0", default-features = false }
ark-ff = { version = "0.3.0", default-features = false }
ark-std = { version = "0.3.0", default-features = false }
ark-bn254 = { version = "0.3.0" }
ark-groth16 = { git = "https://github.com/kobigurk/groth16", version = "0.3.0", branch = "feat/customizable-r1cs-to-qap" }
ark-groth16 = { git = "https://github.com/gakonst/groth16", version = "0.3.0", branch = "feat/customizable-r1cs-to-qap" }
ark-poly = { version = "^0.3.0", default-features = false }
ark-relations = { version = "0.3.0", default-features = false }
ark-serialize = { version = "0.3.0", default-features = false }

+ 1
- 1
src/circom/mod.rs

@ -10,7 +10,7 @@ mod builder;
pub use builder::{CircomBuilder, CircomConfig};
mod qap;
pub use qap::R1CStoQAPCircom;
pub use qap::CircomReduction;
pub type Constraints<E> = (ConstraintVec<E>, ConstraintVec<E>, ConstraintVec<E>);
pub type ConstraintVec<E> = Vec<(usize, <E as PairingEngine>::Fr)>;

+ 4
- 4
src/circom/qap.rs

@ -1,5 +1,5 @@
use ark_ff::PrimeField;
use ark_groth16::r1cs_to_qap::{evaluate_constraint, QAPCalculator, R1CStoQAP};
use ark_groth16::r1cs_to_qap::{evaluate_constraint, LibsnarkReduction, R1CStoQAP};
use ark_poly::EvaluationDomain;
use ark_relations::r1cs::{ConstraintSystemRef, SynthesisError};
use ark_std::{cfg_into_iter, cfg_iter, cfg_iter_mut, vec};
@ -10,15 +10,15 @@ use core::ops::Deref;
/// coefficients domain. snarkjs instead precomputes the Lagrange form of the powers of tau bases
/// in a domain twice as large and the witness map is computed as the odd coefficients of (AB-C)
/// in that domain. This serves as HZ when computing the C proof element.
pub struct R1CStoQAPCircom;
pub struct CircomReduction;
impl QAPCalculator for R1CStoQAPCircom {
impl R1CStoQAP for CircomReduction {
#[allow(clippy::type_complexity)]
fn instance_map_with_evaluation<F: PrimeField, D: EvaluationDomain<F>>(
cs: ConstraintSystemRef<F>,
t: &F,
) -> Result<(Vec<F>, Vec<F>, Vec<F>, F, usize, usize), SynthesisError> {
R1CStoQAP::instance_map_with_evaluation::<F, D>(cs, t)
LibsnarkReduction::instance_map_with_evaluation::<F, D>(cs, t)
}
fn witness_map<F: PrimeField, D: EvaluationDomain<F>>(

+ 1
- 1
src/lib.rs

@ -4,7 +4,7 @@
mod witness;
pub mod circom;
pub use circom::{CircomBuilder, CircomCircuit, CircomConfig, R1CStoQAPCircom};
pub use circom::{CircomBuilder, CircomCircuit, CircomConfig, CircomReduction};
pub mod ethereum;

+ 2
- 2
src/zkey.rs

@ -299,7 +299,7 @@ mod tests {
use serde_json::Value;
use std::fs::File;
use crate::{circom::R1CStoQAPCircom, CircomBuilder, CircomConfig};
use crate::{circom::CircomReduction, CircomBuilder, CircomConfig};
use ark_groth16::{create_random_proof_with_qap as prove, prepare_verifying_key, verify_proof};
use ark_std::rand::thread_rng;
use num_traits::{One, Zero};
@ -783,7 +783,7 @@ mod tests {
let inputs = circom.get_public_inputs().unwrap();
let mut rng = thread_rng();
let proof = prove::<_, _, _, R1CStoQAPCircom>(circom, &params, &mut rng).unwrap();
let proof = prove::<_, _, _, CircomReduction>(circom, &params, &mut rng).unwrap();
let pvk = prepare_verifying_key(&params.vk);

Loading…
Cancel
Save