Commit Graph

20 Commits

Author SHA1 Message Date
Jack Grigg cb819e47e9 Migrate to `ff` revision without `FieldExt` 2022-11-30 19:35:26 +00:00
Jack Grigg 49b2324f0a Replace unnecessary dependencies on `FieldExt` trait 2022-11-30 03:41:19 +00:00
therealyingtong 76c658b321 [MockProver] Check for instance values in gate queries. 2022-09-13 18:25:21 +08:00
Jack Grigg f852be62a8 halo2_proofs: Remove unused imports 2022-09-09 17:43:43 +00:00
han0110 8ff5b1e3af feat: make `Expression::{Fixed,Advice,Instance}` to wrap their own `Query` struct 2022-07-15 10:33:47 -04:00
Jack Grigg 47f25ad632 halo2_proofs: Replace `Option<V>` with `Value<V>` 2022-06-08 23:03:16 +00:00
str4d 46ba444169
Merge pull request #480 from zcash/477-mockprover-pretty-failures
Add `MockProver::assert_satisfied` with pretty-printed failures
2022-04-20 12:53:16 +02:00
str4d 69c138c25c
Clarify some comments and messages
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-04-19 16:04:19 +02:00
Daira Hopwood 424a2748d1
Clarify a comment 2022-04-19 12:36:02 +01:00
Jack Grigg 0946bdb455 dev: Enable `VerifyFailure::Permutation` to point to region offsets 2022-03-30 01:39:50 +00:00
Daira Hopwood b48b032041
Minor simplification 2022-02-16 17:14:41 +00:00
Jack Grigg 369ff521d3 dev: Store gate offset in `VerifyFailure::CellNotAssigned` 2022-02-16 13:57:53 +00:00
Jack Grigg c19a1ade2a dev: Add a custom `VerifyFailure::Lookup` emitter
The `dev::tests::bad_lookup` test case, shown via `assert_eq!(err, Ok(()))`:
```
  left: `Err([Lookup { lookup_index: 0, location: InRegion { region: Region { index: 2, name: "Faulty synthesis" }, offset: 1 } }])`,
 right: `Ok(())`',
```

Via `impl Display for VerifyFailure`:
```
Lookup 0 is not satisfied in Region 2 ('Faulty synthesis') at offset 1
```

Via `VerifyFailure::emit`:
```
error: lookup input does not exist in table
  (L0) ∉ (F0)

  Lookup inputs:
    L0 = x1 * x0 + (1 - x1) * 0x2
    ^
    | Cell layout in region 'Faulty synthesis':
    |   | Offset | A0 | F1 |
    |   +--------+----+----+
    |   |    1   | x0 | x1 | <--{ Lookup inputs queried here
    |
    | Assigned cell values:
    |   x0 = 0x5
    |   x1 = 1
```
2022-02-16 13:56:17 +00:00
Jack Grigg 62eea4c457 dev: Move cell loaders into `dev::util` 2022-02-16 13:56:17 +00:00
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
Jack Grigg 0e08903669 dev: Move `VerifyFailure` and `FailureLocation` into submodule 2022-02-16 13:55:29 +00:00
Daira Hopwood e7ffefdbe2 MockProver: Optimize repetitions of the last usable row, not the zero row.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-15 00:30:54 +00:00
Daira Hopwood 7107b8353a MockProver: Use a sorted scan to check that lookup inputs
are contained in the table, fixing a performance regression.
This includes an optimization for "fill rows", which are
assumed in this commit to be all-zeros.

closes #398

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-02-14 23:54:06 +00:00
Jack Grigg 3c6558f049 Move `halo2` code into `halo2_proofs` crate 2022-01-20 18:50:43 +00:00