Commit Graph

42 Commits

Author SHA1 Message Date
Jack Grigg 4b09ef6ab5 Migrate to `zcash_spec 0.1` 2024-01-10 22:44:19 +00:00
Hazel OHearn 0800d23fe7
Publicize diversifier method of Address, fix comments, etc 2022-09-15 14:40:21 -03:00
Hazel OHearn 22e7ba14a2
Add random_seed getter fn 2022-07-07 11:05:07 -03:00
Hazel OHearn 45bcc16f80
Publicize necessary functionality for reading diversifiers and notes from data 2022-07-05 14:55:44 -03: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 b1ce38405a Use `core` instead of `std` where possible 2022-04-28 20:20:23 +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
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 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
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 369b99ee3f Add `doc_cfg` annotations 2021-12-17 22:08:58 +00:00
Taylor Hornby 63a1c9d08e Correct a couple comments 2021-09-27 20:52:16 -06:00
therealyingtong 07770a0be0 builder.rs: Update ActionInfo::build() to fill in Circuit fields. 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
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
therealyingtong 8f8eff23d8 Update proptests to generate Merkle paths 2021-06-08 22:38:11 +08: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
Jack Grigg c4ffb7c617 Rework PRF^expand to use explicit domains
`prf_expand{_vec}` have been replaced by the `PrfExpand` enum, which
has `PrfExpand::{expand, with_ad, with_ad_slices}` methods for use
within each domain as necessary.
2021-05-28 13:12:25 +01:00
Jack Grigg 5af73f7822 Add test vectors for key components 2021-05-28 11:57:21 +01:00
str4d 97710e04d6
Merge pull request #80 from zcash/spec-updates
Update implementation to match protocol spec version 2021.2.0
2021-05-21 21:24:39 +01:00
Kris Nuttycombe 800e540875 Make the `Bundle` type implement `Clone`
This is required for proptest generation that handles shrinking
correctly in librustzcash.
2021-05-13 15:35:44 -06:00
Jack Grigg 4423b50788 Include ρ as an input to the derivation of ψ, esk, and rcm
This brings the implementation in line with spec version 2021.2.0 and
the Orchard book.
2021-05-11 18:51:57 +08:00
Jack Grigg 736de1156b Ensure that Notes always have valid commitments
Implements the change from spec version 2021.1.23 to sample a new rseed
if a note is generated without a valid commitment.
2021-05-11 18:51:57 +08:00
Kris Nuttycombe 8f3f4a8479 Make note module public. 2021-05-05 14:05:17 -06:00
Kris Nuttycombe 4d89d45332 Add proptest generators for action and bundle types. 2021-04-28 18:04:17 -06:00
Kris Nuttycombe e743198a50 Expose constructors required for ZIP-225 parsing. 2021-04-28 18:02:36 -06:00
Jack Grigg 30f01d122c Bundle builder 2021-04-27 14:31:21 +12:00
Jack Grigg 52d87e257c Return SpendingKey from Note::dummy
We need the spending keys to create valid spendAuth signatures for
Actions containing dummy spent notes.
2021-04-27 12:26:24 +12:00
Jack Grigg f62bbbbb95 Small conversion helpers 2021-04-23 01:08:43 +12:00
Jack Grigg dbfbc66ac7 Add NoteValue::zero as an alias for NoteValue::default 2021-04-23 00:46:39 +12:00
Jack Grigg 77121facb7 Dummy note generation 2021-04-23 00:46:39 +12:00
Jack Grigg b1286b4e94 Fix bundle::Action to hold cmx instead of cm 2021-04-20 10:26:58 +12:00
Jack Grigg c08d12cc52 Use incomplete addition in SinsemillaHashToPoint
This requires exposing the ⊥ case throughout the return types. We
prevent it from propagating into the Orchard note and key types by
ensuring that:

- When we generate keys or notes, if we encounter ⊥ we discard and
  re-generate.
- When we construct keys or notes via any other pathway (e.g. parsing
  from bytes), we check for and reject ⊥.
2021-04-20 10:05:56 +12:00
Jack Grigg 5646ada113 Make nk the first argument to Nullifier::derive
This more closely matches DeriveNullifier in the spec.
2021-03-30 13:52:20 +13:00
Jack Grigg 0f6eb9ca6c Nullifier derivation 2021-03-26 07:51:05 +13:00
Jack Grigg 680c917ce6 Note commitment derivation 2021-03-26 07:51:05 +13:00
Jack Grigg 5bce857569 Fill out note components 2021-02-08 15:21:04 +00:00
Jack Grigg a564ba76ce Remove Chain and value::Constraint traits
There was push-back on having this crate require these traits, due to the
additional complexity within this crate. My rationale for including them
was to make it simpler to reason about what is responsible for enforcing
chain-specific constraints, and to reduce duplication (by enabling the
wrapping chain implementation to use type definitions and leverage all
built-in behaviour, instead of newtypes and needing to add a bunch of
wrapping logic and boilerplate, some of which would encode chain-specific
logic).

We'll try working within the requirement that this crate enforces minimal
base constraints and hard-codes any constants, and then have the wrapping
chain provide encoding prefixes and additional value constraints where
necessary.
2021-01-21 12:23:08 +00:00
Jack Grigg d65968ed38 Skeleton for notes and values 2021-01-20 20:31:09 +00:00