Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to see constraint traces #3

Open
oskarth opened this issue Feb 25, 2022 · 1 comment
Open

Unable to see constraint traces #3

oskarth opened this issue Feb 25, 2022 · 1 comment
Labels
track:zerokit Zerokit track (Applied ZK/Explorations)

Comments

@oskarth
Copy link
Contributor

oskarth commented Feb 25, 2022

Problem

When debugging circuits, it is very useful to see what constraints haven't been met and why.

Details

This should be possible with ConstraintLayer but I haven't managed to get to work properly:

In poseidon_tornado with

RUST_LOG="poseidon_tornado=TRACE,ark_relations=TRACE" cargo run

We get

Constraint trace requires enabling `ConstraintLayer`
thread 'main' panicked at 'assertion failed: {\n    use ark_relations::r1cs::{ConstraintSynthesizer, ConstraintSystem};\n    let cs = ConstraintSystem::<E::Fr>::new_ref();\n    circom.clone().generate_constraints(cs.clone()).unwrap();\n    cs.is_satisfied().unwrap()\n}', /home/oskarth/repos/github.com/gakonst/ark-circom/src/circom/builder.rs:82:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The panic happens because constraints aren't met, which is expected. This then panics because of the debug_assert here https://github.com/gakonst/ark-circom/blob/master/src/circom/builder.rs#L82-L87

The problem is the lack of tracing, even with 9b1fa85

Tracing instrumentation based on example here https://github.com/arkworks-rs/r1cs-tutorial/blob/main/merkle-tree-example/src/constraints.rs#L109-L113

Same when trying to do tracing instrumentation in various ways directly in ark-circom etc.

Error from https://github.com/arkworks-rs/snark/blob/master/relations/src/r1cs/constraint_system.rs#L609

Probably missing something simple here but haven't been to figure out what's wrong.

Acceptance criteria

Failing constraints should produce some form of useful debugging information re which constraints are failing.

@oskarth
Copy link
Contributor Author

oskarth commented Mar 11, 2022

This is actually quite a big problem, e.g. a typo "nullifer" vs "nullifier" had me stumped for quite a while. Right now there's zero useful feedback here. Some kind of type assertions would be useful here? Probably requires looking into proof/witness WASM format a bit more.

@oskarth oskarth added the track:zerokit Zerokit track (Applied ZK/Explorations) label Sep 14, 2022
@oskarth oskarth moved this to Later/Icebox in Vac Research Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
track:zerokit Zerokit track (Applied ZK/Explorations)
Projects
Status: Later/Icebox
Development

No branches or pull requests

1 participant