Commit Graph

1109 Commits

Author SHA1 Message Date
therealyingtong 942f0846b6 Only enable halo2_gadgets test-dependencies in dev. 2022-01-29 02:07:55 +08:00
therealyingtong f74cb9e4d3 Delete gadgets and their primitives; add `halo2_gadgets` dependency. 2022-01-29 01:57:01 +08:00
Jack Grigg f300cea2c8 Fix clippy lints
These became stable lints between 1.51 and 1.54.
2022-01-28 23:00:00 +08:00
Jack Grigg 2b333d642c pasta_curves 0.3
The MSRV is now 1.54.0, because reddsa 0.2.0 included a fix to its
nightly CI that inadvertently bumped its MSRV.

The `halo2` crate is now the `halo2_proofs` crate, but we're avoiding
the cross-repo crate rename until after `halo2_gadgets` is extracted.

This also brings in the 20% prover performance improvement from
zcash/halo2#447.
2022-01-28 22:59:59 +08:00
str4d 159ab53da5
Merge pull request #186 from zcash/refactor-gadget-crates
Prepare to extract gadgets into crates
2022-01-27 17:53:18 +00:00
therealyingtong a2868262b3 Minor cleanups and fixes. 2022-01-28 00:45:44 +08:00
therealyingtong 91bc1edf8f constants::sinsemilla: Remove Q_ and S_PERSONALIZATION.
These are part of the sinsemilla gadget and are not Orchard-specific.
They will live in primitives::sinsemilla.
2022-01-27 21:14:15 +08:00
therealyingtong 28f2d7a84b Provide compute_lagrange_coeffs() functionality in ECCChip.
This involves moving helper functions from src/constants to a new
module, ecc::chip::constants.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
2022-01-27 21:14:15 +08:00
therealyingtong 85b481af35 sinsemilla::merkle: Remove MERKLE_DEPTH constant. 2022-01-27 08:14:41 +08:00
therealyingtong 31259d089c ecc::chip::mul_fixed: Reintroduce build_constants() closure for constants. 2022-01-27 08:11:52 +08:00
therealyingtong f0e9daf722 gadget::ecc: Clean up bounds four FixedPointBaseField, FixedPointShort. 2022-01-27 08:10:18 +08:00
therealyingtong 191b5df0cb circuit.rs: Tidy up imports. 2022-01-27 08:09:29 +08:00
therealyingtong a5cfd2cfc6 circuit::gadget: Remove Orchard-specific names from gadget consts.
- L_ORCHARD_BASE -> pallas::Base::NUM_BITS,
- L_ORCHARD_SCALAR -> pallas::Scalar::NUM_BITS,
- L_VALUE -> L_SCALAR_SHORT,
- MERKLE_DEPTH_ORCHARD -> MERKLE_DEPTH.
2022-01-19 00:47:01 +08:00
therealyingtong 1a3cbeb896 Refactor src/constants and primitives::sinsemilla::constants. 2022-01-19 00:46:12 +08:00
therealyingtong d37db53e0b Implement utility functions inside `gadgets` module.
Instead of importing utility functions from the `orchard` crate,
the `gadgets` module now implements its own:

- lebs2ip
- i2lebsp
- decompose_word
2022-01-19 00:45:18 +08:00
therealyingtong 06ad0b6925 ecc: Introduce FixedPoints trait with Full, Base, Short associated types. 2022-01-19 00:43:52 +08:00
therealyingtong 5f8716d66a gadget::sinsemilla: Move Orchard-specific inputs into src/circuit.
The sinsemilla submodules note_commit and commit_ivk are tailored
for input lengths specific to Orchard. They have been moved out of
the gadget folder and into the circuit folder.

This also involves changing the visibility of some getter functions
to be usable outside gadget::sinsemilla.
2022-01-19 00:43:52 +08:00
str4d 3e0449ed35
Merge pull request #271 from zcash/tests-pasta-prep
Migrate tests from `FieldExt::rand` to `Field::random`
2022-01-18 14:48:07 +00:00
Jack Grigg a83a0b3fd0 Migrate tests from `FieldExt::rand` to `Field::random`
These were missed in zcash/orchard#254.
2022-01-18 14:30:55 +00:00
str4d dabf364b86
Merge pull request #268 from zcash/update-mockprover-errors
Update `halo2` revision
2022-01-05 14:15:42 +00:00
therealyingtong 1b4dfe4f81 Update Changelog. 2022-01-05 22:14:08 +08:00
therealyingtong d4d167c216 Use MockProver::FailureLocation in gadget unit tests.
This was introduced in halo2#433.
2022-01-05 21:30:45 +08:00
therealyingtong 5b26c7d67a Pass rng to create_proof API.
As of halo2#444, all APIs now take `R: RngCore` arguments instead of
internally depending on `rand::rngs::OsRng`.
2022-01-05 21:30:45 +08:00
therealyingtong f28edd886c Remove .into() from arguments to enable_equality().
As of halo2#416, this is handled internally by the function.
2022-01-05 21:30:45 +08:00
therealyingtong a5ffc3bb47 Update halo2 revision. 2022-01-05 21:30:45 +08:00
str4d 5742eb5c52
Merge pull request #269 from zcash/pin-dependencies
Pin `pprof = 0.6.1`.
2022-01-05 12:27:32 +00:00
therealyingtong 1c11a424e5 Pin pprof to 0.6.1. 2022-01-05 19:44:52 +08:00
str4d 54cdc051fe
Merge pull request #237 from zcash/orchard-mainnet-circuit
Orchard proposed mainnet circuit
2021-12-20 17:49:57 +00:00
str4d 40cc3cb728
Merge pull request #267 from zcash/crate-cleanups
Crate cleanups
2021-12-20 17:35:53 +00:00
Jack Grigg d11fbd4a56 Remove `ValueSum::from_raw`
There is no reason for crate users to be constructing `ValueSum`
directly. We no longer use it to represent `valueBalanceOrchard`,
instead requiring the user to specify their own type.
2021-12-20 16:08:44 +00:00
Jack Grigg 04af08d343 Fix documentation of `orchard::value` module
Closes zcash/orchard#142.
2021-12-20 16:05:33 +00:00
Jack Grigg d84764f2db Remove outdated doc comment on `MerkleHashOrchard`
Closes zcash/orchard#245.
2021-12-20 15:24:48 +00:00
Jack Grigg 0e1220acc9 Merge branch 'main' into orchard-mainnet-circuit 2021-12-20 15:20:33 +00:00
str4d a061a861b3
Merge pull request #266 from zcash/release-0.1.0-beta.1
Release 0.1.0-beta.1
2021-12-17 22:30:14 +00:00
Jack Grigg f98431175a orchard 0.1.0-beta.1 2021-12-17 22:10:35 +00:00
Jack Grigg 369b99ee3f Add `doc_cfg` annotations 2021-12-17 22:08:58 +00:00
Jack Grigg bb04300059 zcash_note_encryption 0.1 2021-12-17 22:08:23 +00:00
Jack Grigg af236a34ad blake2b_simd 1 2021-12-17 17:06:37 +00:00
Jack Grigg f468e604e3 pprof 0.6 2021-12-17 17:05:23 +00:00
Jack Grigg 4af28cb6d4 incrementalmerkletree 0.2 2021-12-17 16:39:48 +00:00
str4d cad50e7611
Merge pull request #265 from zcash/zcash_note_encryption-api-cleanups
Migrate to latest `zcash_note_encryption` API
2021-12-17 13:43:07 +00:00
Jack Grigg 4b0b32275f Migrate to latest `zcash_note_encryption` API 2021-12-17 05:31:24 +00:00
ebfull 4592c2f275
Merge pull request #262 from zcash/261-ak_P-reject-identity
Reject the identity in `SpendValidatingKey::from_bytes`
2021-12-16 08:19:58 -07:00
str4d b13b9677cf
Merge pull request #254 from zcash/pasta_curves-prep
Remove various usages of `FieldExt` methods
2021-12-16 12:07:50 +00:00
str4d a5de219cee
Merge pull request #258 from zcash/ci-benchmarks
CI: Benchmark tweaks
2021-12-15 23:14:33 +00:00
Jack Grigg ab930e8866 sinsemilla: Simplify assertions in `MessagePiece::from_bitstring`
Also fixes some incorrect code comments.

Closes zcash/orchard#263.
2021-12-15 22:15:00 +00:00
Jack Grigg 1be54d9f0d Use `<= PrimeField::CAPACITY` instead of `< PrimeField::NUM_BITS` 2021-12-15 15:42:05 +00:00
Jack Grigg 5dd7de3cc7 Remove all uses of `PrimeField::Repr` in generic code
`PrimeField::from_repr` explicitly leaves the endianness opaque. We
therefore can't use it in places we were using `FieldExt::from_bytes`
(which was specifically little-endian) generically, but the previous
commit replaced it everywhere. We now handle generic contexts on a
case-by-case basis:

- Where we needed to convert bitstrings into field elements, we now use
  double-and-add on the field elements directly instead of on bytes.
  This is less efficient, but visible correct (and a future change to
  the `ff` crate APIs could enable the more efficient version).

- `INV_TWO_POW_K`, which is pre-computed for `pallas::Base`, was being
  incorrectly used in a field-generic circuit. We now compute it live.

- `test_zs_and_us` was only used in tests, and hard-coded a field
  element encoding length of 32 bytes. It now uses Pallas concretely.
2021-12-15 15:28:32 +00:00
Jack Grigg 044844c0a0 Reject the identity in `SpendValidatingKey::from_bytes`
`ak_P` is not allowed to be the identity in the Orchard protocol. We
were enforcing this by construction in most places, except for the
parsing of an Orchard full viewing key.

Closes zcash/orchard#261.
2021-12-15 13:48:59 +00:00
str4d 8a4f4e347b
Merge pull request #259 from zcash/222-rewrite-poseidon
Rewrite Poseidon implementation
2021-12-15 13:28:26 +00:00