Minimal constraint trace fail

This commit is contained in:
Oskar Thoren 2022-02-25 16:42:43 +08:00
parent 491b085807
commit 9b1fa85e46
No known key found for this signature in database
GPG Key ID: B2ECCFD3BC2EF77E
1 changed files with 27 additions and 0 deletions

View File

@ -7,13 +7,40 @@ use ark_groth16::{
create_random_proof as prove, generate_random_parameters, prepare_verifying_key, verify_proof,
};
// Tracing
use tracing::{span, event, Level};
use ark_relations::r1cs::{ConstraintTrace, ConstraintLayer, ConstraintSystem, TracingMode};
use tracing_subscriber::layer::SubscriberExt;
fn groth16_proof_example() -> Result<()> {
println!("Circom 1");
// Tracing to help with debugging
let mut layer = ConstraintLayer::default();
layer.mode = TracingMode::OnlyConstraints;
let subscriber = tracing_subscriber::Registry::default().with(layer);
let _guard = tracing::subscriber::set_default(subscriber);
let trace = ConstraintTrace::capture();
println!("Trace is: {:?}", trace);
let cfg = CircomConfig::<Bn254>::new(
"./resources/withdraw.wasm",
"./resources/withdraw.r1cs",
)?;
// Test
let trace = ConstraintTrace::capture();
println!("Trace is: {:?}", trace);
println!("Circom 2");
let mut builder = CircomBuilder::new(cfg);
println!("Circom 3");
// XXX Here - probably is inputs don't match,
// but would like the tracing to tell me this
builder.push_input("a", 3);
builder.push_input("b", 11);