Browse Source

When constraints are unsatisfied, show first one (#21)

Useful for debugging
pull/3/head
oskarth 2 years ago
committed by GitHub
parent
commit
d0478d1538
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/circom/builder.rs

+ 9
- 1
src/circom/builder.rs

@ -83,7 +83,15 @@ impl CircomBuilder {
use ark_relations::r1cs::{ConstraintSynthesizer, ConstraintSystem};
let cs = ConstraintSystem::<E::Fr>::new_ref();
circom.clone().generate_constraints(cs.clone()).unwrap();
cs.is_satisfied().unwrap()
let is_satisfied = cs.is_satisfied().unwrap();
if !is_satisfied {
println!(
"Unsatisfied constraint: {:?}",
cs.which_is_unsatisfied().unwrap()
);
}
is_satisfied
});
Ok(circom)

Loading…
Cancel
Save