Commit Graph

101 Commits

Author SHA1 Message Date
HAOYUatHZ 5a65c7b77b
fix typos 2021-12-29 15:00:32 +08:00
Carlos Pérez 8cedfe89de
Change to `Into<Column<Any>>` for pub API methods (#416)
Resolves: zcash/halo2#345
2021-12-15 17:05:31 +00:00
Jack Grigg a62f9451d1 sha256: Fix `AssignedCell` `From` impls for `AssignedBits` and `Bits`
zcash/halo2#337 had been updated to account for `AssignedCell`, before
the change to simplify its bounds was made. `AssignedCell` now requires
the `From` impls to take `&VR`.
2021-12-03 02:53:14 +00:00
str4d 2a7985014b
Merge pull request #337 from zcash/fix-sha256
Update sha256 example to work with new API
2021-12-03 02:41:53 +00:00
Jack Grigg 7772c87be3 Remove unused fields 2021-12-02 15:19:24 +00:00
str4d 4b8f0f0c6b Update code comments in examples
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-11-30 22:35:38 +00:00
therealyingtong 839f9ecd66 Simplify bounds on AssignedCell's V type.
We only need V: Clone and for<'v> Assigned<F>: From<&'v V> for
specific methods.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-11-30 11:17:58 -05:00
therealyingtong 620b4a8b9c sha256: Update to use new AssignedCell API. 2021-11-28 13:42:10 -05:00
therealyingtong b805f85f9f sha256: Update Error::SynthesisError -> Error::Synthesis 2021-11-27 10:22:52 -05:00
therealyingtong be1c0c080f Introduce AssignedBits<LEN> type. 2021-11-27 10:22:52 -05:00
therealyingtong b9230861f7 Introduce RoundIdx enum instead of using i32.
This is a more secure way to distinguish the initial round from
the main rounds.
2021-11-27 10:22:52 -05:00
therealyingtong 78e6e9f695 Use AssignedCell for CellValue{16,32}. 2021-11-27 10:22:52 -05:00
therealyingtong 0443740895 sha256: Replace fixed columns with selectors. 2021-11-27 10:22:52 -05:00
therealyingtong e1c132d664 sha256: Use assign_table() API for lookup table. 2021-11-27 10:22:52 -05:00
therealyingtong ee5bc8184a Remove unwrap()s in synthesis. 2021-11-27 10:22:52 -05:00
therealyingtong 66268cf192 Update sha256 example to work with new API 2021-11-27 10:22:52 -05:00
therealyingtong 61c431edc7 Update examples to use AssignedCell. 2021-11-27 10:08:01 -05:00
Jack Grigg 7da5605f51 Remove redundant Error suffix from Error cases 2021-11-10 16:19:36 +00:00
Jack Grigg c9d890377c book: Render example for `CircuitLayout` 2021-10-01 13:39:04 +01:00
Jack Grigg 7463a6e931 examples: Reorganise circuit-layout example to use in book 2021-10-01 13:39:04 +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 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 eb2b020d8c Migrate benches and examples to `impl Neg for Expression` 2021-07-26 01:59:06 +01:00
Sean Bowe e02fc06f52
cargo fmt 2021-07-24 15:42:30 -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
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 26982a6050
Update circuit graph tooling to account for selector optimization. 2021-07-22 10:06:48 -06:00
Jack Grigg 4c5a830e5c Use constants API in simple-example 2021-07-21 09:31:27 +08:00
Sean Bowe ef01b9310a
Fix examples broken by verifier API changes. 2021-07-14 09:47:53 -06:00
Sean Bowe 3942d4e2e8
(examples) Specify row when calling expose_public in simple-example. 2021-07-10 08:13:24 -06:00
Sean Bowe 0766983686
Fix examples to account for public input API changes. 2021-07-08 15:32:56 -06:00
Sean Bowe fe215d153d
Update tests with API changes for public inputs and permutation argument. 2021-07-08 15:32:51 -06:00
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
Jack Grigg e262941b70 clippy: Fix capitalized acronyms in tests and examples 2021-06-23 13:33:04 +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
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 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
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 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 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 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
str4d d62afb19ac
Merge pull request #256 from zcash/fix-sha256-chip-config
Fix `sha256` example for new config abstraction
2021-05-26 23:01:19 +01:00
Jack Grigg 80993da1e6 cargo fmt 2021-05-26 22:52:03 +01:00
str4d da465bb718
examples: Remove some unnecessary clones 2021-05-26 22:49:18 +01:00
ebfull 870a2f1e8a
Merge pull request #242 from zcash/challenge-space
Add support for full-field challenge space
2021-05-24 11:11:30 -06:00