Commit Graph

1072 Commits

Author SHA1 Message Date
Daira-Emma Hopwood 86428c4afe Refactor `find_account_for_transparent_output` (now called
`find_account_for_transparent_address`) to take a `TransparentAddress`
rather than a `WalletTransparentOutput`.

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-04 19:48:54 +01:00
Daira-Emma Hopwood a01588bc65 Ensure that `mark_ephemeral_address_as_mined` correctly handles indices
within the gap. Also support paging for `get_known_ephemeral_addresses`.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-04 19:48:54 +01:00
Daira-Emma Hopwood e97da43409 Refactoring to address review comments.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-04 05:24:32 +01:00
Daira-Emma Hopwood b63ff5bfcd Rename `get_reserved_ephemeral_addresses` to `get_known_ephemeral_addresses`
and change the `TransparentAddressMetadata` in its result map to not be
optional.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-04 05:24:32 +01:00
Daira-Emma Hopwood 01ff201ffb Minor changes responding to review comments.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-04 05:24:32 +01:00
hattizai 2244e0ff77 remove duplicate words 2024-07-03 11:01:40 +08:00
Daira-Emma Hopwood 3922d71ade Change the type of `n` in `reserve_next_n_ephemeral_addresses` back to `u32`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-28 20:59:12 +01:00
Daira-Emma Hopwood 38296634d9 Change note selection query to select notes > 5000 zats, not >= 5000 zats.
Also the issue reference was wrong.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-28 19:03:11 +01:00
Daira-Emma Hopwood f0e5aab692 Improve discrimination of proposal errors.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-28 17:47:08 +01:00
Daira-Emma Hopwood ec4a6d0cad Documentation improvements.
Co-authored-by: Jack Grigg <thestr4d@gmail.com>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-28 17:47:08 +01:00
Daira-Emma Hopwood 6471d4c27a Don't assume that prior step outputs are ephemeral iff they are
`StepOutputIndex::Change`.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-28 17:47:08 +01:00
Daira-Emma Hopwood 0735390546 Rename `amount` to `transfer_amount` in `send_multi_step_proposed_transfer`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-27 01:43:09 +01:00
Daira-Emma Hopwood bd6c9f3599 Apply documentation suggestions from code review.
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-27 01:43:09 +01:00
Daira-Emma Hopwood 7fb355739e Implement `WalletRead::get_transparent_address_metadata` for
`zcash_client_sqlite` using direct database queries.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-27 01:43:09 +01:00
Daira-Emma Hopwood 5a90fffed4 Factor out the conversion of the `diversifier_index_be` field in the
`addresses` table to a `NonHardenedChildIndex`.

(This moves where a `diversifier_index_be` field of the wrong length would
be detected and so is not quite a no-op, but that shouldn't matter.)

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-27 01:43:09 +01:00
Daira-Emma Hopwood 4f43a01f83 Refactor transparent address metadata lookups. This is correct as-is but
will be simplified and made more efficient in subsequent commmits.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-27 01:43:09 +01:00
Daira-Emma Hopwood 745054ba69 `find_account_for_transparent_output` now searches unreserved ephemeral
addresses within the gap limit. This should make recording TXOs found at
these addresses via `WalletWrite::put_received_transparent_utxo` work
correctly.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood 914acb57ce Move most remaining code for wallet support of ephemeral addresses into
`zcash_client_sqlite::wallet::transparent::ephemeral`.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood e164b59329 Move most ephemeral address index handling into helper functions in
`zcash_client_sqlite::wallet::transparent::ephemeral`. Also report the
account id and index for `SqliteClientError::ReachedGapLimit`.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood 25f07da47d Add a constraint on the range of `ephemeral_addresses(address_index)`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood 994f6ff387 Change type of `n` in `reserve_next_n_ephemeral_addresses`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood 637ae925da Add a migration test for the `ephemeral_addresses` migration.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood 0f49daed5f `mark_ephemeral_address_as_mined` now prefers setting `mined_in_tx` to
the transaction mined at an earlier height, out of the newly observed
transaction and any already referenced one. This slightly reduces the
chance of unnecessarily reaching the gap limit too early in some corner
cases.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood 2f521d7873 If a change memo is supplied, it should not be used in the second step
of a ZIP 320 proposal.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood c6520cf6a6 Change the protobuf schema to explicitly specify whether a `ChangeValue`
is ephemeral.

This also fixes `try_into_standard_proposal` to allow decoding from the
protobuf representation into a proposal that uses references to prior
ephemeral transparent outputs, provided that the "transparent-inputs"
feature is enabled.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood eb8846162c Address review comment: `EphemeralIvk` should not implement `IncomingViewingKey`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood 549fe0b652 In `reserve_next_n_ephemeral_addresses`, exclude addresses observed in
unmined transactions from consideration when calculating the end of the
gap.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood 0f3de63ae1 Apply documentation suggestions from code review.
Co-authored-by: str4d <thestr4d@gmail.com>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Daira-Emma Hopwood 2fae4bb244 ZIP 320 implementation.
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Co-authored-by: Jack Grigg <str4d@electriccoin.co>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00
Kris Nuttycombe 9716617b55 Apply suggestions from code review
Co-authored-by: Jack Grigg <thestr4d@gmail.com>
Co-authored-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-24 14:50:29 -06:00
Kris Nuttycombe 10258b8443 zcash_client_sqlite: Address comments from code review. 2024-06-21 19:13:18 -06:00
Kris Nuttycombe 72d8df8e68 zcash_client_sqlite: Align handling of transparent UTXOs with that of shielded notes.
Co-authored-by: Daira-Emma Hopwood <daira@jacaranda.org>
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2024-06-21 19:13:18 -06:00
Kris Nuttycombe d92bf27bfc zcash_client_sqlite: Move transparent-inputs wallet methods into the `wallet::transparent` module. 2024-06-21 19:13:17 -06:00
str4d 5e4c4a03e5
Merge pull request #1433 from nuttycom/fix_migration_pragmas
zcash_client_sqlite: Fix handling of PRAGMA directives.
2024-06-20 00:56:02 +01:00
Andrew Arnott b075636e86
Add several tests 2024-06-19 17:41:45 -06:00
Andrew Arnott d27bf4fc12
Fix importing of UFVKs with fewer keys than possible 2024-06-19 17:41:37 -06:00
Kris Nuttycombe 1110f5d8fb
Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2024-06-19 16:50:20 -06:00
Kris Nuttycombe a452cf9669 zcash_client_sqlite: Fix handling of PRAGMA directives.
The `foreign_keys` pragma has no effect when used within a transaction,
so it should only be set at the top level. The `legacy_alter_table`
pragma should only be used in cases where its effect is explicitly
intended.
2024-06-19 15:16:18 -06:00
Daira-Emma Hopwood f0cf40543a Update tests in testing/pool.rs to use ZIP 317 fees.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-19 16:38:12 +01:00
Daira-Emma Hopwood 21d573122c `zcash_client_backend::{fixed,standard,zip317}::SingleOutputChangeStrategy`
now implement a different strategy for choosing whether there will be any
change, and its value. The aims are:

* Ensure that it is possible to create fully transparent transactions with
  no change (this will be needed for ZIP 320). The `InsufficientFunds`
  error in this case should have a `required` field that reflects the
  additional amount needed, according to the fee calculated without an
  extra change output.
* Avoid leaking information about note amounts in some cases: an adversary
  that knew the number of external recipients and the sum of their outputs
  was able to learn the sum of the inputs if no change output was present.
* Defend against losing money by using `DustAction::AddDustToFee` with a
  too-high dust threshold.
* Ensure that if a "change memo" is requested, there will always be a
  shielded change output in which to put it. Previously, this would not
  be the case when using `DustAction::AddDustToFee`.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-19 13:12:17 +01:00
Daira-Emma Hopwood dcf0187e52 Fix a typo in an error message.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:24:33 +01:00
Daira-Emma Hopwood 41c30ef44d "child index" -> "address index" where applicable.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:24:33 +01:00
Daira-Emma Hopwood 9881e811ea Miscellaneous documentation improvements.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:24:33 +01:00
Daira-Emma Hopwood 6d35583a4b Add `OutPoint::fake()` helper.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:03:22 +01:00
Daira-Emma Hopwood 2337f79484 Add `zcash_keys::Address::Tex`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:03:22 +01:00
Daira-Emma Hopwood 6c90219817 Prefer the `PoolType::{SAPLING, ORCHARD, TRANSPARENT}` constants to
`PoolType::{Shielded(_), Transparent}`.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:03:22 +01:00
Daira-Emma Hopwood 3582f84686 Allow `ChangeValue::output_pool` to reference the transparent pool by
changing its type from `ShieldedProtocol` to `PoolType`.

Also fix compilation errors when the "orchard" feature is used without
the "transparent-inputs" feature.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:03:22 +01:00
Jack Grigg cf1922cdee zcash_client_sqlite: Move pinned views to `wallet::db` module 2024-06-18 19:21:03 +00:00
Jack Grigg 39bf4caa20 zcash_client_sqlite: Initial pass at documenting table structures
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2024-06-18 16:48:05 +00:00
Jack Grigg 3599c6afe7 zcash_client_sqlite: Move pinned indices to `wallet::db` module 2024-06-18 14:24:33 +00:00
Jack Grigg 9c98a649ee zcash_client_sqlite: Move pinned table structures to `wallet::db` module 2024-06-18 14:24:33 +00:00
Kris Nuttycombe 87e23081d0
Merge pull request #1421 from zcash/dep-bip32
Migrate from `hdwallet` to `bip32`
2024-06-17 17:04:14 -06:00
str4d 03fc64cfd0
Merge pull request #1396 from nuttycom/test/block_spanning_shards
`zcash_client_sqlite` Fix error related to commitment tree frontier insertions.
2024-06-17 19:29:44 +01:00
Kris Nuttycombe 3e090dca66 Apply suggestions from code review
Co-authored-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-17 11:40:47 -06:00
Andrew Arnott ce40387511
Add `import_account_hd` and `import_account_ufvk` methods 2024-06-17 08:57:39 -06:00
Jack Grigg f54ee4abde Migrate from `hdwallet` to `bip32`
As part of this, we migrate to `secp256k1 0.27`. This version does not
bump `secp256k1-sys`, so remains compatible with the `libsecp256k1`
revision used in `zcashd`.

The `zcash_primitives::legacy::keys::AccountPrivKey` encoding also
changes to preserve the transparent extended key metadata. Previously
the type was documented as such, but only encoded the private key and
chain code; the new encoding now matches the documentation. As a side
effect, the unstable encoding of `zcash_keys::keys::UnifiedSpendingKey`
also changes.

Closes zcash/librustzcash#1407.
Closes zcash/librustzcash#1408.
2024-06-15 00:04:37 +00:00
Kris Nuttycombe 3bc74b254b zcash_client_sqlite: Improve documentation for test setup functions. 2024-06-13 18:43:55 -06:00
Kris Nuttycombe e3956c3251 zcash_client_sqlite: Fix clippy complaint. 2024-06-13 18:09:52 -06:00
Kris Nuttycombe ecea9ca196 zcash_client_sqlite: Fix shardtree error caused by pruning after frontier insertion.
Fixes #1398
2024-06-13 18:09:46 -06:00
Kris Nuttycombe de66c5b154 zcash_client_sqlite: Add test to reproduce incomplete penultimate subtree error. 2024-06-13 18:09:39 -06:00
Kris Nuttycombe 3db515e347 zcash_client_sqlite: Allow multi-output fake blocks to send to multiple keys. 2024-06-12 16:36:20 -06:00
Kris Nuttycombe c88cd17929 zcash_client_sqlite: Add multiple output capability to fake compact block construction.
Many important test scenarios for note commitment tree structure require
the use of blocks that contain multiple notes.
2024-06-12 16:34:37 -06:00
Daira-Emma Hopwood db7ae25d7e Allow compiling with "orchard" and without "transparent-inputs".
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-12 14:51:29 +01:00
Daira-Emma Hopwood 4cd96f30a1 Fix clippy lints exposed by the MSRV bump to 1.70.0.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-12 14:51:29 +01:00
Jack Grigg bffe6a4a10 Bump MSRV to 1.70 2024-06-12 10:58:17 +00:00
Daira-Emma Hopwood aa77be8830 Update dependencies (including to avoid a vulnerability warning for atty), bump MSRV to 1.66,
and fix new clippy lints for MSRV 1.66.

* tonic 0.10 -> 0.11
* tonic-build 0.10 -> 0.11
* cargo update
* cargo update -p home@0.5.9 --precise 0.5.5
* cargo update -p prost-build@0.12.4 --precise 0.12.3
* cargo update -p prost-types@0.12.4 --precise 0.12.3
* cargo update -p prost@0.12.4 --precise 0.12.3
* cargo update -p prost-derive@0.12.5 --precise 0.12.3
* cargo update -p half@2.4.1 --precise 2.2.1

(The precise updates avoid a further MSRV bump to 1.70.)

Remaining duplicates are currently unavoidable.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-05-20 13:35:27 +01:00
str4d 5c6a6a4c86
Merge pull request #1143 from nuttycom/crate_zip321
Extract `zip321` crate from `zcash_client_backend`
2024-04-22 22:46:09 +01:00
Kris Nuttycombe d2aa6cfc7f Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2024-04-22 14:41:50 -06:00
Kris Nuttycombe aeac544aed Address comments from code review. 2024-04-22 10:55:25 -06:00
Kris Nuttycombe a7de8a3dba Release zcash_client_sqlite version 0.10.3 2024-04-08 13:24:42 -06:00
Kris Nuttycombe f7c29f0111 zcash_client_sqlite: Fix the broken `account_birthday` query. 2024-04-05 18:21:11 -06:00
Kris Nuttycombe 20e8bca8d9 zcash_client_sqlite: Add a test demonstrating the broken `account_birthday` query. 2024-04-05 16:56:54 -06:00
Kris Nuttycombe b60600a4c3 zcash_client_sqlite: Use `ZcashAddress` for persistence of sent note addresses
Prior to this change, the recipient of a sent transaction would always
be shown as the protocol-level address, instead of any unified address
intended as the recipient. Now, instead of reencoding the recipient
address, we use the original `ZcashAddress` value from the payment
request.
2024-04-05 16:48:13 -06:00
Kris Nuttycombe 86e1181259 zip321: Make `Payment` fields private. 2024-04-05 16:30:31 -06:00
Kris Nuttycombe 3ea7d84183 zcash_client_backend: Update to use extracted `zip321` crate 2024-04-05 16:25:21 -06:00
str4d 023e3cad4c
Merge pull request #1337 from nuttycom/fix_suspicious_account_query
zcash_client_sqlite: Fix sloppy named-parameter reference.
2024-04-01 21:48:09 +01:00
Kris Nuttycombe bdd0990db2 zcash_client_sqlite: Use named column accessors for `to_spendable_note` 2024-04-01 13:49:40 -06:00
Kris Nuttycombe 9bd97814db zcash_client_sqlite: Use named column references in `to_unspent_transparent_output` 2024-04-01 12:19:54 -06:00
Kris Nuttycombe e618d80cde zcash_client_sqlite: Fix sloppy named-parameter reference. 2024-04-01 12:19:49 -06:00
Kris Nuttycombe 55895b85b5 zcash_client_sqlite: Add a test for multiple-account retrieval. 2024-04-01 12:19:48 -06:00
Kris Nuttycombe c34b68204d zcash_client_sqlite: Add a migration to ensure that default addresses have an Orchard receiver. 2024-03-29 11:53:28 -06:00
Kris Nuttycombe a58355f697 zcash_client_backend: Add a failing test for note selection error. 2024-03-27 14:58:12 -06:00
Jack Grigg bea4097ded zcash_client_sqlite 0.10.2 2024-03-27 11:05:26 -04:00
Jack Grigg 5462f84676 zcash_client_sqlite: Fix column name in UTXO query
Closes zcash/librustzcash#1326.
2024-03-27 13:49:20 +00:00
Jack Grigg 020305fd20 zcash_client_sqlite: Add tests that hit zcash/librustzcash#1326. 2024-03-27 13:49:15 +00:00
Kris Nuttycombe da3869a576 Release zcash_client_sqlite 0.10.1 2024-03-25 20:00:48 -06:00
Kris Nuttycombe 4464e06616 zcash_client_sqlite: Permit either sent note recipient address or recipient account to be null, but not both. 2024-03-25 20:00:48 -06:00
Kris Nuttycombe 366d5d7434 Release zcash_client_sqlite version 0.10.0
Closes #1126
2024-03-25 14:11:11 -06:00
Kris Nuttycombe 777adb871d Release zcash_client_backend version 0.12.0
Closes #1079
2024-03-25 14:03:42 -06:00
Kris Nuttycombe 304e5659fc
Merge pull request #1312 from zcash/avoid_dust_note_selection
zcash_client_sqlite: Disallow selection of dust notes.
2024-03-25 13:45:17 -06:00
Kris Nuttycombe bda72e36eb Put expensive tests behind an additional `expensive-tests` feature flag. 2024-03-25 13:27:42 -06:00
Kris Nuttycombe 0d8f5692df zcash_client_sqlite: Disallow selection of dust notes.
At present, we don't take builder padding rules into account in the
determination of whether or not we can include spends of dust notes in
grace actions. It's too complex to attempt a complete fix for Zashi 1.0,
but we can have a tolerable workaround for launch by just never
selecting dust-valued notes.

This is a temporary solution; opened #1316 to track the resolution.
2024-03-25 13:01:45 -06:00
Kris Nuttycombe 1719b0186c zcash_client_sqlite: Don't overwrite `account_id` with nulls in `put_sent_output`. 2024-03-25 12:42:43 -06:00
Kris Nuttycombe 4ba7fbd977 zcash_client_sqlite: Clarify `TransferType` matches in `store_decrypted_tx` 2024-03-25 11:55:06 -06:00
Kris Nuttycombe 151e6e526e zcash_client_backend: Track external addresses in inter-account transactions.
Previously, if the funding account for a received transaction output was
determined to be an account known to the wallet, the output was recorded
as though it were sent to an internal (change) address of the wallet.
2024-03-25 07:59:21 -06:00
Kris Nuttycombe 404132bce5 zcash_client_sqlite: Use `get_funding_account` to determine whether an output is recorded as sent. 2024-03-25 07:59:21 -06:00
Kris Nuttycombe 7e7dba8020 zcash_client_sqlite: Add `get_funding_accounts` method. 2024-03-25 07:59:20 -06:00
Kris Nuttycombe e22cf68a4a zcash_client_sqlite: Fix `birthday_in_anchor_shard` tests. 2024-03-24 17:02:23 -06:00
Kris Nuttycombe 81954e2a65 zcash_client_sqlite: Fix `invalid_chain_cache_disconnected` tests. 2024-03-24 17:02:23 -06:00
Kris Nuttycombe e67a978ff9 zcash_client_sqlite: Use account birthday subtree sizes for progress.
This also fixes the `update_chain_tip_stable_max_scanned` tests.
2024-03-24 17:02:23 -06:00
Kris Nuttycombe 9c9bd40549 zcash_client_sqlite: Fix balance in expired unmined transaction history.
Fixes #1292
Fixes #1299
2024-03-24 17:02:23 -06:00
Kris Nuttycombe 874d6b608b zcash_client_backend: Ensure checkpoint at the end of each block.
This fixes an error wherein a note commitment in the last note
commitment position in a block was not being correctly marked as a
checkpoint.

This would occur when a block contained both Sapling and Orchard note
commitments, but the final transaction in the block contained only
either Sapling or Orchard note commitments, but not both.

Fixes #1302
2024-03-24 11:50:12 -06:00
Kris Nuttycombe 635057d86f zcash_client_sqlite: Avoid attempting to re-create already-pruned checkpoints. 2024-03-23 08:37:59 -06:00
Kris Nuttycombe 5d3ddabe24 zcash_client_sqlite: Add a test to attempt to simulate the checkpoint conflict bug (not failing.) 2024-03-23 08:37:59 -06:00
Kris Nuttycombe f3c8b58784 Minor internal variable renaming for clarity. 2024-03-22 09:14:08 -06:00
Kris Nuttycombe 6f1e4aff1a zcash_client_sqlite: Fix tests that broke with the addition of Orchard UA receivers. 2024-03-21 21:15:28 -06:00
Kris Nuttycombe cb218ad5ac
Merge pull request #1297 from nuttycom/sqlite_wallet/branching_chain_test_fixes
Fix update_chain_tip_unstable_max_scanned tests.
2024-03-21 12:08:37 -06:00
Kris Nuttycombe 5298ae22d2 zcash_client_sqlite: Fix update_chain_tip_unstable_max_scanned tests. 2024-03-21 09:27:15 -06:00
Kris Nuttycombe dc4fccf566 zcash_client_sqlite: Modify `TestState` to allow initialization with chain state. 2024-03-20 20:43:49 -06:00
Kris Nuttycombe 978f838aae zcash_client_sqlite: Add `testing::TestAccount` struct. 2024-03-20 10:08:36 -06:00
Jack Grigg 7bcf10b44b zcash_client_sqlite: Include Orchard receiver in default UA for new accounts 2024-03-20 00:28:40 +00:00
Kris Nuttycombe 4f7c5bd722 zcash_client_sqlite: Fix `scan_complete` tests. 2024-03-19 16:11:57 -06:00
Jack Grigg 3c1e82a0c8 zcash_client_sqlite: Add missing feature flags to error helper fn 2024-03-19 17:53:41 +00:00
Jack Grigg 3090aff87f Distinguish seed relevance when no derived accounts are present
During wallet migration in particular, the absence of _any_ accounts is
expected, and all seeds should be treated as relevant (because accounts
cannot be added before a wallet is initialized).
2024-03-19 17:53:41 +00:00
Jack Grigg 4fa0547b84 zcash_client_sqlite: Always check for seed relevance in `init_wallet_db`
Closes zcash/librustzcash#1283.
2024-03-19 00:34:28 +00:00
Jack Grigg e6bc21b461 Add `WalletRead::is_seed_relevant_to_any_derived_accounts` 2024-03-19 00:34:28 +00:00
Jack Grigg 8c7f8d07ba zcash_client_sqlite: Fix bug in `WalletDb::validate_seed`
The previous implementation was mixing the caller-provided seed with the
wallet-provided ZIP 32 account index, and throwing an error if the USK
derivation failed. We instead need to count that as a mismatch, because
the wallet account's actual seed would derive a USK fine (because wallet
accounts are required to have a known UIVK).
2024-03-19 00:34:28 +00:00
Jack Grigg 2d8a7dc4af zcash_client_sqlite: Remove `SqliteClientError::InvalidNoteId` 2024-03-19 00:34:28 +00:00
Jack Grigg c67b17dc96 zcash_client_sqlite: Extract `seed_matches_derived_account` helper 2024-03-19 00:34:28 +00:00
Jack Grigg 703e50ae03 Add `Account::uivk`
The blanket `impl Account<A> for (A, Option<UnifiedFullViewingKey>)` is
removed because we cannot know the UIVK for `(A, None)`. We instead
provide a blanket impl for `(A, UnifiedIncomingViewingKey)`. We also
move both of them behind `test-dependencies` because they are only
intended for testing purposes.
2024-03-19 00:34:28 +00:00
Jack Grigg 85d79fbb8a zcash_client_sqlite: Distinguish "seed not relevant" in migration errors 2024-03-19 00:32:35 +00:00
str4d da64e8aa5d
Merge pull request #1272 from nuttycom/account_source
zcash_client_backend: Rename `AccountKind` to `AccountSource`
2024-03-18 17:59:17 +00:00
Kris Nuttycombe 273712bad0
Merge pull request #1245 from AArnott/uivk
Add `UnifiedIncomingViewingKey` struct
2024-03-18 08:57:04 -06:00
Jack Grigg 8b8757ce65 zcash_client_sqlite: Fix ambiguities in transaction views
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2024-03-15 13:10:18 -06:00
Kris Nuttycombe ab3e790bfc zcash_client_backend: Rename `AccountKind` to `AccountSource` 2024-03-15 09:28:35 -06:00
Kris Nuttycombe 6102e83b07 Merge remote-tracking branch 'upstream/main' into uivk 2024-03-14 18:21:34 -06:00
Kris Nuttycombe 46fd6ab0fe zcash_client_backend: Make `WalletRead::get_transaction` return `Result<Option<Transaction>, _>`
This should never have had the behavior of returning an error on a
missing txid in the first place; doing so conflates database corruption
or connectivity errors with the ordinary case where data may not be
available.
2024-03-14 17:38:51 -06:00
Kris Nuttycombe cc990b60e0 zcash_keys: Remove HdSeedFingerprint as it duplicates `zip32::fingerprint::SeedFingerprint` 2024-03-14 17:09:03 -06:00
Kris Nuttycombe 9e1a4327c3 zcash_keys: Keep the Ufvk and Uivk encodings private. 2024-03-14 17:03:03 -06:00
Andrew Arnott 9ddbf1e3e9
Implement todo! line 2024-03-14 15:21:46 -06:00
Kris Nuttycombe 4d9927b993 zcash_keys: Verify the ability to derive addresses at USK and UFVK construction. 2024-03-14 11:26:16 -06:00
Kris Nuttycombe 9d6a8b6941 zcash_keys: Use `DecodingError` instead of `DerivationError` for key parsing. 2024-03-13 20:14:43 -06:00
Kris Nuttycombe 0bae47b05b zcash_client_backend: Improve API ergonomics for input selection. 2024-03-13 19:33:06 -06:00
Andrew Arnott 1770c2ec5f
Merge remote-tracking branch 'upstream/main' into uivk 2024-03-13 19:28:50 -06:00
str4d 2e0a3005de
Merge pull request #1268 from nuttycom/sqlite_wallet/cross_pool_note_selection
zcash_client_backend: Fix note selection & add more multi-pool tests.
2024-03-14 01:12:42 +00:00
Andrew Arnott c99338a7a1
Merge new error type into existing one 2024-03-13 18:59:41 -06:00
Kris Nuttycombe a81e7ff306 zcash_client_backend: Fix note selection & add more cross-pool tests. 2024-03-13 18:44:36 -06:00
Jack Grigg b161472cc0 zcash_client_sqlite: Rename `account_type` column to `account_kind` 2024-03-13 21:06:30 +00:00
Jack Grigg bbb7f36e55 zcash_client_backend: Add `WalletRead::get_account` 2024-03-13 21:00:59 +00:00
Jack Grigg 64aabdc54a Rename `WalletRead::get_seed_account` to `WalletRead::get_derived_account` 2024-03-13 21:00:59 +00:00
Jack Grigg 5f3d5e9f4a zcash_client_sqlite: Use `wallet::Account` for `WalletRead::Account` 2024-03-13 21:00:59 +00:00
Jack Grigg 65093487c3 zcash_client_backend: Expose the kind of an `Account` 2024-03-13 21:00:59 +00:00
Jack Grigg bc6aa955ff zcash_client_sqlite: Refactor `wallet::Account` to be a struct 2024-03-13 21:00:59 +00:00
Jack Grigg 634ebf51ef Reorder `WalletRead` and `WalletWrite` trait methods for clarity 2024-03-13 16:00:32 +00:00
Andrew Arnott 27eba4e578
Merge remote-tracking branch 'upstream/main' into uivk 2024-03-13 09:43:09 -06:00
Kris Nuttycombe d80782a739 zcash_client_sqlite: Move tests that require fixes to the test framework behind the `orchard` flag. 2024-03-12 18:27:02 -06:00
Kris Nuttycombe c4b2108685 zcash_client_sqlite: Fix `block_fully_scanned` test. 2024-03-12 18:14:16 -06:00
Kris Nuttycombe f58263e211 zcash_client_backend: Require the tree state for the start of each scanned range.
In order to support constructing the anchor for multiple pools with a
common anchor height, we must be able to checkpoint each note commitment
tree (and consequently compute the root) at that height. Since we may
not have the information in the tree needed to do so, we require that it
be provided.

As a bonus, this change makes it possible to improve the UX around
spendability, because we will no longer require subtree ranges below
received notes to be fully scanned; the inserted frontier provides
sufficient information to make them spendable.
2024-03-12 18:14:11 -06:00
Kris Nuttycombe c967bb8b39 Remove stray dbg! calls 2024-03-12 18:08:58 -06:00
Kris Nuttycombe 0c5a365c60 zcash_client_sqlite: Update to make use of `orchard::note::Rho` 2024-03-12 17:28:10 -06:00