Commit Graph

144 Commits

Author SHA1 Message Date
Jack Grigg 76a39d29c1 Change diversify_hash and ka_orchard to use non-zero types
This matches the changes to KA^Orchard in spec version 2021.1.23.
2021-05-11 18:51:57 +08:00
Jack Grigg 9a828febd7 Change `commit_ivk` to return a non-zero Pallas base field element
The type system now enforces that `ivk != 0`.
2021-05-11 18:51:57 +08:00
Kris Nuttycombe c9f1060bb9 Minor correction to type signature (naming) 2021-05-05 17:44:15 -06:00
Kris Nuttycombe bf4532fd7d Properly condition generators on flags. 2021-05-05 17:36:05 -06:00
Kris Nuttycombe 71736433d0 Rename arb_nonnegative_note_value -> arb_note_value_bounded 2021-05-05 17:23:21 -06:00
Kris Nuttycombe 3170096134 Publicly expose `MAX_NOTE_VALUE` 2021-05-05 17:19:42 -06:00
Kris Nuttycombe 6373d3d422 Fix incorrect generation for bsk/bvk consistency test. 2021-05-05 17:12:31 -06:00
Kris Nuttycombe 8f3f4a8479 Make note module public. 2021-05-05 14:05:17 -06:00
Kris Nuttycombe 6c681d0539 Generate uniformly distributed nullifiers. 2021-05-05 13:39:41 -06:00
Kris Nuttycombe aa11eb1372 Derive the full range of ValueCommitment values.
Co-authored-by: str4d <jack@electriccoin.co>
2021-05-05 12:02:50 -06:00
Kris Nuttycombe e72d74ccd6 Remove extraneous pub exports from the root. 2021-05-05 11:46:24 -06:00
Kris Nuttycombe 7ea8900a58 Implement AsRef for Proof 2021-05-05 11:39:07 -06:00
Kris Nuttycombe a08d060725 Remove unneeded pub(crate) 2021-05-05 11:23:30 -06:00
Kris Nuttycombe 226673938a Pass flags to arbitrary action generators. 2021-05-05 11:21:45 -06:00
Kris Nuttycombe 88b8265165 Generate both spend and output values for actions. 2021-05-05 11:14:38 -06:00
Kris Nuttycombe a789b89135 Check both u64 max and min in ValueSum arithemetic. 2021-05-04 16:35:49 -06:00
Kris Nuttycombe 4afdeeeb76 Add mapping over bundle value balance. 2021-04-30 09:43:51 -06:00
Kris Nuttycombe b1ac90b77a
Fix incorrect generator comments.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-04-30 08:02:09 -06:00
Kris Nuttycombe a119a27ee7 Clean up value balance generation. 2021-04-30 07:59:46 -06:00
Kris Nuttycombe 25c90dda4b Add fast generation for not-consensus-valid authorized bundles and actions. 2021-04-29 16:14:16 -06:00
Kris Nuttycombe 3c12877f87 Use a deterministic PRNG seeded from arb data for proptests. 2021-04-29 09:55:11 -06:00
Kris Nuttycombe f91088d35b Use builder to generate "valid" bundles via proptest. 2021-04-28 18:21:12 -06:00
Kris Nuttycombe 4d89d45332 Add proptest generators for action and bundle types. 2021-04-28 18:04:17 -06:00
Kris Nuttycombe 75573d331a Add canonical byte conversions for value commitments. 2021-04-28 18:03:50 -06:00
Kris Nuttycombe fc0f55d82b Make ValueSum correctly respect the proper specified range. 2021-04-28 18:03:50 -06:00
Kris Nuttycombe a5c9fb953b Add accessors necessary for zip-225 write. 2021-04-28 18:02:36 -06:00
Kris Nuttycombe e743198a50 Expose constructors required for ZIP-225 parsing. 2021-04-28 18:02:36 -06:00
Jack Grigg d383ff5054 Fix clippy lints 2021-04-29 10:57:53 +12:00
Jack Grigg 223b7ac533 Replace signing metadata tuple with struct
This enables the dummy-only first field to be properly documented.
2021-04-29 10:40:23 +12:00
Jack Grigg 186914166a Use `zero` instead of `default` for empty values 2021-04-28 09:06:33 +12:00
Jack Grigg 30f01d122c Bundle builder 2021-04-27 14:31:21 +12:00
Jack Grigg 497f7e0b86 Remove bundle::Unauthorized type
It is being replaced by context-specific unauthorized or
partially-authorized types. The only general type we need is Authorized
which is used in transactions.
2021-04-27 12:30:16 +12:00
Jack Grigg 316729302d cargo fmt 2021-04-27 12:28:42 +12:00
Jack Grigg a60051c8a2 Add from_raw constructors to NoteValue and ValueSum
These might be replaced later with APIs that can provide more useful
bounds checks, but we do need some way to construct these types.
2021-04-27 12:27:23 +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 5ec65c5d2a Add a mutable context to Bundle::{try_}authorize
This enables us to work around lifetime restrictions on e.g. the
randomness source at signing time, where it is needed for both
per-Action and Bundle-level signatures.
2021-04-27 12:24:33 +12:00
Jack Grigg 29b3071c67 Fix doc comments for bundle flags 2021-04-27 09:10:32 +12:00
Kris Nuttycombe 36529629bc Expose Flags constructor & accessors. 2021-04-27 09:04:03 +12:00
str4d 3dbebbe08b
Merge pull request #58 from zcash/proof-placeholder
Proving and verifying keys, and placeholder proof logic
2021-04-26 19:11:56 +01:00
str4d 0f6794f291
Merge pull request #70 from zcash/bundle-apis
Bundle APIs
2021-04-22 21:23:14 +01:00
Kris Nuttycombe 7d243ae60a
Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-04-22 07:32:20 -06:00
Jack Grigg 4c4400cb63 Proving and verifying keys, and placeholder proof logic 2021-04-23 01:08:43 +12:00
Jack Grigg f62bbbbb95 Small conversion helpers 2021-04-23 01:08:43 +12:00
Jack Grigg 35f65bb26a Expose RedPallas rerandomization 2021-04-23 01:06:10 +12:00
str4d 4db3b54c8b
Generate dummy nullifiers with the same distribution as real ones
The x-coordinates of Pallas points are not uniformly distributed base field elements.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-04-22 13:54:17 +01: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 3c2e32e156 Add some internal doc comments 2021-04-22 16:39:36 +12:00
Jack Grigg 09cca41ffb Add getters for bundle and action internals 2021-04-22 16:39:36 +12:00
Jack Grigg f1ad9d08de Bundle and action constructors 2021-04-22 16:39:26 +12:00