From 0863a732ff7ae49c664594c162fdacdf2cde13bf Mon Sep 17 00:00:00 2001 From: Srinath Setty Date: Tue, 5 Jul 2022 14:50:17 -0700 Subject: [PATCH] Add asserts for constraint count (#83) * Add asserts for constraint count * switch to Standard strength --- Cargo.toml | 2 +- src/bellperson/mod.rs | 1 - src/circuit.rs | 10 ++-------- src/lib.rs | 2 +- src/poseidon.rs | 4 ++-- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bc3f456..08e02a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nova-snark" -version = "0.6.0" +version = "0.6.1" authors = ["Srinath Setty "] edition = "2021" description = "Recursive zkSNARKs without trusted setup" diff --git a/src/bellperson/mod.rs b/src/bellperson/mod.rs index 7d7e80e..fc66cb3 100644 --- a/src/bellperson/mod.rs +++ b/src/bellperson/mod.rs @@ -54,7 +54,6 @@ mod tests { 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 = SatisfyingAssignment::new(); diff --git a/src/circuit.rs b/src/circuit.rs index cd9569f..8ca56c6 100644 --- a/src/circuit.rs +++ b/src/circuit.rs @@ -404,10 +404,7 @@ mod tests { let mut cs: ShapeCS = 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::Base>> = @@ -422,10 +419,7 @@ mod tests { let mut cs: ShapeCS = 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 = <::Base as Field>::zero(); diff --git a/src/lib.rs b/src/lib.rs index a9f7d57..c011d8d 100644 --- a/src/lib.rs +++ b/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)] diff --git a/src/poseidon.rs b/src/poseidon.rs index cfcf550..f1988bb 100644 --- a/src/poseidon.rs +++ b/src/poseidon.rs @@ -36,8 +36,8 @@ where /// Generate Poseidon constants for the arities that Nova uses #[allow(clippy::new_without_default)] fn new() -> Self { - let constants27 = PoseidonConstants::::new_with_strength(Strength::Strengthened); - let constants32 = PoseidonConstants::::new_with_strength(Strength::Strengthened); + let constants27 = PoseidonConstants::::new_with_strength(Strength::Standard); + let constants32 = PoseidonConstants::::new_with_strength(Strength::Standard); Self { constants27, constants32,