Commit Graph

976 Commits

Author SHA1 Message Date
Kris Nuttycombe 696a9be0a0 Update `zcash_primitives` to reflect argument changes to `parse_note_plaintext_without_memo_ovk` 2023-05-26 09:43:26 -06:00
Kris Nuttycombe 3ae90020c3
Merge pull request #848 from zcash/note-encryption-avoid-redundant-checks
Avoid redundant checks during note decryption
2023-05-26 09:10:52 -06:00
Kris Nuttycombe 980736806f Upgrade `incrementalmerkletree` & `orchard` patch versions. 2023-05-25 12:33:25 -06:00
Jack Grigg 2ae4d87cbf zcash_primitives: Remove redundant checks from Sapling note decryption
- The consistency check between `esk` and `ephemeral_key` is checked
  inside `zcash_note_encryption::try_output_recovery_with_ock`.
- The `diversifier` validity check is necessarily performed when
  deriving `pk_d` for the `ivk` pathway, so we keep it there for the
  `ovk` pathway as well, and drop the check from the `PaymentAddress`
  internal constructor.
2023-05-19 16:36:55 +00:00
Jack Grigg 8db7a071a0 zcash_primitives: `impl DynamicUsage for sapling::Bundle<Authorized>` 2023-05-17 03:44:24 +00:00
Jack Grigg 26d95b4a0e zcash_primitives: Temporarily expose v5 Sapling bundle parsing
This is currently exposed via `Transaction` for usage in `zcashd`, but
may be removed in future (if `zcashd` moves transaction parsing entirely
into Rust), or renamed and stabilised.
2023-05-17 03:44:24 +00:00
Jack Grigg a092da8d5d Fix clippy lints for 1.65 2023-05-16 15:59:58 +00:00
Jack Grigg 6419e1e363 Remove `inferno` pin now that its MSRV is compatible with ours 2023-05-16 15:39:06 +00:00
Jack Grigg 8681b56d52 Bump MSRV for `zcash_primitives` and dependents to 1.65 2023-05-16 15:37:07 +00:00
Kris Nuttycombe bc55893267
Merge pull request #838 from daira/update-fee-constants
Revert #830 and instead modify `zcash_primitives::transaction::fees::fixed::FeeRule::standard()`
2023-05-09 13:17:27 -06:00
Daira Emma Hopwood 32296e7327 Update `DEFAULT_TX_EXPIRY_DELTA` to 40 blocks, as specified in
<https://zips.z.cash/zip-0203#changes-for-blossom>. fixes #837.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-05-09 18:38:39 +01:00
Daira Emma Hopwood 3903935234 Deprecate `transaction::components::amount::DEFAULT_FEE` and
`zcash_primitives::transaction::fees::fixed::FeeRule::standard()`.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-05-09 17:18:34 +01:00
Daira Emma Hopwood 736d11b45b Change `transaction::fees::fixed::FeeRule::standard()` to use the ZIP 317
minimum fee (10000 zatoshis rather than 1000 zatoshis) as the fixed fee.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-05-09 16:42:41 +01:00
Daira Emma Hopwood 043cc59c76 Add `transaction::fees::zip317::MINIMUM_FEE` constant and
`transaction::components::amount::Amount::const_from_i64`.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-05-09 16:42:19 +01:00
Daira Emma Hopwood 4cf27126e5 Revert "Update DEFAULT_FEE to 10_000 from 1000"
This reverts commit 2a6dc59c5d.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-05-09 13:15:52 +01:00
Kris Nuttycombe d37e6adee5
Merge pull request #783 from nuttycom/upgrade_bridgetree
Upgrade `zcash_primitives` to use updated `incrementalmerkletree` types.
2023-05-08 12:00:00 -06:00
str4d 579ab92b93
Merge branch 'main' into 823-secp256k1-0.26 2023-05-08 18:53:33 +01:00
Kris Nuttycombe ec29836df9 Remove `bridgetree` dependency from `zcash_primitives`.
This also now makes `zcash_extensions` use `incrementalmerkletree`
transitively via type aliases in `zcash_primitives`.
2023-05-04 15:42:39 -06:00
Kris Nuttycombe c9f53ddde5 Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-05-04 14:46:34 -06:00
Kris Nuttycombe 4d32a8ac20 Remove serialization version constants. 2023-05-04 12:46:15 -06:00
Kris Nuttycombe 71f74d4ac1 Remove the `merkle_tree::incremental` module.
This consolidates all the seralization code for frontiers and
incremental witnesses in the `merkle_tree` module.
2023-05-04 12:46:15 -06:00
Kris Nuttycombe 6aaa96d377 Remove zcashd-specific `bridgetree` serialization. 2023-05-04 12:46:15 -06:00
Kris Nuttycombe 1f9747e15f Move merkle tree types to the `incrementalmerkletree` crate.
This removes the `CommitmentTree`, `IncrementalWitness`, and
`MerklePath` types in favor of equivalent versions available
from the `incrementalmerkletree` crate.
2023-05-04 12:30:56 -06:00
Kris Nuttycombe 667a7b841e Move-only: restructure merkle tree source for extraction. 2023-05-04 12:21:50 -06:00
Kris Nuttycombe 6f2cbfc7de Factor serialization out from merkle tree data structures. 2023-05-04 12:21:47 -06:00
Kris Nuttycombe 831a6cd396 Remove superfluous inner functions now that tree depth is a constant. 2023-05-04 12:16:09 -06:00
Kris Nuttycombe ec57d23115 Use const generics to set commitment tree & incremental witness depths.
This is in preparation for extraction into the `incrementalmerkletree`
crate, which is not Sapling-specific and therefore cannot hard-code
the depths of these data structures.
2023-05-04 12:16:09 -06:00
Kris Nuttycombe 69430c3da2 Upgrade incrementalmerkletree and use bridgetree crate for `Bridgetree`. 2023-05-04 12:08:38 -06:00
Hazel OHearn 2a6dc59c5d
Update DEFAULT_FEE to 10_000 from 1000 2023-05-03 16:42:01 -03:00
Jack Grigg ec1c1bcf21 Migrate to `secp256k1 0.26`, `hdwallet 0.4`
Closes zcash/librustzcash#823.
2023-04-19 19:33:34 +00:00
Jack Grigg a419b56e80 zcash_primitives 0.11.0 2023-04-14 23:56:16 +00:00
Jack Grigg 7be5d1bf7d Update changelogs 2023-04-14 23:49:13 +00:00
Kris Nuttycombe 30dfcd79cc
Merge pull request #809 from nuttycom/test/merkle_tree_serialization
Add roundtrip and golden tests for v1 `MerkleBridge` serialization.
2023-04-12 13:40:49 -06:00
Jack Grigg edb1941f19 zcash_primitives: Downgrade to `bip0039 0.10`
`bip0039 0.11` switched from language function arguments to a generic
parameter. We aren't ready to migrate to this yet.
2023-04-12 16:19:03 +00:00
Kris Nuttycombe b2139c0b97 Add roundtrip and golden tests for v1 `MerkleBridge` serialization. 2023-04-11 16:45:09 -06:00
Kris Nuttycombe 3ff5fa5288
Merge pull request #793 from zcash/zip32_seed_signature
[#792] zcash_primitives: implement Seed Signature section of ZIP-32
2023-04-11 12:58:39 -06:00
Jack Grigg 878f3e9214 zcash_primitives: Migrate to `sha2 0.10`, `bip0039 0.11` 2023-04-11 15:48:44 +00:00
Jack Grigg d2ccd1f017 zcash_primitives: Migrate to `fpe 0.6`
Part of zcash/librustzcash#757.
2023-04-11 15:48:44 +00:00
Jack Grigg 2fcde5e047 Migrate to `orchard 0.4.0`
Closes zcash/librustzcash#766.
2023-04-11 13:25:17 +00:00
Francisco Gindre e3f09ba66a
[#792] zcash_primitives: implement Seed Signature section of ZIP-32
Implements a type to enclose a Seed Fingerprint byte sequence
called `SeedFingerprint`

implements a public function to create a `SeedFingerprint` from
seed bytes

Closes #792

Credits for PR Suggestions by Daira and Kris

Edit: Added suggestions from Daira Emma and a test for returning `None`

Added test refactor suggestions as well

removed reference to test vectors
2023-03-30 18:41:57 -03:00
Kris Nuttycombe d6fafa291b Update Sapling note encryption for `zcash_note_encryption 0.3.0`
Fixes zcash/librustzcash#455
2023-03-21 11:09:38 -06:00
Kris Nuttycombe c696069f93 Bump zcash_note_encryption to version 0.3.0 for release.
This removes the path-based dependencies on the `zcash_note_encryption`
crate in favor of using versioned dependencies locally. This better
reflects the future state in which `zcash_note_encryption` is factored
out of the workspace and maintained in a separate repository.
2023-03-20 16:16:34 -06:00
Kris Nuttycombe cb1be45f22 Update CHANGELOGs to reflect the addition of the zcash_primitives/multicore feature. 2023-03-20 15:11:05 -06:00
Kris Nuttycombe 7c1a4c898d Fix wasm32 CI runner.
The `halo2_proofs/multicore` flag must be disabled when running wasm
builds; this ensures that we do not accidentally include it as a
transitive dependency when building with `--no-default-features`.
2023-03-20 14:39:07 -06:00
Kris Nuttycombe 77fbd8cb4f Update dependencies to reflect changes in ff 0.13 2023-03-20 14:35:45 -06:00
Jack Grigg 2530eb3a9d Temporarily re-expose Sapling `NoteCommitment` derivation 2023-03-16 23:27:01 +00:00
Jack Grigg a8003c8ff5 Temporarily re-expose ability to construct invalid Sapling bundles
Until zcash/zcash#6397 is closed, this ability is needed by `zcashd` for
crossing the FFI.
2023-03-08 03:45:01 +00:00
Kris Nuttycombe 9c56b21de7 Pin the `inferno` transitive dependency to avoid MSRV errors. 2023-02-16 11:06:24 -07:00
Jack Grigg 9852c31970 zcash_primitives 0.10.0 2023-02-01 02:10:42 +00:00
Jack Grigg 7f970bb82f Use `EphemeralSecretKey, EphemeralPublicKey, SharedSecret` types in APIs 2023-01-24 15:02:49 +00:00
Jack Grigg bc99cd2634 Move prepared key types into `sapling::keys`
We re-export them under `sapling::note_encryption` for now to make the
API changes smaller.
2023-01-24 15:02:43 +00:00
Jack Grigg ded14adbb3 Add `sapling::keys::DiversifiedTransmissionKey` 2023-01-24 15:02:38 +00:00
Jack Grigg 06ba399d80 Clean up the `sapling::Note` API 2023-01-24 15:02:32 +00:00
Jack Grigg 87d0bd7db1 Refactor `sapling::Note`
Its internals are now private, and it stores a `PaymentAddress` (and by
extension the diversifier) instead of `g_d`.
2023-01-24 15:02:27 +00:00
Jack Grigg dff21222fb Require `PaymentAddress` to contain a valid diversifier 2023-01-24 14:51:13 +00:00
Jack Grigg 42c332a7a8 Use `sapling::note::ExtractedNoteCommitment` type in APIs 2023-01-24 14:37:11 +00:00
Jack Grigg 0a26c812e0 Split `sapling::Authorization::Proof` type into Spend and Output types
While the Groth16 proofs have identical encodings, they are technically
for different circuits, and we need the ability to differentiate them
during bundle building.
2023-01-20 11:12:49 +00:00
Kris Nuttycombe 79f3f10714
Merge pull request #760 from zcash/759-msrv-1.60
Bump MSRV for `zcash_primitives` and dependents to 1.60
2023-01-19 19:33:15 -07:00
Jack Grigg 809427f6bd criterion 0.4 2023-01-20 00:03:10 +00:00
Jack Grigg 49b1cb3e69 Bump MSRV for `zcash_primitives` and dependents to 1.60
The MSRVs of the component crates are left as-is, partly because our
dependencies don't require us to bump them, and partly because those
crates have no pending changes and are relatively stable. We also plan
to split the component crates out into a separate repository, where it
will be easier to have a separate MSRV.

Closes zcash/librustzcash#759.
2023-01-19 23:48:24 +00:00
Jack Grigg 19d8e2125e Introduce `sapling::keys::{EphemeralSecretKey, EphemeralPublicKey}` types 2023-01-06 22:42:33 +00:00
Jack Grigg 7fb80d55d6 Introduce `sapling::keys::SharedSecret` type 2023-01-06 22:24:40 +00:00
Jack Grigg 1df49c517e Refactor Sapling key derivation 2023-01-06 22:24:40 +00:00
Jack Grigg 88d46fd6b3 Refactor Sapling note commitment derivation 2023-01-06 22:24:40 +00:00
Jack Grigg 65271b49e5 Refactor Sapling nullifier derivation 2023-01-06 22:24:40 +00:00
Jack Grigg f1d3e03a9b zcash_primitives: Reorganise `sapling` module into submodules
The module structure now matches the `orchard` crate, to make subsequent
refactoring easier. The public API is not altered by this commit.
2023-01-06 22:24:35 +00:00
Kris Nuttycombe 95cbc7abaf
Merge pull request #734 from zcash/sapling-type-safety
Improve Sapling type safety
2023-01-05 13:12:45 -07:00
Jack Grigg 23922ca290 Add Sapling value types
These are modeled after the value types developed for the `orchard`
crate.
2022-12-20 05:16:39 +00:00
Kris Nuttycombe 125d2bc3d5
Merge pull request #727 from nuttycom/test/shield_transparent_funds
Add `shielding_threshold` argument to `shield_transparent_funds`.
2022-12-15 13:11:55 -07:00
Jack Grigg fee0b6a18d Make Sapling transaction structs non-transparent
We instead provide getters for the struct fields.
2022-12-13 04:03:06 +00:00
str4d 51932b7366
Merge pull request #732 from nuttycom/fix/clippy_lints
Fix clippy complaints.
2022-12-10 02:21:54 +00:00
Kris Nuttycombe bbe6280bb0 Fix clippy complaints. 2022-12-09 09:32:34 -07:00
Kris Nuttycombe 0f56f095c2 Add `shielding_threshold` argument to `shield_transparent_funds`.
Previously, the shielding threshold was fixed to 100000 zatoshis.

Fixes #726
2022-12-08 17:15:48 -07:00
Kris Nuttycombe fff6983512 Replace a number of uses of `assert!(matches!(...))` with `assert_matches!(...)`
The remaining uses of `assert!(matches!(...))` are all in cases where
for some reason the `assert_matches` macro interferes with correct
type inference.
2022-12-08 12:17:14 -07:00
Jack Grigg 4435c4789f zcash_primitives 0.9.1 2022-12-06 06:14:28 +00:00
Jack Grigg a1da018f1c zcash_primitives: Count Sapling padding in `Builder::build_zfuture` fees
Closes zcash/librustzcash#709.
2022-12-06 06:13:09 +00:00
Hazel OHearn 08bf711744
We now pad sapling outputs to two with at least one input for fee calculation 2022-11-18 17:30:49 -04:00
Jack Grigg c3b6e5a72a zcash_primitives 0.9.0 2022-11-11 20:37:55 +00:00
Jack Grigg 318d1b7522 Clean up changelogs 2022-11-11 20:29:26 +00:00
str4d 116ed0a3fc
Merge pull request #699 from zcash/wallet/error_display
Add missing `std::fmt::Display` implementations for error types.
2022-11-11 07:26:04 +00:00
str4d 53d56362cd Fix typos in error type `Display` messages 2022-11-11 05:33:48 +00:00
Kris Nuttycombe ed96131c4f Add missing `std::fmt::Display` implementations for error types. 2022-11-10 21:17:57 -07:00
Jack Grigg 69665b9284 Add identity `MapAuth` implementations 2022-11-11 03:38:58 +00:00
Kris Nuttycombe 73ab884073 Implement ZIP 317 fee estimation, calculation, & change selection 2022-11-10 15:30:13 -07:00
Kris Nuttycombe 847ba49761 Add dust note detection to change selection.
The change selection algorithm has the most useful information for
determining whether or not a note is dust, so this adds a new error case
to `ChangeError` that allows the change selection to report the presence
of input notes without economic value back to its caller.
2022-11-10 12:18:30 -07:00
Kris Nuttycombe 9a7dc0db84 Add traits for fee estimation and input selection
This adds a set of abstractions that allow wallets to provide
independent strategies for fee estimation and note selection, and
implementations of these strategies that perform these operations in the
same fashion as the existing `spend` and `shield_transparent_funds`
functions.

This required a somewhat hefty rework of the error handling in
zcash_client_backend. It fixes an issue with the error types whereby
callees needed to have a bit too much information about the error
types produced by their callers.

Reflect the updated note selection and error handling in zcash_client_sqlite.
2022-11-10 12:17:59 -07:00
Kris Nuttycombe 981d45e966 Documentation & changelog fixes. 2022-11-03 19:27:17 -06:00
Kris Nuttycombe cdfca848ea Improve type safety of note commitment tree node construction. 2022-11-03 18:44:48 -06:00
Kris Nuttycombe 1be86b7a54 Derive the correct note when spending from a change address. 2022-11-03 18:44:48 -06:00
Kris Nuttycombe b68d37a0b1 Use DiversifiableFullViewingKey instead of ExtFVK where possible. 2022-11-03 18:44:45 -06:00
str4d d4f4f5ad91
Merge pull request #658 from nuttycom/wallet/builder_explicit_change
Update the transaction builder to make change outputs explicit
2022-11-04 00:42:31 +00:00
Kris Nuttycombe 28db1e324f Update changelog. 2022-11-03 18:14:15 -06:00
Kris Nuttycombe 9c894ebf3e Create per-protocol fees modules. 2022-11-03 15:07:14 -06:00
Kris Nuttycombe c92d81b15d Move the `TzeInput` trait to the `tze::components::builder` module 2022-11-03 09:57:36 -06:00
Kris Nuttycombe 37e78e1fe3 Expose less information about Sapling outputs to change calculation. 2022-11-03 09:56:50 -06:00
Kris Nuttycombe 1be97e9cef Address comments from code review. 2022-11-03 09:56:08 -06:00
Kris Nuttycombe 9496fc6118 Add fee calculator to the transaction builder.
This adds a fee calculation strategy abstraction that can be used to
dynamically compute fees so that the total fees required may be taken
taken into account during note selection, and also removes automatic
change creation from the transaction builder.

Change outputs must now be directly created by the caller by the caller.
This is a necessary prerequisite for permitting fees to adjust based
upon the contents of the transaction being constructed.

The initial implementation of the fee strategy simply uses the current
default fee.
2022-11-02 08:28:16 -06:00
Jack Grigg 3720b45feb Categorise dependencies in `Cargo.toml` files
This should make it easier to upgrade dependencies in future.
2022-11-01 09:02:54 +00:00
Jack Grigg a0016588ac Remove unused dependencies
Some were only used by tests, others weren't used at all.
2022-11-01 09:02:27 +00:00
Kris Nuttycombe 8cb16d878e Require a source transparent address to shield transparent funds.
Previously, `shield_transparent_funds` was only shielding funds
associated with the legacy default transparent address. This meant
that transparent funds sent to unified addresses could not reliably
be shielded, as a unified address will frequently be constructed
using a diversifier index greater than zero.

This modifies the `get_transparent_receivers` method to return address
metadata containing the account ID and diversifier index used to derive
each address along with the receiver.
2022-10-25 12:53:54 -06:00
Kris Nuttycombe 373e69907f
Improve reason for yanking of the 0.8.0 version of `zcash_primitives`.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-10-19 17:53:50 -06:00
Sean Bowe f588d0dbeb
Bump zcash_primitives version to 0.8.1 and yank 0.8.0. 2022-10-19 16:59:53 -06:00
Sean Bowe bd7f9d7c3c
Bump zcash_encoding and zcash_address crate versions to 0.2. 2022-10-19 16:51:59 -06:00
Kris Nuttycombe 5bf36989e2 Fix beta clippy complaints. 2022-10-19 13:35:51 -06:00
Sean Bowe 176e21b015
Update zcash_primitives to orchard 0.3; release zcash_primitives and zcash_proofs 0.8. 2022-10-19 13:32:51 -06:00
Kris Nuttycombe c773ea3b3e Make the internals of `WalletTransparentOutput` private. 2022-10-14 12:38:55 -06:00
Jack Grigg 8f068b3b71 zcash_note_encryption 0.2.0 2022-10-13 21:35:39 +00:00
Jack Grigg 24f7d1c9bc zcash_primitives: Require `group 0.12.1` for `wnaf-memuse` feature flag 2022-10-13 06:19:34 +00:00
Kris Nuttycombe d6484da088 Minor documentation fixes.
Co-authored-by: ying tong <yingtong@z.cash>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-10-05 13:02:21 -06:00
Kris Nuttycombe 60785a1d7a Fix Sapling key organization.
This change moves Sapling-specific key generation into a
submodule of `zip32`. Public reexports are used to keep the
existing API consistent.
2022-10-03 20:28:04 -06:00
Jack Grigg 913aa0a988 zcash_client_backend: Correctly track heap usage of batch items
As of zcash/librustzcash#633, `SaplingDomain::IncomingViewingKey` now
allocates memory internally, and this memory persists as long as the
`BatchRunner` is alive. Now that we have decoupled the measurement of
heap usage for batch tasks from their internals, we can add bounds to
all of the generic parameters of `Batch` to enable correctly measuring
their actual heap usage.

We also add `DynamicUsage` impls for a bunch of `zcash_primitives` types
that will be used with `BatchRunner` (or its equivalent implementation
in `zcashd`) by callers.
2022-09-24 21:01:19 +00:00
Daira Hopwood e53439a236 Update chacha20poly1305 dependency in zcash_primitives to 0.10,
consistent with zcash_note_encryption.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-23 21:52:40 +01:00
Kris Nuttycombe 03c3370de8 Fix problems identified by clippy's beta lints 2022-09-17 08:57:37 -06:00
Kris Nuttycombe 29220c716f Remove `zcash_primitives` as a zcash_note_encryption dev dependency.
This was only used to provide example code for Sapling usage of
the `NoteEncryption` struct; this example code has been moved
to `sapling::note_encryption`.
2022-09-16 12:52:00 -06:00
Daira Hopwood 20e869f501 zcash_primitives: Use prepared epk and ivk in Sapling note decryption
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-15 03:40:45 +01:00
Daira Hopwood d77ed9c6cf Change batch decryption benchmark to cover more cases of (nivks, noutputs).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-15 03:20:14 +01:00
Jack Grigg 8f03208439 zcash_client_backend: Add tags to IVKs in the batch scanner
This removes the dependency on `SaplingIvk::to_repr()`, and enables us
to alter the type of `D::IncomingViewingKey` to improve the performance
of batch scanning.

For the welding rig, we already annotate the viewing keys with
`AccountId`, so we use `(AccountId, Scope)` as the tag.
2022-09-13 21:40:58 +00:00
Kris Nuttycombe a93c9d334e Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-09-10 17:02:43 -06:00
Kris Nuttycombe 7934e834d3 Add test for fee calculation in add_transaction_views migration. 2022-09-10 11:01:36 -06:00
Kris Nuttycombe 95610f7b4f Add fee to the transactions table & compute correct net_value in v_transactions. 2022-09-09 16:12:29 -06:00
Jack Grigg 7112ed9da5 zcash_client_backend: Add `WalletReadTransparent::get_transparent_receivers`
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2022-09-08 20:24:42 +00:00
Kris Nuttycombe 7b7288c750 (cleanup) Make the internals of `zip32::DiversifierKey` private 2022-09-08 11:17:14 -06:00
Kris Nuttycombe f15a6d8e80 Add `no_std` implementations of Sapling key encoding & decoding. 2022-09-08 11:05:59 -06:00
str4d 980f6b4e6c
Merge pull request #627 from nuttycom/edition_2021
Update to Rust 2021
2022-09-07 11:41:44 +01:00
Kris Nuttycombe d7e2e2f7c1 Remove use of `IntoIterator::into_iter` 2022-09-02 12:05:15 -06:00
Kris Nuttycombe a93f5945ab Remove redundant TryFrom/TryInto imports. 2022-09-02 12:05:15 -06:00
Kris Nuttycombe 16a0e43f2d Update to Rust 2021 and explicitly set MSRVs 2022-09-02 12:05:09 -06:00
Jack Grigg e5dad037e9 zcash_primitives: Make `NullifierDerivingKey` internals public
The `zcashd` Rust code relies on being able to construct the Sapling
types transparently. This part of the "public API" of the crate was
broken when the `NullifierDerivingKey` newtype was introduced. We do
want to migrate to all of these types having stronger type safety
guarantees (by only constructing them via constructors), but that should
be done consistently across the types. For now we maintain the existing
API by changing `NullifierDerivingKey` to be a transparent newtype.
2022-09-02 01:13:20 +00:00
Kris Nuttycombe f5a18b8fa5 Add conversions from u32 and u64 to DiversifierIndex 2022-08-31 17:15:47 -06:00
Kris Nuttycombe ba1bb65a5f Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-08-26 16:09:05 -06:00
Kris Nuttycombe c4da498cf4 Shield funds to the internal Sapling key for a specified account.
This updates `shield_transparent_funds` to look up the internal
(change) address for the account specified, and use that as the
destination for shielding transparent funds.

Fixed #614
2022-08-26 16:03:25 -06:00
Kris Nuttycombe 6156215d4c Add parallelized batched trial decryption to wallet scanning.
Co-authored-by: str4d <jack@electriccoin.co>
2022-08-18 16:48:22 -06:00
Kris Nuttycombe cdfaa57496 Add migrations to support using UFVKs instead of Sapling extfvks.
Fixes #594
2022-08-18 10:15:58 -06:00
Kris Nuttycombe f1c2da7b1d Add sapling::NullifierDerivingKey newtype.
Nullifier computation only requires the nullifier deriving key,
not the entire Sapling viewing key. This separation of concerns
will be needed for batch decryption when wallet-internal keys
will need to be considered.
2022-07-28 15:23:21 -06:00
Kris Nuttycombe 5873950648 Restructure batch decryption to avoid cartesian product of results.
While it is necessary in the worst case to perform `m * n` decryptions,
where `m` is the number of outputs being decrypted and `n` is the number
of IVKs, it is possible to stop performing trial decryptions when the
first successful decryption is performed. Also, it's inconvenient and
unnecessary to return the full cartesian product of these results, as
only one IVK will decrypt a given output. This commit modifies batch
trial decryption to stop on the first successful decryption, and instead
of returning the cartesian product of results we return the index of the
input IVK along with the output it decrypted. Note that this means that
trial decryption is not constant-time with respect to the number and/or
order of IVKs.
2022-07-28 15:23:21 -06:00
Kris Nuttycombe 94c8d8e7ef Return the network type for encoding addresses as part of the network parameters. 2022-06-30 12:09:32 -06:00
Daira Hopwood dae2e008e9
Merge pull request #577 from daira/bosl-notice
Projects that rely on BOSL exceptions should say that they do
2022-06-29 12:59:07 +01:00
Kris Nuttycombe 0142a3db1b
Merge pull request #570 from zcash/387-migrate-from-extfvk-to-ufvk
`zcash_client_*`: Migrate from `ExtendedFullViewingKey` to `UnifiedFullViewingKey`
2022-06-28 10:49:37 -06:00
Daira Hopwood a9aa2929d2 Address feedback about the use of "permissive".
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-06-28 16:46:13 +01:00
Daira Hopwood 75ca854005 Projects that rely on BOSL exceptions should say that they do.
fixes #576

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-06-28 12:29:16 +01:00
Jack Grigg e952ff637e zcash_primitives 0.7.0 2022-06-24 17:00:39 +00:00
Jack Grigg a3cae5d36a equihash 0.2.0 2022-06-24 17:00:26 +00:00
Jack Grigg 59b20c6e31 pprof 0.9 2022-06-24 16:27:06 +00:00
Jack Grigg 18fb1f0b07 orchard 0.2 2022-06-24 16:25:51 +00:00
Jack Grigg 3a3c3863cd zcash_primitives: Update changelog 2022-06-24 16:01:24 +00:00
Jack Grigg 76d015ed11 zcash_client_backend: Fix `UnifiedFullViewingKey` Sapling item type
Per ZIP 316, the Sapling FVK Encoding only includes `(ak, nk, ovk, dk)`
which is a subset of the Sapling `ExtendedFullViewingKey`. We therefore
need to use `DiversifiableFullViewingKey` inside `UnifiedFullViewingKey`
in order to make it parseable from the UFVK string encoding.

`zcash_client_sqlite::wallet::get_extended_full_viewing_keys` has been
removed as a consequence of this change: we can no longer reconstruct
the correct `ExtendedFullViewingKey` from the `UnifiedFullViewingKey`.
2022-06-17 10:03:17 +00:00
Jack Grigg df1105b996 zcash_primitives: Add `DiversifiableFullViewingKey` 2022-06-14 02:18:25 +00:00
Kris Nuttycombe 7bce52f235 Update NU5 mainnet activation height. 2022-05-11 12:22:20 -06:00
Jack Grigg 3ecfd26d79 zcash_primitives 0.6.0 2022-05-10 23:33:05 +00:00
Jack Grigg 6976d3fe85 zcash_encoding 0.1.0 2022-05-10 23:33:05 +00:00
Jack Grigg 9ebbd42401 orchard 0.1 2022-05-10 23:06:31 +00:00
Jack Grigg c17af47d8f pprof 0.8 2022-05-10 23:04:48 +00:00
Jack Grigg a565c7e113 hdwallet 0.3.1
This release bumped secp256k1 to 0.21.
2022-05-10 23:00:43 +00:00
ebfull 71e2f395d4
Merge pull request #547 from nuttycom/fix_merkle_tree_complete
Allow CommitmentTree completeness & auth paths to be computed at arbitrary depths.
2022-05-06 17:42:01 -06:00
Jack Grigg 144512b547 Migrate to `ff 0.12` 2022-05-06 20:03:49 +00:00
Kris Nuttycombe a63a37aab2 Allow CommitmentTree completeness & auth paths to be computed at arbitrary depths.
Fixes #546
2022-05-06 11:45:06 -06:00
Kris Nuttycombe 4969d81ad3 Add a test for merkle_tree::CommitmentTree::is_complete 2022-05-06 11:44:04 -06:00
Kris Nuttycombe 8bb1962153 Update incrementalmerkletree version and add SER_V2 serialization constant. 2022-05-04 09:25:07 -06:00
Kris Nuttycombe d14e7a707c Set NU5 testnet reactivation height. 2022-04-13 16:47:33 -06:00
Kris Nuttycombe 4d5b3831d1 Add conversion from incrementalmerkletree::bridgetree::Frontier -> CommitmentTree
Also, add roundtrip property tests to ensure the correctness of the
conversion.
2022-04-08 13:08:48 -06:00
Kris Nuttycombe 9416ab3a3e Update to secp256k1 v0.21 2022-04-06 16:09:45 -06:00
Jack Grigg ffa669a958 Migrate to orchard 0.1.0-beta.3 2022-04-06 21:00:25 +00:00
Jack Grigg 6e8c457e30 zcash_primitives: Show hex encoding of `BlockHash` in its `Debug` impl
The (byte-flipped) hex string is more useful than the raw bytes, because
we can look that up in RPC methods and block explorers.
2022-04-05 17:55:56 +00:00
Jack Grigg 7447a599f7 zcash_primitives: Show hex encoding of `TxId` in its `Debug` impl
The (byte-flipped) hex string is more useful than the raw bytes, because
we can look that up in RPC methods and block explorers.
2022-04-05 17:52:48 +00:00
Jack Grigg 9c1ed86c5a Update NU5 consensus branch ID and remove testnet activation height
Part of zcash/librustzcash#456.
2022-03-23 00:35:20 +00:00
Jack Grigg 5668804629 Migrate to beta releases of incrementalmerkletree and orchard 2022-03-23 00:04:32 +00:00
Jack Grigg 494092223b Merge branch 'master' into non-consensus-changes-on-branchid-37519621 2022-03-23 00:00:21 +00:00
Kris Nuttycombe 71657b4f18 Generalize vector and array writes & reads.
In a number of places, we transform other kinds of collections with
known length information into vectors simply to be able to use them with
`Vector::write` or `Vector::read`. We can avoid these extra allocations
by writing from iterators directly, and similarly by reading directly
into our desired collection types.
2022-03-11 16:48:28 -07:00
Kris Nuttycombe d602c01ef6 Standardize how we write and read usize values for incrementalmerkletree.
Also, make consistent use of helper functions for reading
and writing `Position` values.
2022-03-11 16:48:28 -07:00
Jack Grigg 91d9a42a08 Merge branch 'non-consensus-changes-on-branchid-37519621' into merge-non-consensus-changes-3 2022-02-28 23:22:40 +00:00
Jack Grigg 22ebe95de6 zcash_primitives: Replace custom `Debug` impl on `TransactionData` 2022-02-28 22:39:43 +00:00
Kris Nuttycombe b97d777361 Update the versions of incrementalmerkletree & orchard.
This removes unreleased incrementalmerkletree::BridgeTree serialization
that was zcashd-specific.
2022-02-24 13:54:31 -07:00
Kris Nuttycombe 600c06a408 Update MSRV to 1.56.1 2022-02-24 12:26:14 -07:00
Jack Grigg 12700b4c17 Migrate to `orchard` revision with the Orchard circuit changes 2022-02-15 23:37:52 +00:00
Jack Grigg f822d7aabc Bump MSRV to 1.54.0
This is the MSRV for the orchard crate version that contains the changes
to the Orchard circuit.

Closes zcash/librustzcash#513.
2022-02-15 16:39:29 +00:00
Jack Grigg dbfa673500 Merge branch 'non-consensus-changes-on-branchid-37519621' into merge-non-consensus-changes-again 2022-02-14 18:11:09 +00:00
Kris Nuttycombe a15f426ff3
Merge pull request #506 from rex4539/typos
Fix typos
2022-02-13 20:29:50 -07:00
Jack Grigg 54e3dded92 Add `TransactionData::map_bundles`
This is needed for FFI-crossing in `zcashd`.
2022-02-12 02:59:18 +00:00
Kris Nuttycombe f590134ee8 Add transaction::Transaction::into_data 2022-02-11 15:29:44 -07:00
Kris Nuttycombe af9edcea25 Define transaction::TransactionData::map_authorization 2022-02-11 15:29:44 -07:00
Kris Nuttycombe e20de50b84 Make AccountId internal representation private. 2022-02-10 11:30:02 -07:00
Kris Nuttycombe 970b6d6750 Add missing trait impls for AccountId 2022-02-10 09:12:18 -07:00
Kris Nuttycombe 2425a08690
Merge pull request #493 from zcash/485-zip244-coinbase-fix
zcash_primitives: Update ZIP 244 with coinbase fix
2022-02-08 08:16:19 -07:00
Dimitris Apostolou e600d7b917
Fix typos 2022-02-03 20:15:32 +02:00
str4d 9319dd4c3e Implement XNOR using `assert_eq!`
Because of course that is simpler than building it from XOR.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-02-03 00:12:55 +00:00
Kris Nuttycombe a304c3953b Fix Clippy beta linting complaints. 2022-02-02 16:02:45 -07:00
Kris Nuttycombe 60d9124453 Merge branch 'non-consensus-changes-on-branchid-37519621' into 'master' 2022-02-02 14:38:09 -07:00
Kris Nuttycombe 1507d1de0a Fix incorrect construction of transparent OVKs. 2022-02-02 10:33:44 -07:00
Kris Nuttycombe b4ff3f368e Add test vectors for transparent OVKs. 2022-02-02 10:33:44 -07:00
therealyingtong 0c80399fe1 zcash_primitives::zip32::tests: Use internal test vectors. 2022-02-02 10:33:44 -07:00
therealyingtong cf4c982483 zcash_primitives::zip32: Include test vectors for internal key components. 2022-02-02 10:33:44 -07:00
Kris Nuttycombe 9c2d485c80 Address comments from code review.
Co-authored-by: str4d <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-02-02 10:33:41 -07:00
Kris Nuttycombe 3d51c53d68 Address comments from code review.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-02-02 10:32:33 -07:00
Kris Nuttycombe 8916a16f38 Replace ripemd160 dependency with ripemd 2022-02-02 10:30:43 -07:00
Jack Grigg d7fe28ac3f zcash_primitives: Update ZIP 244 with coinbase fix
This corresponds to the ZIP 244 changes in zcash/zips#587.

Closes zcash/librustzcash#485.
2022-02-01 15:57:39 +00:00
Jack Grigg f28f0b7476 Merge branch 'non-consensus-changes-on-branchid-37519621' 2022-02-01 15:57:13 +00:00
Kris Nuttycombe b3fbf2410d Allow use of internal deprecated pubkey_to_address method. 2022-01-27 21:21:18 -07:00
Kris Nuttycombe 2f1d3da26d Update changelogs. 2022-01-27 16:25:01 -07:00
Kris Nuttycombe 4057b066bd ExtendedFullViewingKey::chain_code should not be public. 2022-01-27 16:18:26 -07:00
Kris Nuttycombe 6e11f2d11a Validate ZIP 321 request by roundtrip through the URI format.
Co-authored-by: str4d <jack@electriccoin.co>
2022-01-27 16:08:04 -07:00