Commit Graph

96 Commits

Author SHA1 Message Date
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 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
Jack Grigg 17ad25ee35 Merge branch 'non-consensus-changes-on-branchid-c4cd541e' into merge-non-consensus-changes 2022-02-15 22:46:47 +00: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
Kris Nuttycombe 8c96640826 Add diversifier index decryption to DiversifierKey. 2022-02-11 14:09:07 -07:00
Jack Grigg c1447d6af2 Fix broken main branch
This was a non-code merge conflict between zcash/halo2#217 and main,
that caused CI to break after the PR merged.
2022-02-08 15:19:56 +00:00
str4d 40491385c6
Merge pull request #217 from zcash/update-halo2-gadgets
Delete gadgets and introduce halo2_gadgets dependency.
2022-02-03 21:23:42 +00:00
therealyingtong 91e22e4f92 Use internal keys test vectors. 2022-02-01 18:55:21 +08:00
therealyingtong 9cf4e10d4f Remove InternalSpendingKey, introduce FullViewingKey::rivk_internal. 2022-02-01 18:55:21 +08:00
therealyingtong 99119f04fa Derive internal full viewing key. 2022-02-01 18:55:21 +08:00
therealyingtong 2412e83400 Derive internal spending key. 2022-02-01 18:55:21 +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 0e1220acc9 Merge branch 'main' into orchard-mainnet-circuit 2021-12-20 15:20:33 +00:00
Jack Grigg 369b99ee3f Add `doc_cfg` annotations 2021-12-17 22:08:58 +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
Jack Grigg 0378898289 Replace `FieldExt::{from, to}_bytes` with `PrimeField::{from, to}_repr` 2021-12-09 15:39:37 +00:00
Jack Grigg 37f1bba998 Remove `PartialEq, PartialOrd` impls from `{Extended}SpendingKey` 2021-11-30 23:25:35 +00:00
Jack Grigg 674ceb54c8 `impl ConstantTimeEq for {Extended}SpendingKey` 2021-11-30 23:24:50 +00:00
Kris Nuttycombe 14c4b40dfc Add construction of DiversifierIndex directly from bytes. 2021-11-24 18:09:25 -07:00
Jack Grigg 235cd791b4 Fix `IncomingViewingKey::to_bytes`
`slice::copy_from_slice` panics if the source and destination slices are
not the same length.

Closes zcash/orchard#228.
2021-11-17 12:12:20 +00:00
Jack Grigg 8c82ceecbf ff 0.11, group 0.11, pasta_curves 0.2 etc. 2021-09-06 20:39:43 +01:00
Kris Nuttycombe e4a54cdf61 Improve error handling in zip32 APIs. 2021-08-31 16:49:58 -06:00
therealyingtong c3e24794f0 zip32.rs: master and child key derivation for ExtendedSpendingKey 2021-08-31 15:49:32 -06:00
Kris Nuttycombe 77be355912 Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: ying tong <yingtong@z.cash>
2021-08-23 11:29:07 -06:00
Kris Nuttycombe 0449edd5b8 Validate the sign of the y-coordinate for ak when deserializing. 2021-08-23 11:29:07 -06:00
Kris Nuttycombe 872f337811 Expose SpendingKey byte representation. 2021-08-23 11:29:07 -06:00
Kris Nuttycombe 5d78ab3508 Add Eq and Ord implementations for Orchard keys. 2021-08-23 11:29:06 -06:00
Kris Nuttycombe 52f0f158ef Add serialization and parsing of full viewing keys. 2021-08-23 11:28:27 -06:00
Kris Nuttycombe 1fd00e6236 Add raw address serialization and parsing. 2021-08-23 11:28:27 -06:00
Kris Nuttycombe e33cd4ade4 Add trial decryption of actions to Bundle 2021-08-23 11:28:25 -06:00
Kris Nuttycombe 77cf4c9831 Implement IncomingViewingKey::to_bytes 2021-08-23 11:27:02 -06:00
Jack Grigg 79988a5317 Move the interpolation logic into `SharedSecret::batch_to_affine`
This makes the method interface clearer, as the same pattern of shared
secrets is returned as was provided.
2021-08-13 14:27:20 +01:00
Jack Grigg c79acc0e08 Fix length of output Vec for `SharedSecret::batch_to_affine`
It was too long, and `group::Curve::batch_normalize` panics if its
inputs are not the same length (which would be the case if a batch
included an output with an invalid `ephemeral_key`).
2021-08-12 13:40:56 +01:00
Jack Grigg 8e13986101 Implement `Domain::batch_epk` for note decryption
Improves throughput of batched trial decryption by around 10%.
2021-08-12 01:36:38 +01:00
Jack Grigg 8c15cc25be Benchmark batch trial decryption 2021-08-12 01:36:38 +01:00
therealyingtong 8cf7a6872c Minor refactors, text fixes, and docfixes.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-07-23 00:15:54 +08:00
therealyingtong 6f4b5b0340 circuit.rs: Constrain derived circuit values to equal public inputs. 2021-07-21 20:35:43 +08:00
therealyingtong d16b83816b Implement needed getters and conversions in other modules. 2021-07-21 20:35:43 +08:00
Daira Hopwood 81fb944997 Make this crate clippy clean for warnings on nightly.
One .clone() removal; all of the other changes are removing needless borrows that are immediately
dereferenced: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2021-06-21 18:04:00 +01:00
Jack Grigg 769be6c080 Note encryption test vectors 2021-06-11 23:55:17 +01:00
Jack Grigg 99665572a2 Orchard note encryption 2021-06-11 23:55:16 +01:00
Jack Grigg 11350339f5 Ensure that derived esk is non-zero
There's a (negligble) chance that we could generate (or be sent
adversarially) a RandomSeed which derives esk == 0. It's not hard to
detect and reject, in order to satisfy the type system.
2021-06-11 23:54:35 +01:00
Jack Grigg 8a7ff1b28a Structs representing note encryption key material 2021-06-11 23:54:35 +01:00
Jack Grigg cbf7c3825f builder: Store alpha and use it to derive rsk for signing spends
This was missed from zcash/orchard#49, but could not have caused a
consensus failure or loss-of-funds because `alpha` _was_ being sampled
and used to derive `rk`, meaning that the signatures would fail to
validate.
2021-06-05 22:35:52 +01:00
str4d dc075e7971
Merge pull request #91 from zcash/key-component-test-vectors
Add test vectors for key components
2021-06-02 22:23:54 +01:00