Commit Graph

970 Commits

Author SHA1 Message Date
Jack Grigg 69b169057d Update COPYING with latest license text 2021-09-22 20:06:50 +01:00
Jack Grigg 78f0e21563 Require pasta_curves 0.2.1
This is the first version that was relicensed as MIT OR Apache-2.0.
2021-09-22 19:59:04 +01:00
ebfull 6d53a2adf8
Merge pull request #368 from zcash/protocol-formalization
Add formal protocol description and preliminaries
2021-09-20 09:42:12 -06:00
Sean Bowe 424af080ba
Add formal protocol description and preliminaries. 2021-09-20 09:30:02 -06:00
str4d 26047eaf32
Merge pull request #362 from zcash/ff-0.11
ff 0.11, group 0.11, pasta_curves 0.2
2021-09-06 19:45:22 +01:00
Jack Grigg 81622bf847 ff 0.11, group 0.11, pasta_curves 0.2 2021-09-02 23:05:18 +01:00
Daira Hopwood 236a5e37a5
Merge pull request #355 from zcash/dev-gates-queries
dev: Add helper method to print queries per-constraint to a CSV file
2021-08-25 10:55:29 +01:00
Daira Hopwood 26744c103d
Merge pull request #356 from parazyd/book-dev-tools-fix
book: Fix rendering of cost-model output.
2021-08-25 10:52:27 +01:00
parazyd 1b0a22096b
book: Fix rendering of cost-model output.
This should stop html tags appearing inside the <code> tags.
2021-07-31 15:24:50 +02:00
Jack Grigg 3731580790 dev: Add helper method to print queries per-constraint to a CSV file 2021-07-29 01:19:51 +01:00
str4d 27c4187673
Merge pull request #354 from daira/table-refactoring
Add a `Layouter::assign_table` API
2021-07-27 20:52:36 +01:00
str4d 6dcc61898f
Add `used_columns` to `SimpleTableLayouter` `Debug` impl
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-07-27 17:55:34 +01:00
str4d eab1884504
Add code comments from review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: ying tong <yingtong@z.cash>
2021-07-27 17:49:52 +01:00
Jack Grigg 49a763cd61 Rename `Table::assign_fixed` to `Table::assign_cell` 2021-07-27 17:48:13 +01:00
Jack Grigg a62c5d13fd test: Update plonk_api pinned verification key
The lookup table column was un-equality-enabled when it became a
TableColumn.
2021-07-27 17:25:16 +01:00
str4d 4fdc52a74a
Merge pull request #353 from zcash/dev-circuit-gates
Developer tooling improvements
2021-07-27 17:20:02 +01:00
Daira Hopwood 58390059d5
Merge pull request #352 from zcash/expression-neg
`Expression::Negated`
2021-07-27 17:18:09 +01:00
Jack Grigg 57877f5f18 Fix clippy lints 2021-07-27 16:04:27 +01:00
Jack Grigg e855ac6adb Add `halo2::plonk::circuit::TableColumn` struct
This type is required by the `ConstraintSystem::lookup` API, and cannot
be converted into a `Column<Fixed>` via the public API, forcing chip
developers to use `Layouter::assign_table` API to load tables. This is
a safety feature, as lookup table rows need to be default-value-filled
by the layouter (or else the table would have an implicit default value
of all-zeroes which could introduce soundness bugs into circuits).
2021-07-27 15:52:42 +01:00
Jack Grigg 8d8e76dc82 dev: Minor fixes to `CircuitLayout`
- Default view height is now the circuit size.
- Cells are now always shaded on top of any drawn regions.
2021-07-27 02:25:46 +01:00
Jack Grigg 7cf58661d8 dev: Add used/usable row metadata to `CircuitLayout`
- Black line showing the total used rows.
- Red shading for the unusable rows of the circuit.
- Annotations for the number of used and usable rows.
2021-07-27 02:25:07 +01:00
Jack Grigg dac3bf31e4 dev: Add `CircuitCost::marginal_proof_size` API 2021-07-27 02:21:46 +01:00
Daira Hopwood b21ab75625 Use assign_table API in test.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-07-27 01:41:56 +01:00
Daira Hopwood e3e39455be Table refactoring.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-07-27 01:34:51 +01:00
Jack Grigg 334036b942 dev: Add `halo2::dev::CircuitGates` developer tool 2021-07-26 02:53:13 +01:00
Jack Grigg eb2b020d8c Migrate benches and examples to `impl Neg for Expression` 2021-07-26 01:59:06 +01:00
Jack Grigg 7355462a9f Add `Expression::Negated` enum case
We were previously representing this as `Expression::Scaled(poly, -1)`
which was less efficient.
2021-07-26 01:59:06 +01:00
Jack Grigg d6bd7bb393 tests: Migrate `plonk_api` test to use `impl Neg for Expression`
No change to the pinned verification key, because `Neg` is implemented
the same way `plonk_api` was manually performing it.
2021-07-26 01:59:05 +01:00
str4d 2e960317ae
Merge pull request #347 from zcash/selector-optimization
Selector optimization
2021-07-26 01:50:28 +01:00
ebfull 101d7c79f3
Apply suggestions from code review
Co-authored-by: str4d <jack@electriccoin.co>
2021-07-25 18:39:42 -06:00
Sean Bowe 88d34924eb
Account for changes from #350. 2021-07-24 17:17:49 -06:00
Sean Bowe b47889ec51
Merge branch 'main' into selector-optimization 2021-07-24 17:17:03 -06:00
Sean Bowe 77805d9e8e
fix minor typo 2021-07-24 17:10:59 -06:00
Sean Bowe 2a253b89b0
Refactor the selector optimization pass so it can be independently proptested. 2021-07-24 16:35:45 -06:00
Sean Bowe e02fc06f52
cargo fmt 2021-07-24 15:42:30 -06:00
Sean Bowe 634d14a016
Remove spurious code from review suggestion. 2021-07-24 10:43:50 -06:00
ebfull 754dd62c92
Apply suggestions from code review
Co-authored-by: str4d <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-07-24 10:27:50 -06:00
str4d 6d3a11511d
Merge pull request #350 from zcash/fix-simple-floor-planner-constants
Fix SimpleFloorPlanner's handling of global constants
2021-07-23 18:53:49 +01:00
Jack Grigg 92645b6ee9 Fix SimpleFloorPlanner's handling of global constants
The previous behaviour assumed that all regions were always assigned
in increasing start-row order. That assumption is broken in e.g. the
Merkle path tests, which position two Sinsemilla calls in parallel.
The layouter was working fine for current tests, but in an adjacent
PR that changed the Merkle path chip's behaviour, it started to
produce invalid circuits.

The new behaviour emulates the `floor_planner::V1` behaviour in an
(intentionally) inefficient way: constants are positioned immediately
after the regions they are assigned to, in the first constants column.
If that column is also used in regions, those regions will now be
positioned without overlapping any assigned global constants.

Co-authored-by: therealyingtong <yingtong@z.cash>
2021-07-23 16:39:37 +01:00
Sean Bowe 28439414f4
(attempt 1 at implementing daira's algorithm) 2021-07-23 08:14:15 -06:00
Sean Bowe e23d148b72
minor clippy fixes 2021-07-22 12:07:17 -06:00
Sean Bowe e3c6542e83
Fix circuit-layout example. 2021-07-22 12:04:41 -06:00
Sean Bowe 5af7a7abfa
Only accept fixed columns in lookup argument tables. 2021-07-22 10:28:52 -06:00
Sean Bowe 145d096dcd
Distinguish between simple and non-simple selectors, and allow the former in lookup arguments. 2021-07-22 10:07:20 -06:00
Sean Bowe 26982a6050
Update circuit graph tooling to account for selector optimization. 2021-07-22 10:06:48 -06:00
Sean Bowe 1254e4f245
Ensure that selectors are only used in simple ways.
You cannot add an expression containing a Selector to another expression.

You cannot multiply an expression containing a Selector by another expression
that also has a selector.
2021-07-21 14:43:31 -06:00
Sean Bowe f6895555bb
Update cost model logic to account for selector optimizations. 2021-07-21 13:51:48 -06:00
Sean Bowe 2cc60838a5
Use locally generated ConstraintSystem to avoid performing optimizations twice. 2021-07-21 13:34:56 -06:00
Sean Bowe 23d7d6532d
Properly substitute selectors in lookup expressions during optimization pass. 2021-07-21 13:12:05 -06:00
Sean Bowe 382cd5a7ea
Create actual selector columns only during an optimization pass. 2021-07-21 12:55:19 -06:00