Jack Grigg
b3b783e0f4
Switch `poly::Ast` from `Box` to `Arc`
...
This saves a bunch of `Clone`s and `Drop`s, which were consuming
significant amounts of time in large circuits (Orchard), which meant we
didn't save as much time as we could :)
2022-01-19 21:00:18 +00:00
Jack Grigg
556bb66a47
Parallelize `poly::Evaluator`
...
We now traverse `poly::Ast` `num_chunks + 1` times: once to collect the
polynomial rotations we need, and then once per chunk.
2022-01-17 14:01:44 +00:00
Jack Grigg
3c757dc593
Migrate `vanishing::Argument` to `poly::Evaluator`
2022-01-17 14:01:44 +00:00
Jack Grigg
b7ea224389
Migrate `lookup::Argument::commit_permuted` to `poly::Evaluator`
2022-01-17 13:51:34 +00:00
Jack Grigg
77af83697c
Add `poly::Evaluator` for building polynomial operation ASTs
...
Co-authored-by: Sean Bowe <sean@electriccoin.co>
2022-01-17 13:51:27 +00:00
str4d
f9b3ff2aef
Merge pull request #433 from zcash/mockprover-failure-locations
...
dev: Enable `VerifyFailure::ConstraintNotSatisfied` to point to region offsets
2022-01-04 14:06:28 +00:00
str4d
f565883db0
Merge pull request #448 from zcash/dev-fill-from-row
...
[dev] Implement `Assignment::fill_from_row()` for `MockProver`.
2022-01-04 13:12:55 +00:00
therealyingtong
fe75ceee28
dev::bad_lookup test: Fix lookup expression.
2022-01-04 14:23:08 +08:00
therealyingtong
7f526f01e6
dev: Implement fill_from_row() for MockProver.
2022-01-04 14:23:08 +08:00
therealyingtong
3d22943ebe
dev::bad_lookup test: Do not assign zero in lookup table.
...
We now expect the lookup to fail when q = 0, but it still passes,
revealing a bug in the MockProver.
2022-01-04 14:23:08 +08:00
str4d
d062072366
Merge pull request #424 from zcash/fix-assigned
...
Fix `Assigned<F>` implementation
2022-01-03 22:09:51 +00:00
str4d
6ffe61fd81
Add some extra `Assigned<F>` test cases
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-01-03 17:00:47 +00:00
str4d
b5adc3843d
Fix comments in `Assigned<F>` tests
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-01-03 16:50:29 +00:00
Jack Grigg
1556489a9f
Remove usage of `FieldExt::rand`
...
All APIs now take `R: RngCore` arguments instead of internally depending
on `rand::rngs::OsRng`.
2021-12-25 13:41:39 +00:00
Jack Grigg
558e03aa93
dev: Enable `VerifyFailure::ConstraintNotSatisfied` to point to region offsets
2021-12-21 03:00:16 +00:00
Jack Grigg
5520d13480
dev: Move reusable logic onto `FailureLocation`
2021-12-21 02:56:39 +00:00
Jack Grigg
54125fbc8c
dev: Rename `LookupFailure` to `FailureLocation`
2021-12-21 02:56:39 +00:00
Jack Grigg
28489d03ad
Rename `VerifyFailure::Cell` to `VerifyFailure::CellNotAssigned`
...
Closes zcash/halo2#381 .
2021-12-20 14:45:56 +00:00
Jack Grigg
cbe4d05002
dev: Match lookup failures to regions
...
This currently matches the first region on the row that matches any
input column, which will result in some mismatches. To fix this, we will
need to track the columns of complex selectors.
2021-12-20 13:16:55 +00:00
Jack Grigg
3843c11e82
dev: Enable `VerifyFailure::Lookup` to point to region offsets
2021-12-20 13:16:55 +00: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
bb7b132530
Fix addition of `Assigned::Rational`
...
If the rational would evaluate to zero, we need to ignore it instead of
using its denominator in normal rational addition equations. This fixes
the tests we added in the last two commits.
2021-12-10 23:41:17 +00:00
Jack Grigg
8be0c6fa08
Add commutativity proptest for `Assigned<F>`
...
This tests that deferring inversions gives the same result as eagerly
evaluating them. Currently, it does not :)
2021-12-10 18:31:31 +00:00
Jack Grigg
c4cc5dd516
Add operator tests on `Assigned` for cases including `1/0`
...
The tests for addition and subtraction expose a bug in the addition
implementation, which does not correctly handle the `1/0 -> 0` map that
`inv0` is defined to perform.
2021-12-09 15:16:52 +00:00
Jack Grigg
0353e4c402
Move `Assigned<F>` into a separate module
...
This doesn't alter the public crate API; it's just to make it easier to
manage the struct implementation.
2021-12-09 14:52:23 +00:00
ChihChengLiang
08288845fe
improve error messgae on ColumnNotInPermutation
2021-12-03 23:38:57 +08: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
30045d7488
multiopen: Remove unused structs
...
These were unified as `poly::multiopen::CommitmentData` in
55ef4ea1f7
but the original types were
not removed.
2021-12-02 15:31:36 +00:00
Jack Grigg
8bd9097e55
Remove `impl Default for Rotation`
...
Clippy complained that it could be derived, but what we actually want is
for developers to be explicit about what rotations they are using, for
which `Rotation::cur()` is provided.
2021-12-02 15:19:24 +00:00
Jack Grigg
061098170e
Remove unnecessary mutable references
...
The compiler immediately dereferences these.
2021-12-02 15:19:24 +00:00
Jack Grigg
7772c87be3
Remove unused fields
2021-12-02 15:19:24 +00:00
Jack Grigg
9ab7fdab33
Allow dead code for `Pinned*` structs
...
These structs only exist for their Debug impls, which do use the fields.
2021-12-02 15:19:24 +00:00
ebfull
60e9ac32fa
Merge pull request #408 from zcash/multi-proptest
...
multiopen: Replace test_coherence with proptest.
2021-12-01 09:31:41 -07:00
str4d
afd7bc5469
Merge pull request #383 from zcash/allocated-cell
...
circuit.rs: Introduce `AssignedCell` struct.
2021-11-30 23:42:34 +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
36183bd01a
Return AssignedCell from circuit::Region::assign_* APIs.
2021-11-27 10:07:39 -05:00
therealyingtong
4aabf7c1ca
circuit.rs: Introduce AssignedCell struct.
2021-11-27 08:49:12 -05:00
str4d
8bfc58b7c7
Merge pull request #385 from zcash/perm-not-enabled
...
Introduce plonk::Error::ColumnNotInPermutation error.
2021-11-23 22:23:00 +00:00
therealyingtong
90e5715bf7
multiopen: Replace test_coherence with proptest.
2021-11-23 09:45:00 -05:00
str4d
069aa1dd17
Merge pull request #376 from zcash/364-mockprover-constraint-values
...
dev: Collect values of queried cells for unsatisfied constraints
2021-11-18 19:23:42 +00:00
therealyingtong
ee595bfabb
Introduce plonk::Error::ColumnNotInPermutation error.
...
This is raised when a copy constraint involves a column that has
not been included in the permutation.
2021-11-17 15:46:34 +01:00
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
64680a1a2d
dev: Handle too-small `k` error in `CircuitLayout::render`
...
In most places within `CircuitLayout`, we are flexible on `k`. However,
for tracking selectors we need to know the number of rows. We could
change this, but given that we also want the number of rows to be
accurate for rendering unusable rows, we can instead use this as an
opportunity to inform the user that they will need to bump `k`.
2021-11-16 14:20:57 +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
99fac53618
Fix broken doc link
2021-11-10 16:19:36 +00:00
Jack Grigg
d66b5c42a0
`impl std::error::Error for Error`
2021-11-10 16:19:36 +00:00
Jack Grigg
7da5605f51
Remove redundant Error suffix from Error cases
2021-11-10 16:19:36 +00:00
Jack Grigg
209e398cae
Store `io::Error` inside `Error::TranscriptError`
...
We `impl From<io::Error> for Error` to return `Error::TranscriptError`
because the transcript is the only source of `io::Error`.
`Error` no longer implements `PartialEq` because `io::Error` does not.
Tests can check for specific error cases with `assert!(matches!(..))`.
2021-11-10 14:49:35 +00:00