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
200c366ea4
Rename `Bundle::{try_}authorize` to `Bundle::{try_}map_authorization`
...
Closes zcash/orchard#71 .
2022-04-29 00:16:16 +00:00
Jack Grigg
5c5c999439
Move `orchard::bundle::Action` to its own module
...
The `Bundle` struct is variable in size and requires allocations, but
`Action` is not. This split will make it cleaner to disable the bundle
logic for no-std support.
2022-04-28 22:59:07 +00:00
Jack Grigg
4ec036c851
Remove unnecessary usage of `Vec`
2022-04-28 21:26:23 +00:00
Jack Grigg
30f9452743
Replace unnecessary usage of `std::io`
2022-04-28 20:45:05 +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
Daira Hopwood
3b52b2abec
Minor cleanup found while performing review for zcash/zcash#5024
...
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-04-14 08:29:00 -06:00
Jack Grigg
06995064d7
incrementalmerkletree 0.3.0-beta.2
2022-04-06 18:19:39 +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
01d70ec875
Hide `NonEmpty` in `Debug` impl of `Bundle`
...
It is an implementation detail that isn't useful to include in the debug
output.
2022-04-06 17:22:18 +00:00
Jack Grigg
caca664b20
Make `Debug` impl for `TransmittedNoteCiphertext` less verbose
...
We now print the ciphertexts as hex bytes, for which we unambiguously
encode them in RPC outputs (vs 32-byte values which are more complex).
2022-04-06 17:22:17 +00: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
eaa0cfdbf6
Check that the internal IVK can be derived from a spending key
...
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-30 20:49:38 +08:00
therealyingtong
e550c3d536
Check IVK derivations during FullViewingKey::from_bytes.
...
Closes zcash/orchard#303
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-30 20:49:38 +08: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
56a946dafc
halo2_proofs 0.1.0-beta.3
...
The change to the pinned circuit description is due to removing the
unnecessary `selector_map` pin in zcash/halo2#521 . This invalidates
previous proofs due to changing Fiat-Shamir transcript initialization).
2022-03-22 21:29:36 +00: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
72b6febf7b
Move zero-handling from inside CommitIVK to outside it
...
This more closely matches the change to the protocol spec.
2022-03-17 18:51:33 +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
Jack Grigg
5356804bfe
Update comment in `spec::commit_ivk`
2022-03-15 23:26:57 +00:00
therealyingtong
72f1ca6b45
spec.rs: Check that commit_ivk returns a nonzero base.
2022-03-16 01:28:13 +08:00
Kris Nuttycombe
40efd57757
Apply suggestions from code review
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-15 07:47:21 -06:00
Kris Nuttycombe
45a6a30b21
Add convenience methods on `Bundle` to decrypt actions with OVKs.
...
This renames `decrypt_outputs_for_keys` to `decrypt_outputs_with_keys`
for consistency with `decrypt_output_with_key` and tne newly added
`recover_output*_with_ovk*` methods.
2022-03-14 19:28:47 -06:00
Jack Grigg
eb7a9668aa
Merge branch 'non-consensus-changes-on-branchid-c4cd541e' into merge-non-consensus-changes-2
2022-02-28 20:46:55 +00:00
Jack Grigg
def4d4d9ae
Add missing `Debug` trait bounds for `Builder` components
...
All relevant types have `Debug` impls, but some of the trait and method
impls were lacking `Debug` bounds on their generic types. This prevented
`Debug` impls being used on the overall partially-constructed `Bundle`
types.
2022-02-28 20:09:30 +00:00
Kris Nuttycombe
273662c00b
Apply suggestions from code review
...
Co-authored-by: str4d <thestr4d@gmail.com>
2022-02-24 09:16:39 -07:00
Kris Nuttycombe
1cf828fe7b
Update the incremental merkle tree version and the Rust toolchain.
...
Use derived equality and ordering (which delegate to constant-time
versions) for note::nullifier::Nullifier and tree::MerkleHashOrchard
so that these types can be used as map keys in wallets.
2022-02-23 20:43:02 -07:00
Jack Grigg
65f3e6ec32
Add `FullViewingKey::derive_internal`
...
This is identical to the changes introduced in zcash/orchard#270 , except
that the output is non-optional (since the derivation is non-fallible).
2022-02-21 14:41:47 +00:00
Dimitris Apostolou
b96533a2b8
Fix typos
2022-02-18 23:31:27 +02:00
Jack Grigg
28c22718c0
Remove `hash_bundle_txid_data, hash_bundle_auth_data` from API
2022-02-15 23:03:02 +00:00
Jack Grigg
b1d7787ab6
Re-introduce `ValueSum::from_raw` as a `pub(crate)` method
...
We removed this in zcash/orchard#267 as it did not need to be part of
the public API, but we do still need a way to convert the user-defined
valueBalance type into a `ValueSum` when constructing `bvk`, and this
method is preferable to exposing the `ValueSum` internals.
2022-02-15 22:47:05 +00: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
Jack Grigg
62da82bd38
Add functional test for creating and verifying a shielded bundle
...
The text exposed some limitations of the current crate API, which have
been fixed.
2022-02-15 22:17:15 +00:00
Jack Grigg
0b6bd07904
Add functional test for creating and verifying a shielding bundle
...
The text exposed some limitations of the current crate API, which have
been fixed.
2022-02-15 22:17:15 +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
Kris Nuttycombe
4c7ab377fb
Make the DiversifierKey type crate-private
2022-02-14 17:04:38 -07:00
Kris Nuttycombe
ae3cc78a56
Add decryption of the diversifier index for an address to the IVK.
...
Also correct a spelling error.
2022-02-14 17:04:38 -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
Kris Nuttycombe
b7f66b48e6
Merge pull request #280 from nuttycom/decrypt_diversifier
...
Add diversifier index decryption to DiversifierKey
2022-02-11 14:51:54 -07:00