arnaucube
arnaucube/NovaPublic Self-hosted repository
Add asserts for constraint count (#83)

* Add asserts for constraint count

* switch to Standard strength
Srinath Setty srinath@microsoft.com
Tue, 05 Jul 2022 14:50:17 -0700
commit

0863a732ff7ae49c664594c162fdacdf2cde13bf

parent

c29030b2d77ee72b5010130efd0992c8fa653651

5 files changed, 6 insertions(+), 13 deletions(-)

jump to
M Cargo.toml → Cargo.toml

@@ -1,6 +1,6 @@

[package] name = "nova-snark" -version = "0.6.0" +version = "0.6.1" authors = ["Srinath Setty <srinath@microsoft.com>"] edition = "2021" description = "Recursive zkSNARKs without trusted setup"
M src/bellperson/mod.rs → src/bellperson/mod.rs

@@ -54,7 +54,6 @@ let mut cs: ShapeCS<G> = ShapeCS::new();

let _ = synthesize_alloc_bit(&mut cs); let shape = cs.r1cs_shape(); let gens = cs.r1cs_gens(); - println!("Mult mod constraint no: {}", cs.num_constraints()); // Now get the assignment let mut cs: SatisfyingAssignment<G> = SatisfyingAssignment::new();
M src/circuit.rs → src/circuit.rs

@@ -404,10 +404,7 @@ );

let mut cs: ShapeCS<G1> = ShapeCS::new(); let _ = circuit1.synthesize(&mut cs); let (shape1, gens1) = (cs.r1cs_shape(), cs.r1cs_gens()); - println!( - "Circuit1 -> Number of constraints: {}", - cs.num_constraints() - ); + assert_eq!(cs.num_constraints(), 20584); // Initialize the shape and gens for the secondary let circuit2: NIFSVerifierCircuit<G1, TestCircuit<<G1 as Group>::Base>> =

@@ -422,10 +419,7 @@ );

let mut cs: ShapeCS<G2> = ShapeCS::new(); let _ = circuit2.synthesize(&mut cs); let (shape2, gens2) = (cs.r1cs_shape(), cs.r1cs_gens()); - println!( - "Circuit2 -> Number of constraints: {}", - cs.num_constraints() - ); + assert_eq!(cs.num_constraints(), 21124); // Execute the base case for the primary let zero1 = <<G2 as Group>::Base as Field>::zero();
M src/lib.rs → src/lib.rs

@@ -1,4 +1,4 @@

-//! This library implements core components of Nova. +//! This library implements Nova, a high-speed recursive SNARK. #![allow(non_snake_case)] #![allow(clippy::type_complexity)] #![deny(missing_docs)]
M src/poseidon.rs → src/poseidon.rs

@@ -36,8 +36,8 @@ {

/// Generate Poseidon constants for the arities that Nova uses #[allow(clippy::new_without_default)] fn new() -> Self { - let constants27 = PoseidonConstants::<Scalar, U27>::new_with_strength(Strength::Strengthened); - let constants32 = PoseidonConstants::<Scalar, U32>::new_with_strength(Strength::Strengthened); + let constants27 = PoseidonConstants::<Scalar, U27>::new_with_strength(Strength::Standard); + let constants32 = PoseidonConstants::<Scalar, U32>::new_with_strength(Strength::Standard); Self { constants27, constants32,