arnaucube
arnaucube/ark-r1cs-stdPublic Self-hosted repository
Merge branch 'master' into inline-asm
jon-chuang 9093549+jon-chuang@users.noreply.github.com
Thu, 23 Apr 2020 22:00:29 +0800
commit

95fbfe06f6302df0d1324067b50df06750a0460e

parent

b1f4c50fd88686afcbbeec68d1d57df0bde9185e

M Cargo.toml → Cargo.toml

@@ -9,6 +9,7 @@ "cp-benches",

"crypto-primitives", "dpc", "ff-fft", + "ff-fft-benches", "gm17", "groth16", "r1cs-core",
M crypto-primitives/src/nizk/gm17/constraints.rs → crypto-primitives/src/nizk/gm17/constraints.rs

@@ -627,7 +627,7 @@ use r1cs_core::{ConstraintSynthesizer, ConstraintSystem, SynthesisError};

use super::*; use algebra::{ - fields::FpParameters, + fields::{FftParameters, FpParameters}, mnt4_298::{Fq as MNT4Fq, FqParameters as MNT4FqParameters, Fr as MNT4Fr, MNT4_298}, mnt6_298::{Fq as MNT6Fq, FqParameters as MNT6FqParameters, Fr as MNT6Fr, MNT6_298}, test_rng, BigInteger, PrimeField,

@@ -735,7 +735,7 @@

// Allocate this byte array as input packed into field elements. let input_bytes = UInt8::alloc_input_vec(cs.ns(|| "Input"), &input_bytes[..])?; // 40 byte - let element_size = <MNT4FqParameters as FpParameters>::BigInt::NUM_LIMBS * 8; + let element_size = <MNT4FqParameters as FftParameters>::BigInt::NUM_LIMBS * 8; input_gadgets = input_bytes .chunks(element_size) .map(|chunk| {

@@ -762,7 +762,7 @@ }

#[test] fn gm17_recursive_verifier_test() { - let num_inputs = 100; + let num_inputs = 5; let num_constraints = num_inputs; let rng = &mut test_rng(); let mut inputs: Vec<Option<MNT4Fq>> = Vec::with_capacity(num_inputs);

@@ -821,7 +821,7 @@ let inputs: Vec<_> = inputs.into_iter().map(|input| input.unwrap()).collect();

let mut input_gadgets = Vec::new(); { - let bigint_size = <MNT4FqParameters as FpParameters>::BigInt::NUM_LIMBS * 64; + let bigint_size = <MNT4FqParameters as FftParameters>::BigInt::NUM_LIMBS * 64; let mut input_bits = Vec::new(); let mut cs = cs.ns(|| "Allocate Input"); for (i, input) in inputs.into_iter().enumerate() {

@@ -847,7 +847,7 @@

// Pack input bits into field elements of the underlying circuit. let max_size = 8 * (<MNT6FqParameters as FpParameters>::CAPACITY / 8) as usize; let max_size = max_size as usize; - let bigint_size = <MNT6FqParameters as FpParameters>::BigInt::NUM_LIMBS * 64; + let bigint_size = <MNT6FqParameters as FftParameters>::BigInt::NUM_LIMBS * 64; for chunk in input_bits.chunks(max_size) { let mut chunk = chunk.to_vec(); let len = chunk.len();
M crypto-primitives/src/nizk/groth16/constraints.rs → crypto-primitives/src/nizk/groth16/constraints.rs

@@ -570,7 +570,7 @@ use r1cs_core::{ConstraintSynthesizer, ConstraintSystem, SynthesisError};

use super::*; use algebra::{ - fields::FpParameters, + fields::{FftParameters, FpParameters}, mnt4_298::{Fq as MNT4Fq, FqParameters as MNT4FqParameters, Fr as MNT4Fr, MNT4_298}, mnt6_298::{Fq as MNT6Fq, FqParameters as MNT6FqParameters, Fr as MNT6Fr, MNT6_298}, test_rng, BigInteger, PrimeField,

@@ -678,7 +678,7 @@

// Allocate this byte array as input packed into field elements. let input_bytes = UInt8::alloc_input_vec(cs.ns(|| "Input"), &input_bytes[..])?; // 40 byte - let element_size = <MNT4FqParameters as FpParameters>::BigInt::NUM_LIMBS * 8; + let element_size = <MNT4FqParameters as FftParameters>::BigInt::NUM_LIMBS * 8; input_gadgets = input_bytes .chunks(element_size) .map(|chunk| {

@@ -705,7 +705,7 @@ }

#[test] fn groth16_recursive_verifier_test() { - let num_inputs = 100; + let num_inputs = 5; let num_constraints = num_inputs; let rng = &mut test_rng(); let mut inputs: Vec<Option<MNT4Fq>> = Vec::with_capacity(num_inputs);

@@ -764,7 +764,7 @@ let inputs: Vec<_> = inputs.into_iter().map(|input| input.unwrap()).collect();

let mut input_gadgets = Vec::new(); { - let bigint_size = <MNT4FqParameters as FpParameters>::BigInt::NUM_LIMBS * 64; + let bigint_size = <MNT4FqParameters as FftParameters>::BigInt::NUM_LIMBS * 64; let mut input_bits = Vec::new(); let mut cs = cs.ns(|| "Allocate Input"); for (i, input) in inputs.into_iter().enumerate() {

@@ -790,7 +790,7 @@

// Pack input bits into field elements of the underlying circuit. let max_size = 8 * (<MNT6FqParameters as FpParameters>::CAPACITY / 8) as usize; let max_size = max_size as usize; - let bigint_size = <MNT6FqParameters as FpParameters>::BigInt::NUM_LIMBS * 64; + let bigint_size = <MNT6FqParameters as FftParameters>::BigInt::NUM_LIMBS * 64; for chunk in input_bits.chunks(max_size) { let mut chunk = chunk.to_vec(); let len = chunk.len();