Commit Graph

2478 Commits

Author SHA1 Message Date
Jack Grigg 54f653a569 halo2_gadgets: Rename `dev-graph` feature flag to `test-dev-graph`
This feature flag is not part of the public API, but only for
conditionally rendering sub-circuit graphs. Renaming it stops the
feature from being enabled in the workspace when we only want to enable
the `dev-graph` feature flag of `halo2_proofs`, which _is_ part of its
public API.
2022-09-12 18:07:18 +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
str4d 553584a77f
Merge pull request #644 from zcash/remove-rotated-poly-cache
halo2_proofs: Avoid caching rotated polynomials in `poly::Evaluator`
2022-09-10 12:02:28 +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 66242e0076 halo2_gadgets: Remove dead code
For the dead code we want to retain, we now allow it explicitly, so we
can remove the blanket lint override.
2022-09-09 17:57:37 +00:00
Jack Grigg 73282ba6b8 halo2_gadgets: Be explicit about `*EccPoint` construction without checks
These are all cases inside the ECC chip, where we are inherently
producing valid coordinate pairs as a result of the constraints being
implemented, but it is useful to be explicit about the contract being
asserted at each point we construct `EccPoint` or `NonIdentityEccPoint`.
2022-09-09 17:56:00 +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
Daira Hopwood 1806b88c74
Merge pull request #626 from daira/daira-book-fullwidth
[book] Full-width variable-base scalar mul allowing the scalar to be outside the base field
2022-09-02 16:26:59 +01:00
Daira Hopwood 3abf14e273
Clarify overflow condition 2022-09-02 16:26:12 +01:00
Daira Hopwood c7d645997d Apply suggestions from code review
Co-authored-by: ying tong <yingtong@z.cash>
2022-09-02 16:23:04 +01: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
str4d 8fa116aa85
Merge pull request #642 from zcash/reduce-ast-evaluator-memory-usage
halo2_proofs: Reduce memory usage of `poly::Evaluator`
2022-08-25 00:00:03 +01: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
therealyingtong 6396a0ec19 [book] var-base-scalar-mul: Include general overflow check.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-08-19 17:16:46 -07:00
Daira Hopwood c11d527142 [book] WIP: full-width variable-base scalar mul allowing the scalar to be outside the base field.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-08-19 16:18:26 -07:00
ying tong 5cd5e140f4 [book] var-base-scalar-mul: Add missing closing parantheses 2022-08-18 17:00:07 -07:00
han0110 8ff5b1e3af feat: make `Expression::{Fixed,Advice,Instance}` to wrap their own `Query` struct 2022-07-15 10:33:47 -04:00
Daira Hopwood 5af2bd3bd7 [Book] Rename "polynomial degree bound" to "maximum constraint degree".
This is because "degree bound" is often defined to be exclusive.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-07-07 18:13:14 -04:00
Daira Hopwood 104101d0eb [Book] Make the permutation diagram stand out against dark backgrounds.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-07-07 18:13:14 -04:00
therealyingtong 6038b87a1d halo2_proofs: Introduce RegionLayouter::instance_value method.
This allows us to access instance column values within a region.
Previously, this was done only through assign_advice_from_instance.
2022-07-07 17:18:42 -04:00
therealyingtong 28fbc5b4fe Allow enable_equality on TableColumn 2022-07-06 11:29:25 -04:00
str4d 96d9bde905
Merge pull request #612 from zcash/batch-crate-feature
Place `halo2_proofs::plonk::BatchVerifier` behind a (default enabled) crate feature called `batch`.
2022-06-23 20:16:37 +01: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
ebfull 912003138f
Merge pull request #611 from zcash/release-0.2.0
Release 0.2.0
2022-06-23 12:35:40 -06:00
Jack Grigg 2c06d83ae9 halo2_gadgets 0.2.0 2022-06-23 17:41:52 +00: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
Jack Grigg f0861db20b halo2_gadgets: Silence clippy lints
They are in code generated by macros from the `uint` crate, that we
can't do anything about from here.
2022-06-23 17:37:19 +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
ebfull c1159bda1b
Merge pull request #1 from daira/msm-optimization-daira
Reduce memory overhead of MSM
2022-06-23 10:04:29 -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
str4d 745f5d1598
Merge pull request #607 from zcash/caching
Cache values in `VerifyingKey` that can be computed on construction
2022-06-22 21:53:32 +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
str4d f6efecc596
Merge pull request #603 from zcash/batch-verifier-return-rng
Add `BatchVerifier::finalize_and_return_rng`
2022-06-22 17:43:50 +01:00
Jack Grigg 22ec36979c Add `BatchVerifier::finalize_and_return_rng` 2022-06-21 15:04:08 +00:00
str4d c9fc4c6720
Merge pull request #601 from zcash/book/update-comparison
[book] Add `U` to `BCMS` comparison table
2022-06-21 03:17:58 +01:00