Commit Graph

346 Commits

Author SHA1 Message Date
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