Commit Graph

1103 Commits

Author SHA1 Message Date
Jack Grigg 927463f76a Add `Assigned::is_zero_vartime` method 2022-01-21 13:57:24 +00:00
Jack Grigg 9d0e0b7be9 Add `AssignedCell<Assigned<F>, F>::evaluate()` method
We don't want to provide a generic `map` function, since that would
enable users to arbitrarily alter the value connected to a given cell.
If a new value is being produced, that should either happen outside of
the context of a cell (e.g. intermediate values from witness generation)
or in the context of a newly-assigned cell.

However, in the case of the `Assigned<F>` type, we do need the ability
to evaluate the deferred inversion in some cases (e.g. to then operate
on the bits of the value). So for this `AssignedCell` specialization, we
provide a pass-through `evaluate()` method that otherwise preserves the
cell-value connection.
2022-01-21 13:57:24 +00:00
Jack Grigg 93ee7143fe `impl From<&Assigned<F>> for Assigned<F>`
In zcash/halo2#383 we altered the bounds on region assignment methods
like `Region::assign_advice` to constrain the value closure's result on
`for<'vr> Assigned<F>: From<&'vr VR>` instead of `VR: Into<Assigned<F>>`.
This had the unintended side-effect that `Assigned<F>` could no longer
be returned from the closure, because we were previously relying on the
implicit `impl From<T> for T` provided by Rust, which no longer fits the
bound. This commit adds the missing from-reference impl to restore
functionality, re-enabling inversion deferrment.
2022-01-21 13:57:24 +00:00
str4d d111807798
Merge pull request #465 from zcash/462-workspace
Refactor into workspace with `halo2` and `halo2_proofs`
2022-01-20 20:26:38 +00:00
Jack Grigg f79ec5cadd Recreate `halo2` as an empty library crate
This is now where the recursion logic will live.

Closes zcash/halo2#462.
2022-01-20 18:50:43 +00:00
Jack Grigg 3c6558f049 Move `halo2` code into `halo2_proofs` crate 2022-01-20 18:50:43 +00:00
str4d 36db257e82
Merge pull request #464 from L-as/main
Fix compilation with rustc 1.57.0
2022-01-20 18:24:53 +00:00
str4d 2dccf7f23b
Merge pull request #463 from zcash/ci-wasm
Fix WASM builder in CI
2022-01-20 17:59:57 +00:00
Jack Grigg 9e63eeff1b Enable `getrandom/js` feature flag for wasm32-unknown-unknown
Our dev-dependencies include getrandom, and the wasm32-unknown-unknown
target requires this getrandom feature flag in order to compile.
2022-01-20 17:42:15 +00:00
Jack Grigg 66a6537613 Pin bumpalo to `>=3,<3.9.0` for wasm32 targets
`bumpalo 3.9.0` raised its MSRV to 1.54; our current MSRV is 1.51.
2022-01-20 17:42:15 +00:00
Jack Grigg f5a8c9dff9 Depend on `rand_core` instead of `rand`
All non-test code no longer depends on `OsRng`, instead requiring the
caller to provide it.
2022-01-20 16:27:35 +00:00
Las Safin 1613445cdb
Fix compilation with rustc 1.57.0
The type inference algorithm seems to have been simplified,
meaning that the combination of T::from(x.into()) doesn't work anymore.

In any case, the code was also incomprehensible to a human, as it's not clear
by which "route" it does the transformation. It took me a few minutes to
figure out it's a `u64`.
2022-01-20 16:24:33 +00:00
str4d eb74bf6ccb
Merge pull request #447 from zcash/poly-ast-evaluator
Add `poly::Evaluator` for building polynomial operation ASTs
2022-01-20 01:42:57 +00:00
Jack Grigg 2102824599 Remove unused `Polynomial` operations with internal parallelism
These have been replaced by operations on either `poly::Ast` nodes, or
operations directly on chunks of polynomials within a higher-level
parallelism context.

Addition and scalar multiplication are (currently) still used in various
areas of the prover, so those are left in place.
2022-01-20 01:35:24 +00:00
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
Kobi Gurkan 617416b6f0 fix(ci): wasm CI now uses the correct targets 2022-01-08 17:10:01 +02:00
str4d 6630a143c1
Merge pull request #450 from zcash/update-deps
Migrate to pasta_curves 0.3 and blake2b_simd 1
2022-01-05 08:03:53 +00:00
Jack Grigg deabd62eee Migrate to pasta_curves 0.3 and blake2b_simd 1 2022-01-05 02:45:51 +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
str4d d57c530d99
Merge pull request #444 from zcash/more-pasta-prep
More preparations for `pasta_curves 0.3`
2022-01-03 13:26:51 +00:00
str4d 408b617376
Merge pull request #397 from rex4539/typos
Fix typos
2021-12-31 14:14:34 +00:00
Daira Hopwood 5614b076b9
Merge pull request #446 from HAOYUatHZ/patch-1
fix typos
2021-12-29 19:54:38 +00:00
HAOYUatHZ 5a65c7b77b
fix typos 2021-12-29 15:00:32 +08:00
ying tong 3cd7a141cc
Merge pull request #442 from zcash/therealyingtong-patch-1
[book] Fix SHA256 interpolation polynomial
2021-12-29 09:22:37 +08: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 9297a938ab Remove `FieldExt::from_u64` usage from SHA-256 example 2021-12-25 13:34:36 +00:00
ying tong 2ab6e1b0d6
[book] Fix SHA256 interpolation polynomial
Closes #434
2021-12-23 22:07:09 +08:00
str4d af8e0d619a
Merge pull request #432 from zcash/381-rename-verifyfailure-cell
Rename `VerifyFailure::Cell` to `VerifyFailure::CellNotAssigned`
2021-12-21 15:33:08 +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
str4d 3f53d9f6bd
Merge pull request #431 from zcash/mockprover-improve-lookup-error
Improve `dev::VerifyFailure::Lookup` information
2021-12-20 22:39:33 +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
str4d c19423766b
Merge pull request #415 from ChihChengLiang/hint-on-meta-enable-equality
improve error message on ColumnNotInPermutation
2021-12-15 16:52:22 +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