Browse Source

Add asserts for constraint count (#83)

* Add asserts for constraint count

* switch to Standard strength
main
Srinath Setty 2 years ago
committed by GitHub
parent
commit
0863a732ff
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 13 deletions
  1. +1
    -1
      Cargo.toml
  2. +0
    -1
      src/bellperson/mod.rs
  3. +2
    -8
      src/circuit.rs
  4. +1
    -1
      src/lib.rs
  5. +2
    -2
      src/poseidon.rs

+ 1
- 1
Cargo.toml

@ -1,6 +1,6 @@
[package] [package]
name = "nova-snark" name = "nova-snark"
version = "0.6.0"
version = "0.6.1"
authors = ["Srinath Setty <srinath@microsoft.com>"] authors = ["Srinath Setty <srinath@microsoft.com>"]
edition = "2021" edition = "2021"
description = "Recursive zkSNARKs without trusted setup" description = "Recursive zkSNARKs without trusted setup"

+ 0
- 1
src/bellperson/mod.rs

@ -54,7 +54,6 @@ mod tests {
let _ = synthesize_alloc_bit(&mut cs); let _ = synthesize_alloc_bit(&mut cs);
let shape = cs.r1cs_shape(); let shape = cs.r1cs_shape();
let gens = cs.r1cs_gens(); let gens = cs.r1cs_gens();
println!("Mult mod constraint no: {}", cs.num_constraints());
// Now get the assignment // Now get the assignment
let mut cs: SatisfyingAssignment<G> = SatisfyingAssignment::new(); let mut cs: SatisfyingAssignment<G> = SatisfyingAssignment::new();

+ 2
- 8
src/circuit.rs

@ -404,10 +404,7 @@ mod tests {
let mut cs: ShapeCS<G1> = ShapeCS::new(); let mut cs: ShapeCS<G1> = ShapeCS::new();
let _ = circuit1.synthesize(&mut cs); let _ = circuit1.synthesize(&mut cs);
let (shape1, gens1) = (cs.r1cs_shape(), cs.r1cs_gens()); 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 // Initialize the shape and gens for the secondary
let circuit2: NIFSVerifierCircuit<G1, TestCircuit<<G1 as Group>::Base>> = let circuit2: NIFSVerifierCircuit<G1, TestCircuit<<G1 as Group>::Base>> =
@ -422,10 +419,7 @@ mod tests {
let mut cs: ShapeCS<G2> = ShapeCS::new(); let mut cs: ShapeCS<G2> = ShapeCS::new();
let _ = circuit2.synthesize(&mut cs); let _ = circuit2.synthesize(&mut cs);
let (shape2, gens2) = (cs.r1cs_shape(), cs.r1cs_gens()); 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 // Execute the base case for the primary
let zero1 = <<G2 as Group>::Base as Field>::zero(); let zero1 = <<G2 as Group>::Base as Field>::zero();

+ 1
- 1
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(non_snake_case)]
#![allow(clippy::type_complexity)] #![allow(clippy::type_complexity)]
#![deny(missing_docs)] #![deny(missing_docs)]

+ 2
- 2
src/poseidon.rs

@ -36,8 +36,8 @@ where
/// Generate Poseidon constants for the arities that Nova uses /// Generate Poseidon constants for the arities that Nova uses
#[allow(clippy::new_without_default)] #[allow(clippy::new_without_default)]
fn new() -> Self { 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 { Self {
constants27, constants27,
constants32, constants32,

Loading…
Cancel
Save