Commit Graph

37 Commits

Author SHA1 Message Date
Jack Grigg 72a731cba1 Remove `minimum_k` from `Error::NotEnoughRowsAvailable`
Due to this error being detected and returned early, in practice
`minimum_k` would always be `current_k + 1`, and the error would be
returned repeatedly (as more of the circuit could be processed) until
`k` was set large enough. We now simply suggest that the user try a
larger value of `k`.
2021-11-17 08:07:42 +00:00
Jack Grigg eb88a2ebef Replace `Error::BoundsFailure` uses with `Error::NotEnoughRowsAvailable`
The remaining uses of `Error::BoundsFailure` that are exposed to the
user, are for invalid column indices.
2021-11-15 22:50:35 +00:00
Jack Grigg d055acda31 Augment `Error::NotEnoughRowsAvailable` with current and min-required k
This makes the error message more useful, by informing the user of a
possible solution.
2021-11-15 21:44:51 +00:00
Jack Grigg 7da5605f51 Remove redundant Error suffix from Error cases 2021-11-10 16:19:36 +00:00
Jack Grigg a5a3c8ca63 Use `From<u64>` instead of `FieldExt::from_u64` 2021-09-30 22:53:00 +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
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
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
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
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
Sean Bowe e23d148b72
minor clippy fixes 2021-07-22 12:07:17 -06:00
Sean Bowe 5af7a7abfa
Only accept fixed columns in lookup argument tables. 2021-07-22 10:28:52 -06:00
Sean Bowe f6895555bb
Update cost model logic to account for selector optimizations. 2021-07-21 13:51:48 -06:00
Sean Bowe 382cd5a7ea
Create actual selector columns only during an optimization pass. 2021-07-21 12:55:19 -06:00
str4d 4283713ec7
Merge pull request #340 from zcash/339-dev-proof-cost
dev: Add CircuitCost tool with proof size measurement
2021-07-21 16:45:03 +01:00
Jack Grigg 9e2cba917f Update SimpleFloorPlanner with constants support 2021-07-21 09:31:27 +08:00
Jack Grigg 87beee32f4 dev: Add CircuitCost tool with proof size measurement 2021-07-20 03:17:56 +01:00
str4d c0d2aa1286
Merge branch 'main' into coset-optimization 2021-07-19 14:43:37 +01:00
Sean Bowe 1f75dc25ee
Make plonk_api test exercise multiple permutation sets. 2021-07-14 10:24:31 -06:00
Sean Bowe 0dc4447ad8
Change verification API to allow the caller to supply instances as slices of scalars rather than commitments. 2021-07-13 12:08:16 -06:00
Sean Bowe 9155cd174b
Introduce `set_minimum_degree` to avoid performance regression in benchmark. 2021-07-12 15:28:16 -06:00
Sean Bowe a091795aca
Switch to computing only Rotation::cur() cosets until rotation is needed. 2021-07-12 12:53:12 -06:00
Sean Bowe fe215d153d
Update tests with API changes for public inputs and permutation argument. 2021-07-08 15:32:51 -06:00
Sean Bowe 2ef2f7e73c
Change create_proof API to take vectors of scalars and compute polynomials internally. 2021-07-01 13:53:54 -06:00
Jack Grigg e262941b70 clippy: Fix capitalized acronyms in tests and examples 2021-06-23 13:33:04 +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
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
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 353a07cef1 `ConstraintSystem::lookup`: Move lookup queries into a closure
This matches `ConstraintSystem::create_gate`.

At the same time, we bind the input and table expressions together as a
"table map" by requiring the closure to return a vector of tuples. This
ensures they are always the same length.
2021-05-27 00:53:31 +01:00
therealyingtong 502f0c85dc Input as associated type on EncodedChallenge
Use Input as an associated type instead of a type parameter, to
reduce infection

Co-authored-by: Sean Bowe <ewillbefull@gmail.com>
2021-05-07 22:21:54 +08:00
therealyingtong 32f011d52d Replace ChallengeSpace with EncodedChallenge API
Co-authored-by: Sean Bowe <ewillbefull@gmail.com>
2021-05-01 09:30:08 +08:00
therealyingtong cd3cc543cf Update examples and tests 2021-04-23 19:18:41 +08:00
therealyingtong 24d7100bd4 Update commitments in PinnedVerificationKey
The pinned commitments have changed, presumably after the hash_to_field fix in zcash/pasta_curves a1194672c55ee03a1631b6e1af9d86a3bd87ab70.
2021-04-23 17:32:09 +08:00
Sean Bowe 504203654d
Disable clippy::{many_single_char_names,op_ref} lint in integration test. 2021-02-26 10:42:43 -07:00
Sean Bowe cb59a40ff8
Move PLONK integration tests into the tests subdirectory. 2021-02-26 08:22:19 -07:00