Commit Graph

123 Commits

Author SHA1 Message Date
Kris Nuttycombe 1a8ded0038 Add a `Rho` type, to distinguish from revealed note nullifiers.
This change removes the ability to construct a `Rho` value directly from
the public API, except via deserialization from bytes (which is
necessary in order to be able to serialize a `Note`). Ordinarily, `Rho`
should be obtained either from an already-constructed `Note` or from an
`Action` or `CompactAction`.
2024-03-12 17:20:43 -06:00
Jack Grigg 7fa0edbd98 Bump MSRV to 1.65
`reddsa 0.5.1` has MSRV 1.65.
2023-09-08 17:52:14 +00:00
Jack Grigg 3beea4adb7 Migrate to `ff 0.13`
Closes zcash/orchard#371.
2023-03-09 21:14:41 +00:00
Tomas Krnak 5fbbded49e Add `SpendInfo::new` and `Circuit::from_action_context`
Author: Tomas Krnak <tomas@krnak.cz>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-20 18:52:07 +01:00
Jack Grigg 63fc2adc0e Expose `Proof::add_to_batch` in public API
This supports downstream users that want more control over how proof
batches are processed, instead of just batch validating Orchard bundles
with `orchard::bundle::BatchValidator`.
2022-07-04 20:05:47 +00:00
Jack Grigg da7358a48c Fix incorrect namespaces in circuit debug code
Closes zcash/orchard#329.
2022-06-23 22:33:10 +00:00
Jack Grigg 81626b3b28 Add batch-verification of proofs to `orchard::bundle::BatchValidator` 2022-06-23 19:45:42 +00:00
Jack Grigg be69324b9c Migrate to `halo2_proofs 0.2.0` 2022-06-23 19:24:57 +00:00
Jack Grigg 07239e50a8 Add protocol rule links for the Orchard circuit constraints
Part of zcash/zcash#3957.
2022-05-25 22:10:29 +00:00
Jack Grigg 311190c2d6 Migrate to final `halo2_gadgets` pre-release revision
Includes API changes made in zcash/halo2#573.
2022-05-10 21:55:20 +00:00
therealyingtong 2f2bab5627 circuit.rs: Use BaseFitsInScalarInstructions for variable-base mul. 2022-05-06 18:58:18 +00:00
Jack Grigg 0603d602d0 Rename `anchor` to `root`, and `pub_input_anchor` to `anchor`
This ensures that we are consistent in the circuit in referring to the
public bundle anchor as `anchor`, and the calculated Merkle tree root as
`root`.
2022-05-04 23:57:26 +00:00
Jack Grigg 903f9e8160 Adjust APIs of NoteCommit circuit impl to separate gadget and chip
The separation isn't quite complete, as we removed the `GateCells`
abstraction, but it makes the outer APIs clearer.
2022-05-04 03:01:17 +00:00
Jack Grigg c4bf8105f2 Use `AssignedCell<NoteValue, _>` for circuit note values 2022-05-03 23:24:48 +00:00
Jack Grigg 0bad10d3eb Replace `UtilitiesInstructions` usage with a dedicated helper
The new helper enables returning typed `AssignedCell`s, rather than only
`AssignedCell<F, F>`.
2022-05-03 23:24:48 +00:00
Jack Grigg 3e40780313 Adjust APIs of Commit^ivk circuit impl to separate gadget and chip 2022-05-02 12:36:37 +00:00
Jack Grigg a491688944 Circuit cleanups and documentation 2022-04-29 20:24:52 +00:00
Jack Grigg 3b922f8f48 Extract a `ValueCommit^Orchard` gadget from the circuit 2022-04-29 20:05:00 +00:00
Jack Grigg dafb357dc0 Extract a `DeriveNullifier` gadget from the circuit
This introduces an `AddChip` implementing field element addition on a
single row, precisely matching what the nullifier integrity constraints
were relying on.
2022-04-29 20:03:17 +00:00
Jack Grigg 70b6eb3623 Simplify witness synthesis for `v_net`
`NoteValue - NoteValue` is always guaranteed to produce a valid
`ValueSum`, so we make that infallible and introduce a new helper method
`ValueSum::magnitude_sign` that we use for circuit synthesis.
2022-04-29 20:03:17 +00:00
Jack Grigg 714f2e7159 Use `array::map` now that our MSRV supports it 2022-04-29 18:04:01 +00:00
Jack Grigg ae6a50611a Pass `g_d_new` and `pk_d_new` directly to `Circuit`
The initial Action circuit specification indicated that only the byte
encodings of `g_d_new` and `pk_d_new` would be witnessed, but we ended
up witnessing the points directly instead. This commit removes the
leftover (and now redundant) encoding-decoding round trip.
2022-04-29 18:04:01 +00:00
Jack Grigg f08a2a35c4 Rename `ak` to `ak_P` in the circuit implementation
Closes zcash/orchard#260.
2022-04-29 18:04:01 +00:00
Jack Grigg b1ce38405a Use `core` instead of `std` where possible 2022-04-28 20:20:23 +00:00
Jack Grigg 52449ef88f Migrate to `halo2::plonk::Constraints` helper 2022-04-28 19:52:55 +00:00
Jack Grigg 4574d4793a Migrate to 2021 edition 2022-04-28 17:23:30 +00:00
str4d 2c0aed712a
Merge pull request #308 from zcash/improve-debug-impls
Improve `Debug` impls
2022-04-06 18:59:33 +01:00
str4d 7c2cc814de
Merge pull request #288 from rex4539/typos
Fix typos
2022-04-06 18:23:17 +01:00
Jack Grigg 6941fe1109 Make `Debug` impl for `Proof` much less verbose
For the default `{:?}` debug formatting we now only print the length of
the proof, while `{#?}` continues to print the full byte vector.
2022-04-06 17:21:48 +00:00
therealyingtong a0424984c6 Add explicit scoping for viewing keys and addresses
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-30 20:49:37 +08:00
Jack Grigg d6d1dbea14 Update serialized proof test case for circuit changes 2022-03-22 17:59:56 +00:00
Jack Grigg 6c9ff19342 Merge branch 'main' into non-consensus-changes-on-branchid-c4cd541e 2022-03-22 17:55:59 +00:00
Jack Grigg 795fb78d2d Add serialized proof test case
Co-authored-by: Sean Bowe <ewillbefull@gmail.com>
2022-03-16 19:47:00 +00:00
Dimitris Apostolou b96533a2b8
Fix typos 2022-02-18 23:31:27 +02:00
Jack Grigg 17ad25ee35 Merge branch 'non-consensus-changes-on-branchid-c4cd541e' into merge-non-consensus-changes 2022-02-15 22:46:47 +00:00
Daira Hopwood e92d1167af The address used to derive g_d_old and pk_d_old is the recipient address of the note being spent. 2022-02-15 14:39:32 -07:00
Kris Nuttycombe 5d5e289197 Remove default_diversifier and default_address methods. 2022-02-15 14:39:32 -07:00
str4d 4ae32ef98a
Merge pull request #282 from zcash/clone-unauthorized-bundle
Add `Clone` impls to various structs
2022-02-12 03:23:11 +00:00
Jack Grigg c4cd541e6c Add `Clone` impls to various structs
This enables `InProgress<Unproven, Unauthorized>: Clone`, which allows
the bundle returned by `Builder::build` to be cloned. In pure-Rust
wallets this should not be necessary, but it is required for `zcashd`
due to FFI-crossing.
2022-02-12 02:04:52 +00:00
therealyingtong f74cb9e4d3 Delete gadgets and their primitives; add `halo2_gadgets` dependency. 2022-01-29 01:57:01 +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
therealyingtong 85b481af35 sinsemilla::merkle: Remove MERKLE_DEPTH constant. 2022-01-27 08:14:41 +08:00
therealyingtong 191b5df0cb circuit.rs: Tidy up imports. 2022-01-27 08:09:29 +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
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
Jack Grigg 0e1220acc9 Merge branch 'main' into orchard-mainnet-circuit 2021-12-20 15:20:33 +00: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
Jack Grigg bfc65d5985 poseidon: Remove `self` parameter from `Domain` trait methods
For almost all the sponge constructions defined in the Poseidon paper,
the domain can be defined completely statically. Variable-length hashing
requires knowledge of the message length, but that can be provided to
the fixed padding function in a subsequent commit, and in any case we
can't use variable-length inputs in a circuit.
2021-12-10 02:40:33 +00:00