Commit Graph

20 Commits

Author SHA1 Message Date
Jack Grigg 1dca72a1cc Migrate to latest `halo2` test API 2021-07-19 12:58:05 +01:00
Jack Grigg 15f9d254d9 Migrate to latest `halo2` API
- `halo2::plonk::{create_proof, verify_proof}` now take instance columns
  as slices of values.
- `halo2::plonk::Permutation` has been replaced by a global permutation,
  to which columns can be added with `ConstraintSystem::enable_equality`.
- The introduction of blinding rows means that various tests now require
  larger circuit parameters.
2021-07-19 12:53:38 +01:00
therealyingtong ee062bae3d gadget::utilities: Add decompose_running_sum helper.
This decomposes a field element into K-bit windows using a
running sum. Each step of the running sum is range-constrained.
In strict mode, the final output of the running sum is constrained
to be zero.

This helper asserts K <= 3.
2021-07-15 20:46:21 +08:00
Jack Grigg d47a7d2105 Migrate to latest halo2 Circuit APIs
- The `Circuit` trait now has a `FloorPlanner` associated type.
- `circuit_layout` has been replaced by `CircuitLayout`.
2021-07-15 11:22:25 +01:00
therealyingtong 425ee6e038 Docfixes and minor refactors.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-07-15 12:27:12 +08:00
therealyingtong 0ade539441 utilities::tests::test_range_check(): Test range_check() helper.
Verify that this constraint fails when the witnessed value is out
of range.
2021-07-09 23:17:42 +08:00
therealyingtong 6c41c72e66 utilities::range_check: Correct range_check expression
Previously, we were multiplying the expression by 0, which led it
to always evaluate to true.
2021-07-09 22:03:26 +08:00
therealyingtong ae4e54dce8 gadget::utilities: Add test cases for bitrange_subset() helper. 2021-07-08 16:29:07 +08:00
therealyingtong 22ec16f129 Minor refactors, cleanups, clippy fixes, docfixes.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-07-08 13:31:56 +08:00
therealyingtong 23f2ed5abe gadget::utilities.rs: Add bitrange_subset() helper. 2021-07-07 23:12:31 +08:00
str4d cbded2b821
Optimize transpose_option_array 2021-06-29 22:43:50 +01:00
therealyingtong d68eb6583d Docfixes, variable renames, cleanups
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-29 12:08:31 +08:00
therealyingtong c43c91b796 gadget::utilities: Adjustments to utilities gadgets and helpers. 2021-06-25 15:05:39 +08:00
therealyingtong cdab5bf8c4 gadget::utilities.rs: Remove Chip bound on UtilitiesInstructions. 2021-06-13 09:40:20 +08:00
therealyingtong e83880841a utilities::lookup_range_check: Add LookupRangeCheck chip
This decomposes a field element into K-bit words and constrains each
word's range by looking it up in a K-bit lookup table.

The field element is broken down using a running sum. All interstitial
values of the running sum are returned.
2021-06-12 22:46:31 +08:00
therealyingtong 54c8cfd1d0 Documentation improvements and minor refactors.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-06-08 00:28:32 +08:00
therealyingtong fea88c814c Add enable flag chip 2021-06-04 18:08:59 +08:00
therealyingtong 4b0ea0be15 Add conditional swap chip 2021-06-04 18:08:59 +08:00
therealyingtong 4f87815262 Add standard PLONK chip 2021-06-04 18:08:59 +08:00
therealyingtong 4d8ae89aa9 Add Utilities chip 2021-06-04 18:08:59 +08:00