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
Kris Nuttycombe
79f5bb411c
zcash_client_sqlite: Add index verification to `verify_schema`
2024-03-12 11:50:01 -06:00
Kris Nuttycombe
328e854202
zcash_client_sqlite: Ensure uniqueness of (hd_seed_fingerprinte, hd_account_index) pairs.
2024-03-12 11:45:35 -06:00
Kris Nuttycombe
33e943d14a
zcash_client_backend: Add `WalletRead::get_seed_account`
2024-03-12 11:21:04 -06:00
Kris Nuttycombe
5e810d3689
Merge pull request #1258 from nuttycom/sqlite_wallet/fuzzy_key_matching
...
Return partial matches when using `WalletRead::get_account_for_ufvk`.
2024-03-12 11:12:34 -06:00
Kris Nuttycombe
5a2897061c
Apply suggestions from code review
...
Co-authored-by: str4d <thestr4d@gmail.com>
2024-03-12 10:34:00 -06:00
Kris Nuttycombe
2eb5061eb1
zcash_client_sqlite: Ensure that truncation is applied to the Orchard note commitment tree.
2024-03-12 10:34:00 -06:00
Kris Nuttycombe
7cfaa422bc
Apply error message suggestion from code review.
...
Co-authored-by: str4d <thestr4d@gmail.com>
2024-03-12 10:04:27 -06:00
Kris Nuttycombe
09181f458c
zcash_client_sqlite: Return a backend-specific `Account` type from get_account_by_ufvk.
2024-03-12 08:59:53 -06:00
Kris Nuttycombe
a0bd257124
zcash_client_sqlite: Return partial matches when using `WalletRead::get_account_for_ufvk`
2024-03-12 08:59:53 -06:00
Andrew Arnott
071d7c51d7
Add `UnifiedIncomingViewingKey` struct
...
Also update sqlite to utilize the new struct
2024-03-12 06:37:20 -06:00
Jack Grigg
d68a01a221
Fix typos
2024-03-11 19:00:26 +00:00
Jack Grigg
8e09b78ca1
zcash_client_sqlite: Call `mark_orchard_note_spent` in `WalletDb::store_sent_tx`
2024-03-11 18:58:09 +00:00
Jack Grigg
6601820a2a
zcash_client_sqlite: Add Orchard support to `truncate_to_height`
2024-03-11 18:58:09 +00:00
Kris Nuttycombe
820b1f9c2d
zcash_client_sqlite: Factor out common note selection code.
2024-03-11 18:58:09 +00:00
Kris Nuttycombe
cad174c1d7
zcash_client_sqlite: Make note selection queries consistent between Sapling and Orchard.
2024-03-11 18:58:09 +00:00
Kris Nuttycombe
6086774b9b
zcash_client_sqlite: Ensure that we only exclude the correct notes from selection.
2024-03-11 18:58:09 +00:00
Jack Grigg
44f5a55b92
zcash_client_sqlite: Add Orchard support to `get_received_memo`
2024-03-11 18:58:09 +00:00
Jack Grigg
a1a8af01d3
zcash_client_sqlite: Add Orchard support to `get_wallet_summary`
2024-03-11 18:58:09 +00:00
Kris Nuttycombe
ac7113c721
zcash_client_sqlite: Get the minimum of Sapling and Orchard anchor heights for the anchor.
2024-03-11 18:58:09 +00:00
Kris Nuttycombe
021128b106
zcash_client_sqlite: Add Orchard note selection.
2024-03-11 18:58:09 +00:00
str4d
33be548f08
zcash_client_sqlite: Use preference order for z->t account matching
...
Co-authored-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-03-11 18:41:05 +00:00
Kris Nuttycombe
22ed9ebd35
zcash_client_sqlite: Ensure we identify the sending account in z->t transactions.
2024-03-11 17:49:44 +00:00
Kris Nuttycombe
8dfa836a03
zcash_client_sqlite: Use correct offsets for Orchard commitment positions.
2024-03-11 17:42:23 +00:00
Kris Nuttycombe
b62763d689
zcash_client_sqlite: Add Orchard note commitments in `put_blocks` and `put_block`
2024-03-11 17:34:43 +00:00
Kris Nuttycombe
1181566401
zcash_client_sqlite: Support Orchard scanning
2024-03-11 17:31:04 +00:00
Kris Nuttycombe
50f5df4c1d
zcash_client_sqlite: Implement `WalletDb::get_orchard_nullifiers`
2024-03-11 17:31:04 +00:00
Kris Nuttycombe
af4dce9912
zcash_client_sqlite: Implement `wallet::orchard::put_received_note`
2024-03-11 17:31:04 +00:00
Kris Nuttycombe
ae9dd25525
zcash_client_sqlite: Add `orchard_received_notes` table and update related views.
2024-03-11 16:35:01 +00:00
Kris Nuttycombe
374ed8cf94
zcash_client_sqlite: Add backend impl for the Orchard note commitment tree
2024-03-11 16:35:01 +00:00
Kris Nuttycombe
de58b5a5b1
zcash_client_sqlite: Add a failing test of cross-pool transfer
2024-03-11 11:36:35 +00:00
Kris Nuttycombe
99b3d3c997
zcash_client_sqlite: Generalize chain tests.
2024-03-11 10:27:54 +00:00
Kris Nuttycombe
02562187af
zcash_client_sqlite: Make scan_cached_blocks_detects_spends_out_of_order a common single-pool test
2024-03-11 10:27:54 +00:00
Jack Grigg
993102e803
zcash_client_sqlite: Fix `test_with_nu5_birthday_offset` tree setup
2024-03-10 21:47:40 +00:00
Jack Grigg
799574590e
zcash_client_sqlite: Fix more test seeds to use valid lengths
2024-03-10 21:47:40 +00:00
Jack Grigg
2a81156520
zcash_client_sqlite: Fix balance APIs in `TestState` to include Orchard
2024-03-10 21:47:40 +00:00
Jack Grigg
6898dbf094
Replace `unstable-nu6` and `zfuture` feature flags with cfg flags
...
Neither of these should have been feature flags, as they gate breaking
changes to the Zcash consensus rules (and in some ways are incompatible
with each other), while feature flags should be additive.
2024-03-10 18:42:39 +00:00
Jack Grigg
75c5f31ab0
zcash_client_sqlite: Use a seeded RNG in `TestState`
...
This makes individual instances of `TestState` deterministic, which
helps with debugging.
2024-03-10 01:10:50 +00:00
Jack Grigg
390b536950
zcash_client_sqlite: Use `LocalNetwork` for testing
...
This enables us to activate Sapling and NU5 at the same height, to
simplify reuse of test logic between Sapling and Orchard.
As a side-effect, `zcash_extensions` is removed from the workspace
because it enables the `zfuture` feature flag unconditionally, which
breaks workspace-level builds because this causes the `zfuture` feature
flag on `zcash_protocol` to be enabled without the corresponding feature
flag on `zcash_client_sqlite` being enabled. We will fix this by moving
from feature flags to config flags for unstable features.
2024-03-10 01:10:28 +00:00
Jack Grigg
798d9154b8
zcash_client_sqlite: Use a valid length for test seeds
2024-03-09 21:12:37 +00:00
Jack Grigg
a0b517a93a
zcash_client_sqlite: Add `OrchardPoolTester`, run tests with Orchard
2024-03-09 20:44:19 +00:00
Jack Grigg
0891b5fd3a
zcash_client_backend: Correctly handle empty frontiers in test birthdays
2024-03-09 18:21:34 +00:00
Jack Grigg
f74c2304df
zcash_client_sqlite: Track Orchard commitment tree sizes in `TestState`
2024-03-09 18:06:20 +00:00
Jack Grigg
dd8808fd83
zcash_client_sqlite: Replace tuple with struct in `TestState`
2024-03-09 17:36:18 +00:00
Kris Nuttycombe
39c750312f
Merge pull request #1247 from zcash/zcs-pool-testing
...
zcash_client_sqlite: Generalise Sapling tests
2024-03-09 10:11:46 -07:00
Jack Grigg
9d40588a50
zcash_client_sqlite: Generalise `wallet::scanning` tests
2024-03-09 15:28:47 +00:00
Jack Grigg
399ae762b7
zcash_client_sqlite: Generalise `wallet::commitment_tree` tests
2024-03-09 15:20:43 +00:00