Commit Graph

118 Commits

Author SHA1 Message Date
Las Safin 6b3da1fb4b
Don't use `include_bytes!` for `plonk_api` test
The current working directory for a test always seems to be
the root of the crate, hence `./tests/plonk_api_proof.bin` is
always the correct path.
2022-09-23 11:25:37 +00:00
ebfull 61a1f63fcb
Merge pull request #623 from zcash/table-col-equality
Allow `enable_equality` on `TableColumn`
2022-09-13 08:03:20 -06:00
ebfull 2bdb369393
Merge pull request #654 from zcash/bug-instances-len
`plonk::prover::create_proof`: Check that `circuits` and `instances` have equal lengths
2022-09-13 08:02:26 -06:00
therealyingtong 7ed2a4d529 plonk::prover::create_proof: Return error if circuits and instances have different lengths. 2022-09-13 18:19:45 +08:00
therealyingtong d0bbcda590 plonk::prover: Test proof creation with wrong number of instances.
Currently, create_proof passes even if the number of circuits does
not equal the number of instances.
2022-09-13 18:19:45 +08:00
Jack Grigg ffc8e24fb2 Reduce feature surface of `plotters`
`plotters 0.3.3` updated from `font-kit 0.10.0` to `0.11.0`. This is an
internal dependency and ostensibly wouldn't be a breaking change, except
that `font-kit 0.11.0` added a dependency on `yeslogic-fontconfig-sys`
which has additional system dependency requirements. This had the effect
of breaking compilation in a non-breaking release.

However, `font-kit` is only required for `BitMapBackend`, which is not
part of our public API and is only used by some of the `halo2_gadgets`
tests. So we can avoid affecting our downstream users by disabling the
default-enabled features of `plotters`.
2022-09-12 18:31:04 +00:00
Jack Grigg 7e353115fc halo2_proofs: Remove unused imports 2022-09-12 18:07:18 +00:00
str4d 5d653e5d4e
Merge pull request #649 from zcash/cleanups
Various cleanups
2022-09-12 18:44:45 +01:00
str4d e8cb2e6470
halo2_proofs: Use qualified form of `rustdoc::broken_intra_doc_links`
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-09-12 16:43:00 +01:00
Jack Grigg a2c542f70b halo2_proofs: Remove unused clippy lint overrides 2022-09-09 18:20:24 +00:00
Jack Grigg 301bcb3e2d halo2_proofs: Narrow `clippy::upper_case_acronyms` lint override 2022-09-09 18:20:10 +00:00
Jack Grigg 349908d539 halo2_proofs: Narrow `clippy::too_many_arguments` lint override
This enables the lint to show up on new PRs.
2022-09-09 18:15:10 +00:00
Jack Grigg 3cbfd54f77 halo2_proofs: Fix `clippy::assign_op_pattern` lints
The pattern is preserved in one location inside the inner product
argument, where we instead desire to avoid allocations by collapsing
p_prime into itself. Using `+=` here requires both mutable and immutable
borrows simultaneously, and assigning temporaries to avoid this makes
the implementation less clear.
2022-09-09 18:08:40 +00:00
Jack Grigg e65974eb2d halo2_proofs: Remove lint overrides now that MSRV is above 1.51 2022-09-09 17:45:00 +00:00
Jack Grigg f852be62a8 halo2_proofs: Remove unused imports 2022-09-09 17:43:43 +00:00
Jack Grigg 60696a7cfa halo2_proofs: Proxy all `rayon` usage through `halo2_proofs::multicore`
Part of zcash/halo2#648.
2022-09-09 17:36:05 +00:00
Jack Grigg d24f0fd582 halo2_proofs: Add tests for "rotate-and-chunk" APIs 2022-08-25 01:30:23 +00:00
Jack Grigg 5b7b4dd76b Silence clippy lint 2022-08-25 01:07:38 +00:00
Jack Grigg 1d8737e7ab halo2_proofs: Avoid caching rotated polynomials in `poly::Evaluator`
Previously we used the existing `Polynomial::rotate` and
`EvaluationDomain::rotate_extended` APIs to rotate the polynomials we
query at non-zero rotations, and then stored references to the chunks of
each (rotated and unrotated) polynomial as slices. When we reached an
`AstLeaf`, we would then clone the corresponding polynomial chunk.

We now avoid all of this with combined "rotate-and-chunk" APIs, making
use of the observation that a rotation is simply a renumbering of the
indices of the polynomial coefficients. Given that when we reach an
`AstLeaf` we already needed to allocate, these new APIs have the same
number of allocations during AST evaluation, but enable us to completely
avoid caching any information about the rotations or rotated polynomials
ahead of time.
2022-08-25 00:48:51 +00:00
Jack Grigg df61767e02 halo2_proofs: Reduce memory usage of `poly::Evaluator`
`poly::Evaluator` stores all of the polynomials registered with it in
memory for the duration of its existence. When evaluating an AST, it
additionally caches the rotated polynomials in memory, and then chunks
all of the rotated polynomials for parallel evaluation.

Previously, it stored a polynomial for every unique AST leaf, regardless
of whether that leaf required a rotation or not. This resulted in the
unrotated polynomials being stored twice in memory. However, the chunks
simply refer to slices over cached polynomials, so we can reference the
unrotated polynomials stored in `poly::Evaluator` instead of copies of
them stored in the rotated polynomial `HashMap`. This strictly reduces
memory usage during proving with no effect on correctness.
2022-08-23 18:25:39 +00:00
han0110 8ff5b1e3af feat: make `Expression::{Fixed,Advice,Instance}` to wrap their own `Query` struct 2022-07-15 10:33:47 -04:00
therealyingtong 28fbc5b4fe Allow enable_equality on TableColumn 2022-07-06 11:29:25 -04:00
Sean Bowe deef0e1416
Place `halo2_proofs::plonk::BatchVerifier` behind a (default enabled) crate feature called `batch`. 2022-06-23 12:51:47 -06:00
Jack Grigg 7a22f3c9b6 halo2_proofs 0.2.0 2022-06-23 17:40:23 +00:00
Jack Grigg 5641a64d3c halo2_proofs: Fix clippy lints 2022-06-23 17:38:11 +00:00
str4d dac6cfb5d7
Merge pull request #610 from zcash/rework-batch-verifier
Rework `halo2_proofs::plonk::BatchVerifier`
2022-06-23 18:15:24 +01:00
Jack Grigg dd94fb95a4 Rework `halo2_proofs::plonk::BatchVerifier`
`BatchVerifier` now manages the entire batch verification process.
Individual proofs are verified on a threadpool, and the resulting MSMs
are then batch-checked as before. The addition of parallelism here
couples with zcash/halo2#608 to make parallelism less fine-grained and
reduce the overhead of multi-threading.
2022-06-23 16:52:08 +00:00
ebfull 7087c33658
Merge pull request #608 from ebfull/msm-optimization
MSM optimizations
2022-06-23 10:49:22 -06:00
Daira Hopwood 2ed70a3f08 Reduce memory overhead of MSM by 64 bytes per "other" base, and add tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-06-23 14:15:37 +01:00
Sean Bowe 6b4af24a5f
Deduplicate the extra (scalar, base) pairs in MSMs. 2022-06-22 14:31:00 -06:00
Sean Bowe 6939ac47ab
Remove parallelism from within MSM scalar operations. 2022-06-22 13:41:45 -06:00
Jack Grigg 05f37ee8a6 Cache the constraint system degree in `VerifyingKey`
This means we only compute the degree in a verification context during
construction, instead of twice per proof in the permutation argument.
2022-06-22 19:33:36 +00:00
Jack Grigg 4802936c56 Cache the representative of `VerifyingKey` used in transcripts
This means we only need to `Debug`-format the `PinnedVerificationKey`
once on construction, instead of once per proof.
2022-06-22 19:25:32 +00:00
Jack Grigg 22ec36979c Add `BatchVerifier::finalize_and_return_rng` 2022-06-21 15:04:08 +00:00
str4d 7cb71b4814
Update halo2_proofs/src/circuit/value.rs
Co-authored-by: ying tong <yingtong@z.cash>
2022-06-13 16:41:05 +01:00
Jack Grigg 5752adf0e5 halo2_proofs: `impl {Add, Sub, Mul} for &Value<V>` 2022-06-09 22:44:25 +00:00
Jack Grigg 521d6edd1c halo2_proofs: Make `Value::{known, unknown}` const 2022-06-09 22:40:11 +00:00
Jack Grigg 47f25ad632 halo2_proofs: Replace `Option<V>` with `Value<V>` 2022-06-08 23:03:16 +00:00
Jack Grigg c17d52e5bf halo2_proofs: Add `halo2_proofs::circuit::Value<V>`
This is a more usable and type-safe replacement for `Option<V>` in
circuit synthesis.
2022-06-08 22:29:14 +00:00
Jack Grigg 515f97769f halo2_gadgets: Enable more inversions to be batched during synthesis 2022-06-08 00:50:16 +00:00
Jack Grigg 3bc0c598ef halo2_proofs 0.1.0
Closes zcash/halo2#426.
2022-05-10 22:01:21 +00:00
Jack Grigg 96d4a31d39 halo2_gadgets: Batch inversions in `SinsemillaChip::hash_to_point`
This saves around 3.7% in proving time for a 2-action Orchard bundle on
a Ryzen 9 5950X.
2022-05-08 03:28:34 +00:00
ebfull 6fb622a1fc
Merge pull request #543 from NoCtrlZ/feat/fft-optimization
Optimize Fft
2022-05-05 14:05:13 -06:00
ebfull a1d1371ce3
Merge pull request #563 from parazyd/clone-impls-keys
plonk: Derive Clone for VerifyingKey and ProvingKey.
2022-05-05 13:59:44 -06:00
Taylor Hornby 64e7efb0d4
Merge pull request #542 from zcash/relicense-mit-or-apache-2.0
Relicense Halo 2 crates as MIT OR Apache 2.0
2022-05-05 13:50:45 -06:00
Jack Grigg e04c8bfb4b Migrate to `ff 0.12` 2022-05-04 23:36:18 +00:00
NoCtrlZ 32ed927579 Apply @daira's review suggestion 2022-04-28 09:47:22 +09:00
NoCtrlZ 9a9873a2c5 optimize fft 2022-04-28 09:44:54 +09:00
Jack Grigg f4675997bc Fix some clippy lints 2022-04-27 12:58:16 +00:00
Jack Grigg f830c6f7fb Remove pins for dependencies with MSRV-incompatible point releases 2022-04-27 12:28:19 +00:00