Commit Graph

51 Commits

Author SHA1 Message Date
Sean Bowe 32df26d881
Make permutation argument perfectly complete and zero-knowledge. 2021-07-02 16:20:36 -06:00
str4d 62414a92b6
Merge pull request #309 from zcash/dev-metadata
dev: Refactor VerifyFailure to extract metadata structs
2021-06-23 16:28:25 +01:00
str4d 305ca89bab
Merge pull request #302 from daira/clippy-nightly-clean
Make this crate clippy clean for warnings on nightly
2021-06-23 13:30:07 +01:00
Jack Grigg 32edf65efa dev: Refactor VerifyFailure to extract metadata structs 2021-06-23 13:16:20 +01:00
Jack Grigg 6d0017f47c Introduce a FloorPlanner trait and integrate it into the Circuit trait
This is the beginning of the process to enable full floor planning
capabilities in `halo2`. For now, all that a floor planner can do is
synthesize a circuit, which makes it no more powerful than a layouter,
but easier to use (as moving to a multi-pass layouter no longer requires
changes to `Circuit::synthesize`).
2021-06-22 23:47:17 +01:00
Daira Hopwood 209144981a Remove needless borrows that are immediately dereferenced:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-06-21 18:19:15 +01:00
ebfull ffe87e1fef
Merge pull request #293 from zcash/assigned-batch-inversions
Add support for batched inversion of cell assignments
2021-06-19 09:05:21 -06:00
Jack Grigg 5f8a61cb24 MockProver: Switch VerifyFailure::Cell to report offset within region
This is more useful for developers, as the absolute cell row may be
obfuscated by the layouter, whereas the offset within a row is controlled
by the developer.
2021-06-18 17:52:53 +01:00
Jack Grigg 181ade5e29 MockProver: Check cell assignment per-region instead of globally
Current layouters measure the shape of regions by looking at the cells
they assign. If a chip developer forgets to assign a cell in a region,
it is possible for active gates to "stick out" past the edge of a
measured region shape.

`MockProver` checks that all active gates have their cells assigned,
but this was previously checked globally. If a layouter happened to
position the buggy region such that the dangling gate overlapped an
assigned cell in in adjacent region, this check would pass.

In this commit, we extend the check to be per-region. We map enabled
selectors and assigned cells to a specific region, and then if a gate
is active within a region, we require that its cells be assigned within
that same region.

Closes zcash/halo2#297.
2021-06-18 17:51:44 +01:00
Jack Grigg 251bc68c05 Introduce an Assigned struct into the Assignment trait APIs
Value closures can now return a `(numerator, denominator)` tuple, in
order to defer inversions until after assignment.
2021-06-12 19:34:13 +01:00
Jack Grigg 3e82c7b232 dev: Move halo2::dev::circuit_layout to halo2::dev::CircuitLayout::render
This makes it easier to add configuration to the renderer.
2021-06-08 12:13:18 +01:00
str4d d8e4f24df4
Merge pull request #287 from zcash/remove-selector-rotations
Remove rotations from Selectors
2021-06-05 23:36:37 +01:00
str4d 879509491f
Merge pull request #286 from zcash/constraint-annotations
Enable annotating individual constraints within gates
2021-06-05 23:36:28 +01:00
str4d 1dff93a8ad
dev: Update documentation for constraint_name
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-04 23:12:55 +01:00
Jack Grigg 0d8b3bab38 Remove rotations from Selectors
Enabling selectors to be used in gates at non-zero rotations leads to
confusing gates, and inhibits our ability to create visualizations of
circuits. In most cases, a gate can be rearranged so that the selectors
have no rotation; in cases where cross-gate selector optimisations are
required, these can still be implemented using fixed columns.
2021-06-04 16:18:51 +01:00
Jack Grigg 483c872cbe dev: Clarify gate name documentation 2021-06-04 15:18:52 +01:00
Jack Grigg 6cf73391e8 Enable annotating individual constraints within gates
The closure passed to `ConstraintSystem::create_gate` can now return:

- Tuples of `(&'static str, Expression<F>)`
- Anything implementing `IntoIterator` (e.g. `Some(Expression<F>)`)
2021-06-04 03:49:21 +01:00
Jack Grigg ff2a500e9a dev: impl fmt::Display for VerifyFailure 2021-06-04 03:46:08 +01:00
Jack Grigg 47061ade3d dev: Report indices of unsatisfied constraints
Now that gates may contain multiple constraints, we need to inform
developers about which specific constraints are failing within gates.
2021-06-04 03:46:08 +01:00
Jack Grigg e01fb15018 dev: Fix bug in cell assignment checker
The simple example was broken because it uses an instance column in a
gate. MockProver now assumes all instance cells are assigned to, since
this happens outside the circuit and outside its purview.
2021-06-04 02:56:35 +01:00
Jack Grigg 6dd3d1831b MockProver: Check that cells for active gates are assigned to 2021-05-27 18:10:23 +01:00
Jack Grigg 32896917d0 Add a failing test showing an undetected missed assignment 2021-05-27 15:02:01 +01:00
Jack Grigg 0f0dd8a26c Allow multiple polynomial constraints per gate
This enables a gate such as ECC complete addition to define its
constraints in terms of a common set of queried columns.
2021-05-27 15:01:46 +01:00
Jack Grigg e19407a749 Expose selector enablement to the Assignment backends 2021-05-27 12:51:25 +01:00
Jack Grigg 6bf0803fd9 Add a plonk::Gate struct
This will make it easier to track additional gate-related metadata.
2021-05-27 01:25:22 +01:00
Jack Grigg 266badf25c MockProver: Return all constraint failures, not just first 2021-05-18 16:32:15 +01:00
str4d de883a4b8b
Formatting fixes 2021-05-18 15:26:23 +01:00
therealyingtong b361559d50 [MockProver] Handle query rotations in lookups 2021-05-12 22:37:23 +08:00
Jack Grigg 4c9362c504 MockProver: Look up permutations from correct column types 2021-04-09 13:23:07 +12:00
therealyingtong 5a341b0f8f Modify Assignment::copy() to take Column<Any> instead of usize 2021-02-24 00:18:22 +08:00
therealyingtong d82a0c85b1 Modify Assignment::copy() to take Permutation instead of usize 2021-02-24 00:17:29 +08:00
therealyingtong 4bf46fc349
Add Expression::Const variant 2021-02-18 15:41:36 -07:00
therealyingtong 6a7f869f66
Clippy fixes 2021-02-18 15:41:36 -07:00
therealyingtong 8e56b415fb
Rename column -> expression for lookups 2021-02-18 15:41:36 -07:00
therealyingtong d8534e1c50
Pass Expressions to meta.lookup() 2021-02-18 15:41:35 -07:00
Daira Hopwood 760d69bd2c Rename "auxiliary column" to "instance column" in the book and in code. fixes #181
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-02-14 21:09:49 +00:00
Jack Grigg 3c1132ec59 Add halo2::dev::circuit_layout behind dev-graph feature flag
This method renders circuits as tables, showing how the various regions
within them have been layed out.
2021-02-01 18:38:20 +00:00
Jack Grigg 7dd6e65a5f Add halo2::dev::circuit_dot_graph behind dev-graph feature flag
This method renders circuits as dot graphs, to help circuit developers
understand their structure.
2021-02-01 18:38:16 +00:00
Jack Grigg 82da677add Add name field to ConstraintSystem::create_gate
The name has type `&'static str`, as gates apply to every row and thus
do not require any runtime information to name.
2021-02-01 18:38:13 +00:00
Jack Grigg bf771a7446 Add namespacing and gadget name collection to Layouter 2021-02-01 18:38:04 +00:00
Jack Grigg 60061f64fd Add name field to Layouter::assign_region 2021-02-01 18:34:24 +00:00
Jack Grigg 4c3adf59d5 Add annotations to Region::{assign_advice, assign_fixed}
This enables circuits to annotate individual cells with variable names
or similar protocol-specific metadata.
2021-02-01 18:33:25 +00:00
therealyingtong de86391f0e Update test to pass multiple ConcreteCircuits 2021-01-31 11:48:32 +08:00
Kris Nuttycombe 94dd9cc421 Fix doctests. 2021-01-14 13:31:48 -07:00
Jack Grigg d94e9b3daf Remove unnecessary trailing semicolon 2021-01-08 02:22:16 +00:00
Jack Grigg 08da49353e Fix clippy lints in MockProver 2021-01-07 12:42:04 +00:00
Jack Grigg 8590211585 Remove unnecessary parts from MockProver per review comments 2021-01-06 21:52:56 +00:00
Jack Grigg 49f1598c0e Add example to MockProver documentation
Also fixes a bug in MockProver::verify (which was exposing an internal
implementation detail as an incorrect row numbering).
2021-01-06 21:52:56 +00:00
Jack Grigg 64b06735bf Expose MockProver in crate, and add documentation 2021-01-06 21:52:56 +00:00
therealyingtong fb939f17a9 Add permutation check to MockProver 2021-01-06 21:52:56 +00:00