Description
Summary
This issue is about a feature request on ConstraintSystem
. Ideally, there is a debug
mode. When it is on, it helps the developers find out which constraint is failing.
Problem Definition
After the namespaces disappear from arkworks-rs
, it is harder to debug a constraint system that is not satisfactory, which often appears only when the verify
function fails.
Proposal
A potential solution for debugging is as follows:
-
When we enforce a constraint (https://github.com/arkworks-rs/snark/blob/master/relations/src/r1cs/constraint_system.rs#L254), we immediately check if this constraint is satisfactory. If not, panic immediately. Note that this cannot be done in the setup mode.
-
An implementation of such checking has appeared in Aleo's snarkVM, which intentionally checks if a constraint is satisfactory and records the first unsatisfactory constraint. https://github.com/AleoHQ/snarkVM/blob/testnet2/r1cs/src/test_constraint_checker.rs#L120
Since such checking has an overhead, it is only turned on when debug
mode is on, which by default is off.
For Admin Use
- Not duplicate issue
- Appropriate labels applied
- Appropriate contributors tagged
- Contributor assigned/self-assigned