Commit Graph

1103 Commits

Author SHA1 Message Date
str4d 93aabf26c6
Merge pull request #310 from zcash/clippy-capitalized-acronyms
clippy: Fix capitalized acronyms in tests and examples
2021-06-23 16:28:38 +01: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
Jack Grigg e262941b70 clippy: Fix capitalized acronyms in tests and examples 2021-06-23 13:33:04 +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
str4d 3c24e6b811
Merge pull request #306 from zcash/final-transcript-changes
Final transcript changes
2021-06-23 13:28:53 +01:00
Jack Grigg 32edf65efa dev: Refactor VerifyFailure to extract metadata structs 2021-06-23 13:16:20 +01:00
str4d b88435712f
Merge pull request #305 from zcash/integrate-layouter-with-circuit
Introduce a FloorPlanner trait and integrate it into the Circuit trait
2021-06-22 23:53:24 +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
str4d 2474647af0
Merge pull request #304 from zcash/reduce-fieldext
Reduce various trait requirements from `FieldExt` to `Field`
2021-06-22 23:42:54 +01:00
str4d be6db1f489
Merge pull request #303 from zcash/migrate-plonk-examples
Migrate PLONK-gate-using circuits to use SingleChipLayouter
2021-06-22 23:42:11 +01:00
Sean Bowe 6194b49dee
Make prover messages unambiguous and alter the manner in which challenges are squeezed. 2021-06-22 14:06:02 -06:00
Sean Bowe 7211d78dfe
Minor improvements to the transcript implementation. 2021-06-22 13:51:31 -06:00
Jack Grigg f5bd3109eb Reduce various trait requirements from `FieldExt` to `Field` 2021-06-22 00:35:57 +01:00
Jack Grigg 1b04877b3d Migrate PLONK-gate-using circuits to use SingleChipLayouter
These were all early examples that used the Circuit trait without any
layouter, which is incompatible with upcoming changes.

The minimal change to the PinnedVerificationKey is because the lookup
table is being allocated at the top of its columns instead of in-place.
2021-06-22 00:22:12 +01:00
Daira Hopwood 00ca9aa6c3 Remove needless .collect()s.
https://rust-lang.github.io/rust-clippy/master/index.html#needless_collect

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-06-21 18:26:08 +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 088f912d34 Make Assigned an enum, to remove field comparisions from batch eval 2021-06-18 22:04:31 +01:00
ebfull ac68cee6de
Merge pull request #298 from zcash/297-per-region-gate-assignment
MockProver: Check cell assignment per-region instead of globally
2021-06-18 14:20:39 -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 572d74e1a0 Add an Assigned::invert method 2021-06-12 19:36:37 +01:00
Jack Grigg 1d7060af8a Enable region assignments to defer inversions 2021-06-12 19:36:37 +01:00
Jack Grigg cbd198fc71 Batch invert cell assignments during keygen and proving 2021-06-12 19:34:13 +01:00
Jack Grigg d685c5c5e6 impl operators for Assigned
This enables chips to use this as an intermediate value while computing
witnesses.
2021-06-12 19:34:13 +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
str4d 236115917d
Merge pull request #290 from zcash/v1-layouter
V1 layouter
2021-06-12 18:14:54 +01:00
str4d eae5049ba2
Merge pull request #291 from zcash/circuitlayout-builder
dev: CircuitLayout builder
2021-06-11 23:50:08 +01:00
ying tong d04b532368
Merge pull request #292 from zcash/expression-square
plonk::circuit.rs: Add Expression::square() method.
2021-06-12 06:49:36 +08:00
therealyingtong c907ca5410 plonk::circuit.rs: Add Expression::square() method.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-06-11 12:31:27 +08:00
Jack Grigg faac7b798b dev: Render Selectors in a darker shade of blue
The regions are now rendered uniformly the same colour, by removing the
background bleed-through (which was more complex now that the fixed
columns are rendered in two colours).
2021-06-10 00:06:20 +01:00
Jack Grigg 49e18b2647 dev: Render labels last (so they are always the top layer) 2021-06-10 00:05:49 +01:00
Jack Grigg 53c43e85b2 Fix clippy lints 2021-06-08 12:40:16 +01:00
Jack Grigg d4984ebf53 dev: Enable CircuitLayout labels to be hidden 2021-06-08 12:26:37 +01:00
Jack Grigg 52be437509 dev: Add CircuitLayout viewport controls 2021-06-08 12:26:37 +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
Jack Grigg 7cca91331b Implement improved strategy for the V1 layouter
This layouter improves on the single-pass strategy in two ways:

- Regions are layed out with a "first fit" strategy (using the algorithm
  described in https://github.com/zcash/halo2/issues/93) instead of a
  "last fit" strategy. This enables gaps in the circuit to be filled.

- Regions are sorted by their "advice area" (columns * rows), and are
  then layed out biggest-first. This takes advantage of the regularity
  of circuits, and that the advice columns have the most contention. It
  also leads to larger gaps between early layed-out regions that are more
  easily filled by subsequent smaller regions.
2021-06-08 11:35:41 +01:00
Jack Grigg a94d4a9c01 Implement V1 layouter
The V1 layouter is a dual-pass layouter, that has visibility into the
entire `Circuit::synthesize` step.

This first commit implements the same strategy as `SingleChipLayouter`,
behaving as if it were a single-pass layouter.
2021-06-07 15:13:41 +01:00
Jack Grigg b00a0df392 Move SingleChipLayouter into a submodule
It is a single-pass layouter, but we won't rename it for now.
2021-06-07 14:52:25 +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 53ac47fcec
Merge pull request #289 from zcash/ci-book-fix
CI: Build book with latest mdbook
2021-06-05 11:38:02 +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
str4d 5bf9390d23
Merge pull request #285 from zcash/dev-gate-constraints
dev: MockProver fixes and improvements
2021-06-04 23:11:49 +01:00
Jack Grigg a388726ce9 CI: Build book with latest mdbook
`mdbook-katex` is installed from crates.io, and if it doesn't use the
same version of `mdbook` it can cause build issues.
2021-06-04 22:41:25 +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 876587c818 Panic in ConstraintSystem::create_gate if it would contain no constraints
We use iterators to allow a gate to contain more than one constraint, but
it is a programming error for a gate to not contain any constraints.
2021-06-04 12:59:57 +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