Jack Grigg
8e1fb87a33
dev: Add a custom `VerifyFailure::ConstraintNotSatisfied` emitter
...
An example failure, shown via `assert_eq!(err, Ok(()))`:
```
left: `Err([ConstraintNotSatisfied { constraint: Constraint { gate: Gate { index: 0, name: "R1CS constraint" }, index: 0, name: "buggy R1CS" }, location: InRegion { region: Region { index: 0, name: "Example region" }, offset: 1 }, cell_values: [(VirtualCell { name: "", column: Column { column_type: Advice, index: 0 }, rotation: 0 }, "0x2"), (VirtualCell { name: "", column: Column { column_type: Advice, index: 1 }, rotation: -1 }, "0x4"), (VirtualCell { name: "", column: Column { column_type: Advice, index: 2 }, rotation: 1 }, "0x8")] }])`,
right: `Ok(())`',
```
Via `impl Display for VerifyFailure`:
```
Constraint 0 ('buggy R1CS') in gate 0 ('R1CS constraint') is not satisfied in Region 0 ('Example region') at offset 1
- Column('Advice', 0)@0 = 0x2
- Column('Advice', 1)@-1 = 0x4
- Column('Advice', 2)@1 = 0x8
```
Via `VerifyFailure::emit`:
```
error: constraint not satisfied
Cell layout in region 'Example region':
| Offset | A0 | A1 | A2 |
+--------+----+----+----+
| 0 | | x1 | |
| 1 | x0 | | | <--{ Gate 'R1CS constraint' applied here
| 2 | | | x2 |
Constraint 'buggy R1CS':
S0 * (x0 * x1 + x2) = 0
Assigned cell values:
x0 = 0x2
x1 = 0x4
x2 = 0x8
```
2022-02-16 13:56:17 +00:00
Jack Grigg
5cdc029bb4
dev: Add `MockProver::assert_satisfied`
...
This is equivalent to `assert_eq!(mock_prover.verify(), Ok(()))`, but
pretty-prints the verification failures instead of debug-printing them.
In its initial state, it just prints the `Display` impl.
2022-02-16 13:56:17 +00:00