Commit Graph

48 Commits

Author SHA1 Message Date
Kris Nuttycombe 115d4b975e Don't rely on alignment between account IDs and keys when initializing the accounts table. 2022-06-29 10:13:13 -06: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
Kris Nuttycombe e20de50b84 Make AccountId internal representation private. 2022-02-10 11:30:02 -07:00
Kris Nuttycombe e8e5d94ea6 Mark functions that will be made crate-private as deprecated 2022-02-02 10:29:19 -07:00
Kris Nuttycombe f58d191439 Move transparent account keys to zcash_primitives. 2022-01-25 08:53:51 -07:00
Kris Nuttycombe 7d873e9d79 Fix test compilation errors related to UFVK construction. 2022-01-21 19:01:32 -07:00
Kris Nuttycombe ffc4d0cefb Add newtypes for transparent keys at the account & external levels.
This updates UnifiedFullViewingKey to conform to ZIP 316, and
adds types that facilitate this support. These types should likely
be factored out from `zcash_client_backend` into `zcash_primitives`
along with the remainder of the existing unified address support.
2022-01-20 20:03:20 -07:00
Kris Nuttycombe fc0dd8e3eb Merge remote-tracking branch 'upstream/master' into autoshield-poc-daa 2021-10-25 13:24:03 -06:00
Kris Nuttycombe 120cc70a6d Fix type of default_address 2021-10-11 16:34:37 -06:00
Kris Nuttycombe cc58a21ad7 Feature-flag transparent functionality in zcash_client_sqlite
This fixes the wasm32-wasi build issues by excluding the
hdwallet dependencies which are not wasm32-wasi compatible.
2021-10-04 16:53:55 -06:00
Kris Nuttycombe 6cf0749ac9 Merge remote-tracking branch 'upstream/master' into autoshield-poc-reorder 2021-10-01 11:03:41 -06:00
Kris Nuttycombe db89569b90 Address documentation & naming requests from code review. 2021-10-01 11:03:09 -06:00
Kris Nuttycombe 2053d7f57b Always take number of confirmations as a parameter. 2021-10-01 11:00:50 -06:00
Jack Grigg 65e1d32774 ff 0.11, group 0.11, etc. 2021-09-09 18:20:37 +01:00
Kris Nuttycombe b783c4d0e7 Merge remote-tracking branch 'upstream/master' into autoshield-poc-daa 2021-08-12 11:21:30 -06:00
Kris Nuttycombe 1a5aad723b Use generalized signature_hash for transaction builder. 2021-06-04 15:45:39 -06:00
Kris Nuttycombe 55d1090f70 Add v5 txid & signature hashing. 2021-06-04 15:45:39 -06:00
Kris Nuttycombe 84e8952ec3 Move Sapling components to a bundle within TransactionData 2021-06-03 18:46:38 -06:00
Kris Nuttycombe 4efb21d1c7 Make amount addition and subtraction traits use checked operations. 2021-06-01 07:03:31 -06:00
Kevin Gorham 8e16d93f94 Update accounts table create statement.
This PR makes the opinionated change that T-addrs are required
to be supported when using the zcash_client_sqlite backend.
2021-04-16 14:26:53 -06:00
Kris Nuttycombe a3bc1e3e63 Rename get_spendable -> get_unspent 2021-04-16 14:23:28 -06:00
Francisco Gindre cff457ff15 PoC Auto-Shielding
Add retrieval of transparent UTXOs to WalletRead

Co-authored-by: Kris Nuttycombe <kris@electriccoin.co>
Co-authored-by: Kevin Gorham <anothergmale@gmail.com>
2021-04-16 14:22:16 -06:00
Kris Nuttycombe fae1a1517a Simplify try_sapling_output_recovery. 2021-04-12 18:40:17 -06:00
Kris Nuttycombe 324fc36521 Use ShieldedOutput trait for note encryption/decryption.
This change modifies note encryption and decryption functions
to treat a shielded output as a single value instead of handling
the parts of an output as independent arguments.
2021-04-12 12:59:06 -06:00
Kris Nuttycombe 5baccdf052 Move note_encryption into the sapling module. 2021-04-08 08:19:10 -06:00
Jack Grigg 636845d0f9 Renames to use lower-case abbreviations (matching Rust convention)
As of our MSRV bump to 1.51.0, we get lints for this.
2021-03-27 19:01:03 +13:00
Kris Nuttycombe 4086df772c Move sapling-specific primitives into the sapling module. 2021-03-27 16:18:21 +13:00
Kris Nuttycombe 16948d9d78 Move zcash_primitives::prover to sapling module 2021-03-27 16:18:21 +13:00
Jack Grigg 55e73d7910 Fix clippy lints 2021-03-26 10:07:20 +13:00
Jack Grigg 7c8b29e693 zcash_client_sqlite: Add test that exposes the no-change bug 2021-03-24 18:46:55 +13:00
Kris Nuttycombe 98530184c0 Fix clippy complaints. 2021-02-03 14:27:31 -07:00
Kris Nuttycombe 8e8ed2bb4f Rename get_verified_balance -> get_balance_at 2021-01-15 12:00:14 -07:00
Kris Nuttycombe 6c6b05fa9b Trivial rename. 2021-01-12 21:32:46 -07:00
Kris Nuttycombe ce06db197a Rustfmt. 2021-01-12 21:10:34 -07:00
Kris Nuttycombe 011eda364f Add get_spendable_notes method to WalletRead 2021-01-12 20:42:04 -07:00
Kris Nuttycombe 48f226f8b5 Move decoding errors to sqlite crate.
Also move dependency on params out of wallet read/write methods.
The result is cleaner because these parameters are only required
for backend-specific encoding and decoding operations.
2021-01-12 20:07:02 -07:00
Kris Nuttycombe 7d92150965 Fix test compilation with WalletWrite changes. 2021-01-11 18:13:40 -07:00
Kris Nuttycombe 1fd74d0a71 Improve naming for wallet/block database connections. 2020-12-02 09:46:17 -07:00
Kris Nuttycombe 897a70dd9e Simplify block source & clean up chain validation. 2020-12-02 09:46:17 -07:00
Kris Nuttycombe 8a215d67fe Improve wallet "database" trait names. 2020-12-02 09:46:17 -07:00
Kris Nuttycombe f742895118 Fix test/doctest errors. 2020-12-02 09:46:17 -07:00
Kris Nuttycombe 2e2f34b033 Use named_params macro for query_and_then_named (less error-prone) 2020-12-02 09:46:17 -07:00
Kris Nuttycombe 4c2cda48e6 Clean up transactional API.
This API is still somewhat unsafe in that it doesn't inhibit nested
transactions, but it's better than it was.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe cd2729bbd0 Move 'create_spend_to_address' to wallet backend.
This required changing a bit about the relationship between
database errors and wallet errors, and opens up the possibility
of now simplifying the error situation a bit.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe e144015558 Reuse sent note insertion for wallet/transact. 2020-12-02 09:46:17 -07:00
Kris Nuttycombe 8de05f3429 Move transact.rs to wallet module. 2020-12-02 09:46:17 -07:00