Commit Graph

90 Commits

Author SHA1 Message Date
Kris Nuttycombe 3f7acee282
Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2024-01-09 15:14:12 -07:00
Kris Nuttycombe b60ef5c7ea Return bundle metadata from bundle building.
In order to be able to associate requested spends and outputs with the
indices of the actions that execute these operations, it is necessary to
track the randomization of inputs and outputs and return the mappings
that resulted from that shuffling.
2024-01-09 14:09:05 -07:00
Kris Nuttycombe 3845686a6e Modify `BundleType` to exclude the anchor & allow no bundle to be produced.
This adds a flag to `BundleType` that, when set, requires a dummy-only
bundle to be produced even if no spends or outputs are added to the
builder, and when unset results in standard padding.
2023-12-20 19:29:14 -07:00
Kris Nuttycombe 938b203de5 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2023-12-19 12:45:43 -07:00
Kris Nuttycombe 2e2c161d52 Add a public bundle construction function & use it in the builder. 2023-12-18 21:56:42 -07:00
Kris Nuttycombe 0a257d6f68 Add explicit control of padding to the Builder API. 2023-12-15 15:08:22 -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 6cf6f15bf1 Update the `incrementalmerkletree` and `bridgetree` patch versions.
This also removes the `bridgetree` transitive dependency when building
using the `test-dependencies` feature flag, as the only use of it can be
satisfied just with `incrementalmerkletree`.
2023-05-24 15:36:25 -06:00
Kris Nuttycombe 8bc53ecbde Update to development versions of incrementalmerkletree/bridgetree
This modifies the tests where required to use bridgetree checkpoint
identifiers.
2023-04-11 10:33:25 -06:00
Kris Nuttycombe dca33119b4 Migrate to zcash_note_encryption 0.3.0 2023-03-21 10:48:47 -06: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 0f123ca707 Bump MSRV to 1.60 2023-03-09 21:14:41 +00:00
Kris Nuttycombe e2bfd99454
Merge pull request #365 from zingolabs/add_spends_and_outputs_getters_to_builder
Add spends/outputs getter fns to builders for use in change calculation
2023-01-03 14:57:06 -07:00
Gygaxis Vainhardt b64d6ba01e
Update src/builder.rs
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2023-01-03 17:34:28 -04:00
Dimitris Apostolou 1f13327479
Fix typo 2022-12-31 13:19:43 +02:00
Gygaxis Vainhardt cd8a39bd0c
Format comments
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2022-12-09 13:38:06 -04:00
Hazel OHearn 13d0d5592c
Add spends/outputs getter fns to builders for use in change calculation 2022-12-09 13:37:26 -04:00
Hazel OHearn e466d7b523
Add Display and Error impls for error types 2022-12-08 16:58:30 -04:00
Gygaxis Vainhardt 4296860a86
Partially apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-12-08 16:36:54 -04:00
Gygaxis Vainhardt 938b122814
Replace type alias with zero-size struct
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-12-08 16:35:49 -04:00
Hazel OHearn 6e8e2734e1
Error -> BuildError, add PartialEq, Eq to SpendError 2022-12-01 17:01:10 -04:00
Hazel OHearn 8c2326cdac
Error -> BuildError 2022-12-01 16:58:26 -04:00
Hazel OHearn 4f27b6bac3
Add concrete error types for add_spend and add_output 2022-12-01 16:51:04 -04:00
Kris Nuttycombe 33bce9b567
Merge pull request #359 from daira/add-value-balance-to-builder-docfix
Correct the doc comment and add a test for `Builder::value_balance`
2022-10-10 13:36:35 -06:00
Tomas Krnak 5fbbded49e Add `SpendInfo::new` and `Circuit::from_action_context`
Author: Tomas Krnak <tomas@krnak.cz>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-20 18:52:07 +01:00
Daira Hopwood 6458e27185 Add minimal test that `Builder::value_balance` works.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-19 14:05:46 +01:00
Daira Hopwood fbfc8f9ed8 Correct the doc comment for the `Builder::value_balance` method added in #352.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-19 14:05:46 +01:00
Hazel OHearn 8011e0d57a
add value_balance to builder 2022-09-15 16:47:54 -03:00
Jack Grigg e76a91adff Document how to obtain inputs for `Builder::add_spend`
Closes zcash/orchard#244.
2022-06-23 22:51:05 +00:00
Jack Grigg be69324b9c Migrate to `halo2_proofs 0.2.0` 2022-06-23 19:24:57 +00:00
Jack Grigg 6d6832f3f1 Fix clippy lints 2022-05-06 19:33:10 +00:00
Tomas Krnak e47abb8018 Support externally computed signatures
Co-authored-by: str4d <thestr4d@gmail.com>
2022-05-05 18:12:27 +02:00
Jack Grigg 3ca8c662a4 Merge branch 'main' into str4d/circuit-review 2022-05-04 17:09:15 +00:00
Jack Grigg 3ccf27e519 Update `Builder::build` docs
Closes zcash/orchard#279.
2022-05-04 14:57:08 +00:00
Kris Nuttycombe 4e3e469780 Update incrementalmerkletree dependency version. 2022-05-04 08:01:02 -06: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 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 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 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 06995064d7 incrementalmerkletree 0.3.0-beta.2 2022-04-06 18:19:39 +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 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 17ad25ee35 Merge branch 'non-consensus-changes-on-branchid-c4cd541e' into merge-non-consensus-changes 2022-02-15 22:46:47 +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