diff --git a/Cargo.toml b/Cargo.toml index 9ec4276..2381b62 100644 --- a/Cargo.toml +++ b/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 } diff --git a/src/circom/mod.rs b/src/circom/mod.rs index 30fd840..ebaf0a5 100644 --- a/src/circom/mod.rs +++ b/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 = (ConstraintVec, ConstraintVec, ConstraintVec); pub type ConstraintVec = Vec<(usize, ::Fr)>; diff --git a/src/circom/qap.rs b/src/circom/qap.rs index 4b94b8d..0a94a89 100644 --- a/src/circom/qap.rs +++ b/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>( cs: ConstraintSystemRef, t: &F, ) -> Result<(Vec, Vec, Vec, F, usize, usize), SynthesisError> { - R1CStoQAP::instance_map_with_evaluation::(cs, t) + LibsnarkReduction::instance_map_with_evaluation::(cs, t) } fn witness_map>( diff --git a/src/lib.rs b/src/lib.rs index 3032da9..ea964de 100644 --- a/src/lib.rs +++ b/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; diff --git a/src/zkey.rs b/src/zkey.rs index c62e6c6..942c63d 100644 --- a/src/zkey.rs +++ b/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, ¶ms, &mut rng).unwrap(); + let proof = prove::<_, _, _, CircomReduction>(circom, ¶ms, &mut rng).unwrap(); let pvk = prepare_verifying_key(¶ms.vk);