Commit Graph

53 Commits

Author SHA1 Message Date
Kris Nuttycombe 2e2c161d52 Add a public bundle construction function & use it in the builder. 2023-12-18 21:56:42 -07:00
Kris Nuttycombe 06cb76168e Rename `Builder::add_recipient` to `add_output`.
The term `recipient` is commonly used to refer to the address to which a
note is sent; however, a bundle may include multiple outputs to the same
recipient. This change is intended to clarify this usage.

Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-12-14 15:56:42 -07:00
Kris Nuttycombe cf526f59e2 Fix clippy beta lints that are applicable given an MSRV of 1.60 2023-03-10 14:23:06 -07:00
Jack Grigg 3beea4adb7 Migrate to `ff 0.13`
Closes zcash/orchard#371.
2023-03-09 21:14:41 +00:00
Kris Nuttycombe d05b6cee9d
Merge pull request #362 from zcash/batch-scanner-improvements
Batch scanner improvements
2022-10-20 09:30:49 -06:00
Daira Hopwood a3af4095ae Add more thorough documentation for `ValueCommitmentTrapdoor::from_bytes`.
Also add a CHANGELOG entry for orchard::value::{ValueCommitmentTrapdoor, ValueCommitment::derive}.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-10-18 20:45:54 +01:00
Tomas Krnak d428aa3143 Add `ValueCommitTrapdoor::from_bytes` constructor 2022-10-18 20:36:55 +01:00
Daira Hopwood 591c4b89b9
Merge pull request #351 from jarys/pub-value-commit-derive
Publicize `ValueCommitment::derive` constructor
2022-10-18 20:19:19 +01:00
Kris Nuttycombe 4c9b2096dc Fix beta clippy complaints. 2022-10-18 12:47:18 -06:00
Daira Hopwood 47004ee87a
Use math notation for ValueCommit^Orchard 2022-09-19 14:49:16 +01:00
Hazel OHearn 8011e0d57a
add value_balance to builder 2022-09-15 16:47:54 -03:00
Tomas Krnak 158f3e6e71 Publicize `ValueCommitment::derive` constructor 2022-08-13 15:35:01 +02:00
Jack Grigg 706cee42f5 Migrate to `ff 0.12` 2022-05-05 17:15:03 +00:00
Jack Grigg c4bf8105f2 Use `AssignedCell<NoteValue, _>` for circuit note values 2022-05-03 23:24:48 +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 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 4574d4793a Migrate to 2021 edition 2022-04-28 17:23:30 +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
therealyingtong 1a3cbeb896 Refactor src/constants and primitives::sinsemilla::constants. 2022-01-19 00:46:12 +08:00
str4d 54cdc051fe
Merge pull request #237 from zcash/orchard-mainnet-circuit
Orchard proposed mainnet circuit
2021-12-20 17:49:57 +00:00
Jack Grigg d11fbd4a56 Remove `ValueSum::from_raw`
There is no reason for crate users to be constructing `ValueSum`
directly. We no longer use it to represent `valueBalanceOrchard`,
instead requiring the user to specify their own type.
2021-12-20 16:08:44 +00:00
Jack Grigg 04af08d343 Fix documentation of `orchard::value` module
Closes zcash/orchard#142.
2021-12-20 16:05:33 +00: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 6f0cab5ffd Replace `FieldExt::from_u64` with `PrimeField: From<u64>` 2021-12-09 15:38:36 +00:00
Kris Nuttycombe c406461f64 Expose inner representation of NoteValue 2021-08-23 11:29:07 -06: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
Kris Nuttycombe f22907a4d7 Use constants for value commitment hash-to-curve.
Fixes #76
2021-06-23 18:04:17 -06:00
Jack Grigg 99665572a2 Orchard note encryption 2021-06-11 23:55:16 +01: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 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 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 a119a27ee7 Clean up value balance generation. 2021-04-30 07:59:46 -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
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 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 dbfbc66ac7 Add NoteValue::zero as an alias for NoteValue::default 2021-04-23 00:46:39 +12:00
Jack Grigg badaf23f25 Implement ValueCommit^Orchard 2021-04-15 17:08:06 +12:00