Commit Graph

529 Commits

Author SHA1 Message Date
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
Jack Grigg 1ea585fee9 zcash_client_backend 0.6.1 2022-12-06 08:18:34 +00:00
Jack Grigg 7e71cc5353 Add `tracing` spans to light client chain scanning
This enables downstream users to profile how much time is spent in each
of the main subcomponents of the current chain scanner.
2022-12-06 08:17:49 +00:00
Kris Nuttycombe 580f87dc3e
Merge pull request #701 from zcash/update-generated-protobufs
Update generated protobufs
2022-11-18 17:25:15 -07:00
Greg Pfeil 4b5086d51d Parse ZIP 321 URIs without query parameters
Fixes #707.
2022-11-17 18:44:36 -07:00
Greg Pfeil 29af0bcb29 Add a failing test for ZIP 321 URI without params 2022-11-17 17:10:21 -07:00
Jack Grigg 81f8f6a5a4 Update generated protobufs
`prost 0.11.2` added code formatting support, so the generated files now
better match what rustfmt produces.
2022-11-12 05:26:07 +00:00
Jack Grigg a583255d45 Document that `decrypt_and_store_transaction` always stores the tx
Closes zcash/librustzcash#497.
2022-11-11 22:11:59 +00:00
Jack Grigg 98dd130f3a zcash_client_backend 0.6.0 2022-11-11 20:47:21 +00:00
Jack Grigg c03ef4926a zcash_proofs 0.9.0 2022-11-11 20:39:36 +00: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 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
str4d 796b5a4fed
ZIP 317: Improve code comments 2022-11-11 00:58:31 +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
str4d 6f4a6aa00c
Merge pull request #695 from nuttycom/fix_clippy_lints
Fix clippy complaints about generated protobuf code.
2022-11-05 00:15:47 +00:00
Kris Nuttycombe fb8681adbb Ignore clippy lints in generated protobuf modules. 2022-11-04 14:14:56 -06:00
Kris Nuttycombe 18e61346cc Spend internal Sapling notes with the internal Sapling spending key. 2022-11-04 13:27:23 -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 9c894ebf3e Create per-protocol fees modules. 2022-11-03 15:07:14 -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
Jack Grigg 4d6e2bcf59 Merge pull request #642 from zcash/lightwalletd-grpc-bindings
zcash_client_backend: Add gRPC bindings behind feature flag
2022-11-03 05:32:29 +00:00
Jack Grigg 587e1fa60b Fix clippy lints related to `prost` API usage 2022-11-03 05:02:39 +00: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 17a4830c70 zcash_client_backend: Add gRPC bindings behind feature flag
The lightwalletd service file is sourced from:
  Git: https://github.com/zcash/lightwalletd
  Rev: ad5ecda5fbb5e12799f926b8cd785d54fdd250c8

Closes zcash/librustzcash#585.
2022-11-02 06:22:02 +00:00
Jack Grigg 379b703e6b zcash_client_backend: Switch from `protobuf 2` to `prost 0.11`
The latter is maintained by the Tokio developers, and has easy
integration with the `tonic` gRPC library which is actively maintained.
2022-11-02 06:21:38 +00: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 334383f363 Allow shielding from multiple taddrs within a single transaction. 2022-10-25 13:17:21 -06:00
Kris Nuttycombe efa95fcb39 Add `get_transparent_balances` to data api. 2022-10-25 12:53:54 -06: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
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
Jack Grigg b3dc323876 zcash_client_backend: Fix missing bound
In 47a0d0d2b7 `WalletWriteTransparent` was
merged into `WalletWrite`, including its associated type `UtxoRef`.
However, `shield_transparent_funds` placed a bound on this associated
type that was not moved to `WalletWrite`. This left the generic
parameter `U` unconstrained, which didn't cause a local failure because
the method has no local tests, but was immediately apparent when trying
to use the method in the mobile SDKs.
2022-10-14 20:45:35 +00:00
Kris Nuttycombe c773ea3b3e Make the internals of `WalletTransparentOutput` private. 2022-10-14 12:38:55 -06:00
Kris Nuttycombe 69791af92c Mark our utxos spent when we detect them as inputs to a transaction.
This modifies `decrypt_and_store_transaction` to check for inputs
to a transaction being decrypted that correspond to utxos known
to our wallet. For each such UTXO found, it is marked spent.
2022-10-14 10:40:43 -06:00
Kris Nuttycombe 47a0d0d2b7 Remove the `WalletReadTransparent` and `WalletWriteTransparent` extension traits.
These traits introduce a problem, in that constraints on a method cannot
be conditionally required based upon the presence or absence of a
feature flag. Instead, we make the methods previously introduced by
the removed traits present in all cases on the `WalletRead` and
`WalletWrite` traits, but ensure that their implementations return
an error if the caller attempts to use them in a wallet that has not
been configured with support for transparent inputs functionality.
2022-10-13 21:05:49 -06:00
Jack Grigg 8f068b3b71 zcash_note_encryption 0.2.0 2022-10-13 21:35:39 +00:00
Jack Grigg 8842de18cc Remove unused dependencies
These were mostly detected with `cargo-udeps`, for which I've also added
exclusions for the dependencies it can't detect are used in doc-tests.
2022-10-13 20:06:52 +00:00
Kris Nuttycombe f1f9465f37 Remove `received_by_account` field from WalletTransparentOutput
Due to how the wallets retrieved unspent transparent outputs from the
light wallet server, the account associated with a particular UTXO may
not be known by the light wallet. Instead of requiring the caller to
perform a separate lookup and match the address of the received UTXO
with a known account, it's simpler to perform this lookup internally at
the time of insertion or update.

In order to make this operation more efficient, the `addresses_table`
migration is modified to add a column to cache the transparent receiver
so that it may be used in the joins in the UTXO insert and update
operations.
2022-10-12 23:11:39 -06:00
Kris Nuttycombe f7a3b9bda3
Merge pull request #661 from nuttycom/wallet/spend_with_usk
Use unified spending keys for spends & shielding.
2022-10-12 12:15:34 -06:00
Kris Nuttycombe c3b6ef28c9
Merge pull request #647 from nuttycom/update_ua_test_vectors
Update unified address test vectors
2022-10-12 10:56:26 -06:00
Kris Nuttycombe 6893da3054
Update zcash_client_backend/src/keys.rs
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-10-12 09:19:44 -06:00
Kris Nuttycombe e666e69230 Address comments from code review. 2022-10-11 16:21:17 -06:00
Kris Nuttycombe 62e1f99eb0 Improve TransferType documentation. 2022-10-11 14:42:06 -06:00
Kris Nuttycombe fd1640c242 Update CHANGELOGs 2022-10-11 13:08:15 -06:00
Kris Nuttycombe 3c837381db Disallow invalid pool/address combinations with `Recipient`. 2022-10-11 12:52:44 -06:00
Kris Nuttycombe 56b2edd498 Simplify sqlite backend storage for sent notes & utxos.
The currently deprecated implementations of `insert_sent_utxo`,
`insert_sent_note`, `put_sent_utxo` and `put_sent_note` all store to the
same `sent_notes` table internally. Since there's no immediate plan to
change this arrangement, it's better to have a single pair of internal
`insert_sent_output` and `put_sent_output` methods instead.
2022-10-11 08:57:44 -06:00
Kris Nuttycombe ee9869bbeb Use declarative style for `decrypt_transaction` 2022-10-11 08:56:26 -06:00
Kris Nuttycombe 06e43a572a Track inputs sent to wallet-internal recipients.
Ensure that we're attempting trial-decryption with the internal IVK
and correctly track internal vs. external recipients in the wallet
database.
2022-10-11 08:56:22 -06:00
str4d 1dc3cfe724
Merge pull request #657 from nuttycom/wallet/upsert_utxos
Use upsert functionality for transparent UTXOs, rather than delete/repopulate.
2022-10-11 04:17:49 +01:00
Kris Nuttycombe bd8472535c Add a test for unified address derivation. 2022-10-07 20:37:39 -06:00
Kris Nuttycombe 34a7abd653 Update unified address test vectors
This updates unified address test vectors after
https://github.com/zcash-hackworks/zcash-test-vectors/pull/89
to check addresses across multiple diversifier indices, and also
removes the superfluous binary encoding of UA strings.
2022-10-07 19:50:32 -06:00
Kris Nuttycombe b6e263d259
Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-10-05 20:33:14 -06:00
Kris Nuttycombe c5b9219f00 Look up the account by the UFVK corresponding to the USK when spending. 2022-10-05 14:35:51 -06:00
Kris Nuttycombe b7cc038050 Use unified spending keys for spends & shielding. 2022-10-05 14:35:51 -06:00
Kris Nuttycombe 6df6fec860 Add utxo received_by_account data to WalletTransparentOutput
Also, this removes wallet::delete_utxos_above.
2022-10-04 13:34:52 -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 b3f13020ac zcash_client_backend: Remove direct ff dependency 2022-10-02 23:15:51 +01:00
Jack Grigg 035e53990c zcash_client_backend: Improve estimation of `rayon` spawned task size 2022-09-24 21:01:19 +00: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
Jack Grigg c98f04330d zcash_client_backend: Move heap tracking of batch tasks behind a trait
This enables the heap usage measurements to be conditionally enabled by
the `BatchRunner` user. Importantly, when heap usage measurements are
not enabled, the `DynamicUsage` bound on `Batch` is not required.

This refactor also fixes a bug in the prior implementation. We were
counting the heap usage of a task when it started to run, but the item
may have been in the `rayon` work-stealing queues for a non-negligible
period before then. We now count the heap usage immediately before
spawning the task into the `rayon` thread pool.
2022-09-24 17:20:55 +00:00
Jack Grigg fe258ca120 zcash_client_backend: Count `tags` in `impl DynamicUsage for Batch` 2022-09-24 13:06:04 +00:00
Jack Grigg 9a1d61cb4e zcash_client_backend: Only store successes in batch scanner
Previously we were sending an `Option<DecryptedNote>` from each `Batch`
back to its parent `BatchRunner`. However, this requires allocating
sufficient space in the channel to handle the case where every output
can be decrypted. In general this will not be the case, and we can
instead signal "nothing decrypted" by just dropping the channel sender.
This reduces the post-batch-scanning memory usage of `BatchRunner` from
being linear in the number of on-chain outputs, to being linear in the
number of outputs for the wallet.

Ported from zcash/zcash@f7f6c2070d.
2022-09-21 23:51:40 +00:00
Jack Grigg 533722b70e zcash_client_sqlite: Add dynamic memory usage tracking to `BatchRunner`
Ported from zcash/zcash@e88ea11055.
2022-09-21 23:38:44 +00: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
Kris Nuttycombe 3bc8627e2b
Merge pull request #637 from nuttycom/wallet/create_account
Add WalletWrite::create_account function
2022-09-14 14:30:34 -06:00
Kris Nuttycombe d086c57f2f Make init_accounts_table only permit sequential account identifiers.
Also, check to ensure that account creation does not exceed the
maximum account identifier value.
2022-09-14 13:55:31 -06:00
Kris Nuttycombe 75eb082203
Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-09-14 12:20:39 -06:00
Kris Nuttycombe d0062a87d4 Add WalletWrite::create_account function 2022-09-13 18:58:28 -06:00
Jack Grigg f7b7760051 zcash_client_backend: Add some typedefs for complex types 2022-09-13 21:58:32 +00: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 b5908dc964
Merge pull request #632 from nuttycom/data_api/get_next_address
Replace `get_address` with `get_current_address` and `get_next_available_address`
2022-09-12 18:43:38 -06:00
Kris Nuttycombe 03b0ff7e0a Replace `get_address` with `get_current_address` and `get_next_available_address`
This updates the data access API to provide diversified address
functionality. In order to support this change, the addresses table
is updated to store diversifier index information in big-endian order
to allow sorting by diversifier index, and account initialization
is updated to store the diversifier index accordingly. The currently
unreleased `addresses_table` migration is updated to reflect this
change.
2022-09-12 17:58:22 -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
Jack Grigg 7d404d2747 zcash_client_sqlite: Fix `WalletRead::get_address` return value
Previously it would return an error if the account identifier did not
correspond to a known account.
2022-09-08 18:49:41 +00:00
Jack Grigg a32714043b zcash_client_backend: Change `WalletRead::get_address` to return UA 2022-09-08 18:49:13 +00:00
Kris Nuttycombe 8439f1a4f7 Add binary encoding for unified spending keys.
This encoding is wallet-internal-only and is currently
guarded under the `unstable` feature flag.
2022-09-08 11:05:59 -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 4f5d757883 zcash_client_backend: Change to `WalletWrite::remove_unmined_tx`
This fixes a bug in the logic ported from the Android SDK: it was
possible to remove a transaction in the middle of a chain, which would
cause a long-spent note to become unspent and cause the wallet balance
to be over-counted. We now restrict transaction removal to unmined
transactions, which is sufficient for the Android SDK use cases.
2022-08-30 22:54:58 +00:00
Jack Grigg 586b7e5bb0 zcash_client_backend: Add `WalletWrite::remove_tx` method
This is to replace the database mutations in the Android SDK. It is
placed behind an `unstable` feature flag until we are satisfied that it
is suitable as a general-purpose API (or replace it).
2022-08-29 21:32:18 +00: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
Jack Grigg b42344d491 zcash_client_backend: Generate Orchard component for USKs
This ensures that the resulting UFVKs and UAs also contain Orchard
components.
2022-08-24 14:56:58 +00:00
Kris Nuttycombe 397c76ca8d Add tests for batched note decryption. 2022-08-18 16:48:52 -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 7acd47eae8 Copy parallel batch decryption data types from zcash/zcash
This is an unmodified copy of 7d1e14ac3d/src/rust/src/wallet_scanner.rs

Co-authored-by: str4d <jack@electriccoin.co>
2022-08-18 16:40:27 -06:00
str4d 85a1522c22
Merge pull request #607 from adityapk00/oa
Return orchard address from UA
2022-08-18 23:32:19 +01:00
Kris Nuttycombe 880076b38f Improve error reporting for address & viewing key decoding. 2022-08-18 10:15:58 -06:00
Aditya Kulkarni 1fad73d5b3 Return orchard address from UA 2022-08-17 08:10:06 -05:00
Kris Nuttycombe 199c49760b Use the new name rustdoc::broken_intra_doc_links 2022-07-29 15:56:44 -06:00
Kris Nuttycombe 8a6e979cb9 Change return type of ScanningKey::to_sapling_keys to an associated type. 2022-07-28 17:28:31 -06:00
Kris Nuttycombe 73314dc682 Use batch decryption in wallet scanning.
This modifies wallet scanning to perform per-block batched
decryption. It also alters the structure of the `ScanningKey`
trait to correctly include internal (change) keys in the scan
process.
2022-07-28 17:28:31 -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 878a428c3c Factor out witness updates from scan_output 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 09567fc280
Merge pull request #574 from nuttycom/fix_account_key_init
Fix account key init
2022-06-29 21:36:29 +01:00
Kris Nuttycombe 0e098e1f17 Test correctness of unknown ufvk element roundtrip encoding. 2022-06-29 10:13:22 -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
Kris Nuttycombe 7236204b14 Don't panic if the sapling key is missing from the UFVK
Instead, just skip Sapling decryption.

Also, a trivial namespacing fix.
2022-06-27 17:44:20 -06:00
Jack Grigg 6f4de16b97 zcash_proofs 0.7.0 2022-06-24 17:00:39 +00:00
Jack Grigg e952ff637e zcash_primitives 0.7.0 2022-06-24 17:00:39 +00:00
Jack Grigg 18fb1f0b07 orchard 0.2 2022-06-24 16:25:51 +00:00
Jack Grigg b52e949bd6 zcash_client_backend: Migrate to correct ZIP 316 UFVK encoding
We also add support for parsing Orchard full viewing keys from encoded
UFVKs (rather than treating them as unknown). `UnifiedSpendingKey` still
does not have Orchard support, so `UnifiedFullViewingKey`s will be
generated without Orchard components.
2022-06-17 10:03:17 +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 d8b860207d zcash_client_backend: Remove account from `UnifiedFullViewingKey`
The account number is not stored in the ZIP 316 UFVK encoding, and in
general won't necessarily be known (e.g. if a UFVK is being imported
into a wallet).

`zcash_client_sqlite::wallet::init::init_accounts_table` reverts to its
previous behaviour of requiring the provided `&[UnifiedFullViewingKey]`
to be indexed by account number.
2022-06-17 10:03:17 +00:00
Jack Grigg 1ce289e568 zcash_client_backend: Pass UFVKs into `decrypt_transaction` 2022-06-17 10:03:17 +00:00
Jack Grigg c0e8ee0fa0 zcash_client_backend: Return UFVKs from `WalletRead` instead of ExtFVKs 2022-06-17 10:03:17 +00:00
Jack Grigg 0d0527dbf3 zcash_client_sqlite: Store UFVK/UA instead of Sapling ExtFVK/address
This is a breaking change to the database format. We don't have support
for migrations yet, so existing wallets won't work after this commit
until zcash/librustzcash#489 is done.
2022-06-14 02:18:25 +00:00
Jack Grigg e86ba927af zcash_client_backend: Add a fake UFVK encoding
We can't use the real ZIP 316 encoding until `UnifiedFullViewingKey` has
been altered to not store a Sapling `ExtendedFullViewingKey`. But making
that change first requires fully migrating `zcash_client_sqlite` in the
same commit (as its entire API is built around `ExtendedFullViewingKey`).

Instead, we define a temporary fake encoding, to enable migrating the
`zcash_client_sqlite` APIs more incrementally.
2022-06-14 02:18:25 +00:00
Jack Grigg 97aee898b2 zcash_client_backend: Box `zip321::parse::Param::Addr`
After adding the `RecipientAddress::Unified` enum case, `Param::Addr`
is now much larger than the other `Param` cases. This change reduces the
size of the `Param` enum, fixing a clippy lint.
2022-06-13 23:04:18 +00:00
Jack Grigg 555a621a10 Add `UnifiedAddress` generation to `UnifiedFullViewingKey` 2022-06-13 23:04:18 +00:00
Jack Grigg ed6016857e zcash_client_backend: Add `RecipientAddress::Unified` 2022-06-10 17:16:59 +00:00
Jack Grigg f20366cf86 zcash_client_backend: Migrate `RecipientAddress` to `zcash_address` 2022-06-10 15:49:19 +00:00
Jack Grigg 1161fc963f zcash_proofs 0.6.0 2022-05-10 23:33:05 +00:00
Jack Grigg 3ecfd26d79 zcash_primitives 0.6.0 2022-05-10 23:33:05 +00:00
Jack Grigg a565c7e113 hdwallet 0.3.1
This release bumped secp256k1 to 0.21.
2022-05-10 23:00:43 +00:00
Jack Grigg 144512b547 Migrate to `ff 0.12` 2022-05-06 20:03:49 +00:00
Kris Nuttycombe 9416ab3a3e Update to secp256k1 v0.21 2022-04-06 16:09:45 -06: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
Kris Nuttycombe 600c06a408 Update MSRV to 1.56.1 2022-02-24 12:26:14 -07:00
str4d efe63ad62b
Merge pull request #515 from str4d/update-compact-proto
zcash_client_backend: Bring in latest `compact_formats.proto`
2022-02-18 00:59:42 +00:00
Jack Grigg cceae3ac34 zcash_client_backend: Address compact_formats.proto comments 2022-02-17 23:58:20 +00:00
Jack Grigg 18562c71dc zcash_client_backend: Bring in latest `compact_formats.proto`
Source: 83bb19918f/walletrpc/compact_formats.proto
2022-02-17 02:44:20 +00:00
Jack Grigg 511ad71a05 Bump `protobuf` to `~2.27.1`
`protobuf 2.26` raised its MSRV to 1.52.1, which we are now above.
`protobuf 2.27.0` raised its MSRV to 1.55.0, but this was reverted in
`protobuf 2.27.1`. In any case, it's clear this dependency bumps MSRV in
minor releases, so we should use tilde requirements for it.
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
Kris Nuttycombe e20de50b84 Make AccountId internal representation private. 2022-02-10 11:30:02 -07:00
Kris Nuttycombe a304c3953b Fix Clippy beta linting complaints. 2022-02-02 16:02:45 -07:00
Kris Nuttycombe 3699a6df97 Fix typos. 2022-02-02 14:00:05 -07:00
Kris Nuttycombe cdd899dda1 Fix documentation.
Co-authored-by: str4d <jack@electriccoin.co>
2022-02-02 12:53:59 -07:00
Kris Nuttycombe 6b189f18ff Correct the changelog relating to `store_decrypted_tx` 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 2dd0348792 Remove the `nullifiers` argument from `store_decrypted_tx`
This value can be obtained internally within the implementation
of `store_decrypted_tx` and does not need to be part of the
public API.
2022-02-02 10:32:35 -07:00
Kris Nuttycombe 41810e5be9 Merge remote-tracking branch 'upstream/non-consensus-changes-on-branchid-37519621' into autoshield-poc-daa 2022-02-02 10:32:35 -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 d0e1f98429 Use extension traits for transparent-related data api functionality. 2022-02-02 10:30:43 -07:00
Kris Nuttycombe e8e5d94ea6 Mark functions that will be made crate-private as deprecated 2022-02-02 10:29:19 -07:00