Commit Graph

940 Commits

Author SHA1 Message Date
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
Jack Grigg d89b88126d zcash_client_sqlite: Generalise `wallet::sapling` tests
These are all "single shielded pool" tests, and should pass for any
shielded pool implemented in the wallet.
2024-03-09 15:20:40 +00:00
Kris Nuttycombe 19868af84a
Merge pull request #1246 from zcash/zcb-0.11-zcs-0.9-doc-fixes
`zcash_client_backend 0.11.1`, `zcash_client_sqlite 0.9.1` with doc fixes
2024-03-09 08:19:41 -07:00
Jack Grigg c6f1fdb73d zcash_client_sqlite 0.9.1 2024-03-09 11:39:38 +00:00
Jack Grigg 075a155a29 Remove `orchard` feature flag from docs.rs builds while not public 2024-03-09 11:37:25 +00:00
Kris Nuttycombe 5511bacf25 zcash_client_sqlite: Make sapling_received_notes.recipient_key_scope optional.
We will only consider notes spendable when both the UFVK & key scope are available.
2024-03-08 18:34:50 -07:00
Kris Nuttycombe e2ac746e9d zcash_client_sqlite: Generalize `ReceivedNoteId` 2024-03-08 16:43:06 -07:00
Kris Nuttycombe d55edd8dd8 zcash_client_sqlite: Deduplicate `WalletDb::get_sapling_nullifiers` 2024-03-08 16:41:51 -07:00
Kris Nuttycombe 7aacfc3bb0 zcash_client_sqlite: Extract general helpers from Sapling tree logic 2024-03-08 16:41:51 -07:00
Kris Nuttycombe c107f3df11 zcash_client_sqlite: Use errors instead of panics for unimplemented or unsupported down migrations. 2024-03-08 22:19:05 +00:00
Kris Nuttycombe 78e4916899 zcash_client_backend: Generalize `DecryptedOutput` to support Orchard 2024-03-08 13:48:30 -07:00
Kris Nuttycombe 4c5ce32dee zcash_client_backend: Use `NonNegativeAmount` for `select_spendable_notes` 2024-03-08 13:48:30 -07:00
Kris Nuttycombe 8f4de9b235
Merge pull request #1235 from zcash/diverse_accounts
zcash_client_sqlite: Rework accounts to support imported viewing keys
2024-03-08 13:39:08 -07:00
Jack Grigg bfc2278bfe Encode UIVK Sapling component with `sapling-crypto` 2024-03-08 20:22:45 +00:00
Jack Grigg 054b374b5a Add missing feature flag conditional 2024-03-08 19:08:20 +00:00
Jack Grigg f9bf5a173f bugfix: Encode transparent IVK in UIVKs instead of transparent FVK 2024-03-08 19:06:27 +00:00
Andrew Arnott 0c80893ce0 zcash_client_sqlite: Rework accounts to support imported viewing keys 2024-03-08 18:55:18 +00:00
Kris Nuttycombe 63450533dd
Merge pull request #1233 from zcash/test-harness-orchard-fvk
zcash_client_sqlite: Add Orchard support to test harness
2024-03-08 11:37:32 -07:00
Jack Grigg c8d03f69ef Extend `TestState::generate_next_block_spending` with Orchard support 2024-03-08 14:40:25 +00:00
Jack Grigg cc90c4c405 Avoid excessive Orchard dummies in `TestState::generate_next_block_spending` 2024-03-08 13:29:13 +00:00
Jack Grigg 6c6080c99c `impl TestFvk for orchard::keys::FullViewingKey` 2024-03-08 13:28:55 +00:00
Jack Grigg 0a41d65910 Generalise `TestState::generate_*` methods over a `TestFvk` trait 2024-03-08 00:02:28 +00:00
Jack Grigg 291a6f5799 Use correct change address in `TestState::generate_next_block_spending` 2024-03-07 23:26:43 +00:00
Jack Grigg bc0b1aed07 De-duplicate compact Sapling output creation in `TestState` 2024-03-07 23:26:43 +00:00
Jack Grigg f306a0a78a zcash_client_sqlite: Make internal testing functions module-private
This ensures we only access them through `TestState` in future.
2024-03-07 22:14:15 +00:00
Kris Nuttycombe 4532520670 zcash_client_backend: Add Orchard frontier to `AccountBirthday` 2024-03-07 14:45:23 -07:00
Kris Nuttycombe 8955cfc559 Add missing CHANGELOG entries. 2024-03-05 14:37:26 -07:00
Kris Nuttycombe 5675a76f0d zcash_protocol: Use `BalanceError` instead of `()` for monetary range violations. 2024-03-05 13:59:26 -07:00
Kris Nuttycombe 51d4464472 Remove `network_type` calls that are obviated by the blanket impl. 2024-03-05 13:36:15 -07:00
Kris Nuttycombe b8aa5132c2 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
Co-authored-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-03-05 13:36:15 -07:00
Kris Nuttycombe a823ed776f Expose address generation errors when constructing default addresses 2024-03-05 13:36:15 -07:00
Kris Nuttycombe 4b18426fcd zcash_address: Use `zcash_protocol::consensus::NetworkType`
This inverts the dependency relationship between `zcash_protocol` and
`zcash_address`, permitting the network constants (primarily the HRPs)
defined in `zcash_protocol` to be used directly in `zcash_address`
instead of being duplicated.
2024-03-05 13:36:15 -07:00
Kris Nuttycombe 5e4d9abbce Move `Amount` and `NonNegativeAmount` types to the `zcash_protocol` crate. 2024-03-05 09:45:24 -07:00
Kris Nuttycombe bacfe3cb9d Move `zcash_primitives::{consensus, constants}` to the `zcash_protocol` crate 2024-03-05 09:45:24 -07:00
Kris Nuttycombe e4c0b0e63f zcash_client_backend: Add `WalletRead::validate_seed`
This adds a mechanism that allows a caller to verify that a given seed
generates the viewing key that is stored in the wallet for a specified
account.

Fixes #1189
2024-03-04 10:59:56 -07:00
Jack Grigg dbdc88e4d7 Revert "Hide unstable `orchard` feature flag in rustdoc"
Now that the release commits are created, we can unhide this ahead of
the subsequent Orchard-supporting releases.

This reverts commit zcash/librustzcash@6161709441.
2024-03-01 01:17:15 +00:00
Jack Grigg 891ab1ca6d zcash_client_sqlite 0.9.0
Closes zcash/librustzcash#961.
2024-03-01 01:17:02 +00:00
Jack Grigg 6161709441 Hide unstable `orchard` feature flag in rustdoc
It is not part of the public API for `zcash_client_backend 0.11.0` and
`zcash_client_sqlite 0.9.0`.
2024-03-01 01:12:07 +00:00
Kris Nuttycombe 9ea027150a zcash_client_sqlite: Allow use of `zcash_client_backend::data_api::wallet::spend` in tests 2024-02-29 17:57:24 -07:00
Kris Nuttycombe a4b951d193 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2024-02-29 15:19:07 -07:00
Kris Nuttycombe 939cfcce70 zcash_client_sqlite: Temporarily hardcode an empty response for `get_orchard_nullifiers` 2024-02-29 12:06:25 -07:00
Kris Nuttycombe 27f6207a7c zcash_client_backend: Pass nullifiers separately from scanning keys. 2024-02-29 12:06:22 -07:00
Kris Nuttycombe 7e8723bea9 zcash_client_backend: Add Orchard support to batch scanning. 2024-02-29 12:04:53 -07:00
Kris Nuttycombe 880c24c45d zcash_client_backend: Generalize key source metadata. 2024-02-29 11:55:44 -07:00
Kris Nuttycombe 802c01002a zcash_client_backend: Rework scanning key identifiers.
In the process of making the internals of `scan_block_with_runner`
reusable across Sapling and Orchard, it became evident that key
identifier abstraction along the lines of #1175 is needed more
generally. This commit refactors the use of ZIP 32 account identifiers
and key scopes to better separate scanning concerns from ZIP 32 key
derivation. In the process, this removes a fair amount of unnecessary
polymorphism from `zcash_client_backend::wallet::WalletTx` and related
types.
2024-02-29 11:55:25 -07:00
Kris Nuttycombe 688c36166a Address comments from code review. 2024-02-29 07:50:31 -07:00
Kris Nuttycombe 41b050f1e9 zcash_client_backend: Make `AccountId` an associated type of `WalletRead`
This PR was extracted from https://github.com/zcash/librustzcash/pull/1175
in order to make the changes to `zcash_client_backend` usable without
the additional generalizations to `zcash_client_sqlite` made by that PR.

Co-authored-by: Andrew Arnott <andrewarnott@live.com>
2024-02-28 21:06:14 -07:00
Kris Nuttycombe 2a6330f2ea Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2024-02-23 09:16:26 -07:00
Kris Nuttycombe 9b98f46bf6 zcash_keys: Add `sapling` and `transparent-inputs` feature flags.
Fixes #1160
2024-02-23 09:16:25 -07:00
Kris Nuttycombe 184286c430 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2024-02-21 17:36:08 -07:00
Kris Nuttycombe 050a124cb6 Address comments from code review. 2024-02-21 11:55:00 -07:00
Kris Nuttycombe 4e3d99f1d0 zcash_client_backend: Allow proposer to specify fallback change pool.
In the event that the pool to which change should be sent cannot
automatically be determined based upon the inputs and outputs of a
transaction, it is up to the caller to specify where change should
be sent.
2024-02-15 21:44:59 -07:00
Kris Nuttycombe daf88a12e5 zcash_client_backend: Add support for creation of Orchard outputs. 2024-02-15 21:30:07 -07:00
Kris Nuttycombe f27f601b7d zcash_client_backend: Add Orchard spends to `create_proposed_transaction` 2024-02-15 21:29:15 -07:00
Kris Nuttycombe 74b487e4c9 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2024-02-15 20:51:24 -07:00
Kris Nuttycombe 6aabe60d21 zcash_client_backend: Add validation to the `Proposal::multi_step` constructor. 2024-02-15 13:09:52 -07:00
Kris Nuttycombe beeea7b44e zcash_client_backend: Modify `Proposal` to make multi-step transactions representable. 2024-02-14 19:30:52 -07:00
Kris Nuttycombe 1db3109cb4 zcash_client_backend: Move the `Proposal` types to a `proposal` module.
This separation is in preparation for modifying the `Proposal` type
to wrap a vector of proposal steps.
2024-02-14 19:04:47 -07:00
Kris Nuttycombe 7a5852598e zcash_keys, zcash_client_backend: feature-flag off transparent-input WalletRead methods.
This also moves the `TransparentAddressMetadata` type behind the
`transparent-inputs` feature flag and performs associated cleanup.
2024-02-14 17:38:52 -07:00
Andrew Arnott f1b6dd0636
Switch out `AddressMetadata` for new struct 2024-02-13 18:34:33 -07:00
Andrew Arnott 9f221f869d
Fail instead of swallow on database corruption 2024-02-13 11:39:06 -07:00
Andrew Arnott 918f5cc812
Change `WalletRead::get_transparent_receivers` signature
It needn't return the account id that was given as an input, and it shouldn't return an 11-byte diversifier index when a 31-bit child index is more appropriate.
2024-02-13 11:39:06 -07:00
Kris Nuttycombe 7c0b9da9b7 zcash_client_sqlite: Do not request transparent UA components if "transparent-inputs" feature is disabled. 2024-02-07 14:49:48 -07:00
Kris Nuttycombe 2360609f1a zcash_primitives: Rename `TransparentAddress` variants.
This resolves an old TODO.
2024-02-02 10:52:17 -07:00
Kris Nuttycombe 11f5589595 zcash_client_backend: Allow serialization of empty transaction requests. 2024-01-30 16:42:31 -08:00
Kris Nuttycombe ea1d3a35db zcash_keys: Remove `UnifiedAddressRequest::DEFAULT`
This default only made sense in the context of what was supported by
`zcash_client_sqlite`, and not in any other context. Unified address
requests no longer have their parts conditioned by what feature flags
are available; instead, if a request is constructed for which the
required key parts are not supported under a particular selection of
feature flags, address generation will raise a runtime error.
2024-01-27 07:59:55 -07:00
str4d 961f902795
Merge pull request #1127 from nuttycom/fix/migrate_scope_without_raw_tx
receiving_key_scopes migration: Fall back to note commitment matching for scope determination
2024-01-26 03:31:27 +00:00
Jack Grigg d0a27eda90 zcash_client_sqlite: Add test for `receiving_key_scopes` migration 2024-01-26 03:10:36 +00:00
Kris Nuttycombe 0aebaf1345 receiving_key_scopes migration: Fall back to note commitment matching for scope determination.
Fixes #1117
2024-01-26 03:10:31 +00:00
str4d 14408e4eed
Merge pull request #1132 from zcash/rusqlite-dependency-warning
zcash_client_sqlite: Add warning about `rusqlite` version constraint
2024-01-25 19:27:42 +00:00
str4d 610b19bcd2
Merge pull request #1129 from zcash/wallet/orchard_compiler_flag
Add `zcash_unstable` compiler flag to fully gate `orchard` functionality
2024-01-25 19:15:53 +00:00
Jack Grigg e85aac82b6 zcash_client_sqlite: Add warning about `rusqlite` version constraint 2024-01-25 19:06:08 +00:00
str4d fe902f74bc Add documentation about the `None` fully scanned height case
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2024-01-25 17:43:52 +00:00
Kris Nuttycombe 184e3c741f Add `zcash_unstable` compiler flag to fully gate `orchard` functionality 2024-01-24 17:48:10 -07:00
Jack Grigg d07f6d4336 zcash_client_sqlite: Make `get_wallet_summary` entirely transactional 2024-01-24 20:33:55 +00:00
Jack Grigg db071f2e1f zcash_client_backend: Add desired Sapling shard index to `WalletSummary`
Closes zcash/librustzcash#1124.
2024-01-24 18:06:31 +00:00
Jack Grigg 11355e4095 zcash_client_sqlite: Get fully-scanned height from scan queue 2024-01-24 18:06:31 +00:00
Jack Grigg ff724317f6 zcash_client_sqlite: Add test for `WalletDb::block_fully_scanned` 2024-01-24 18:06:31 +00:00
Jack Grigg 0ccc126315 zcash_client_sqlite: Instrument `put_shard_roots` 2024-01-22 23:55:19 +00:00
Jack Grigg ae2a18db93 zcash_client_sqlite: Instrument `get_wallet_summary` 2024-01-22 23:55:19 +00:00
Daira Emma Hopwood 76f92268c3 Remove notices about the BOSL license exception, which are no longer needed.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2024-01-17 23:28:15 +00:00
Jack Grigg 05f9252cb0 Fix `zcash_keys` feature flag enabling in `zcash_client_*` crates 2024-01-16 22:47:35 +00:00
Kris Nuttycombe 60336714f7 Fix Rust formatting. 2024-01-11 14:31:19 -07:00
Andrew Arnott 69d92808f3
Add `WalletRead::get_account_ids` function 2024-01-10 13:01:01 -07:00
Kris Nuttycombe 6cbdd494cf zcash_client_backend: Add receiver type selection to unified address derivation. 2024-01-09 10:48:13 -07:00
Kris Nuttycombe c3a630bac3
Merge pull request #1060 from nuttycom/wallet/generalize_proposals
Add Orchard support to fees & transaction proposals.
2024-01-09 09:20:41 -07:00
Andrew Arnott 52a91a0ee7
Drop unused `mainnet` feature
Nothing seems to have depended on it, and my testing suggests the same build of this crate can work on both networks.
2024-01-08 06:32:21 -07:00
Kris Nuttycombe 24ebe4c643 Address comments from code review.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2024-01-05 17:00:46 -07:00
Kris Nuttycombe adc75566a0 zcash_client_backend: Add Orchard support to transaction proposals. 2024-01-05 16:59:54 -07:00
str4d 0548b3dd9b
Merge pull request #1090 from nuttycom/rename_wallet_note
zcash_client_backend: rename `WalletNote` to `Note`
2024-01-05 17:16:29 +00:00
Kris Nuttycombe 1b036f1e0d zcash_client_backend: rename `WalletNote` to `Note` 2024-01-05 09:13:53 -07:00
Dimitris Apostolou 652c393896
Fix typo 2024-01-05 12:44:57 +02:00
Kris Nuttycombe 28319ffc38
Merge pull request #1085 from nuttycom/wallet/common_input_source
Replace SaplingInputSource and TransparentInputSource with InputSource
2024-01-04 15:07:23 -07:00
Kris Nuttycombe 5126fd6b5f
Merge pull request #1086 from zcash/docs-rs-feature-flags
Show feature flags in documentation
2024-01-04 14:34:40 -07:00
Kris Nuttycombe d4aa2d6f06 Replace SaplingInputSource and TransparentInputSource with InputSource
This unification allows us to better isolate transparent-input dependent
functionality. Previously, `TransparentInputSource` could not be placed
under a feature flag because the interface was needed for proposal
deserialization; by instead making the transparent input source methods
flag-dependent, we can correctly produce an error when proposal
deserializaiton attempts to select transparent inputs and the feature
flag is off.
2024-01-04 14:00:20 -07:00
Jack Grigg 3989ee9926 Show feature flags in documentation
This can be rendered locally with:
    RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --no-deps --workspace --all-features
2024-01-04 19:07:22 +00:00
Kris Nuttycombe f18d082aa3 zcash_client_backend: Introduce an "orchard-client" feature flag.
We plan to also introduce a similar flag to gate access to Sapling
functionality. Since introduction of Orchard functionality is still
nascent, it's the correct time to introduce this isolation, before
there's more functionality that needs to be isolated in this fashion.
2024-01-03 17:05:20 -07:00
Jack Grigg 2ea83243a7 Document the feature flags 2024-01-03 20:15:21 +00:00
Jack Grigg 0df4c6f043 Remove implicit feature flags for optional dependencies
All optional dependencies are enabled as part of dedicated feature
flags.
2024-01-03 20:15:21 +00:00
str4d 20f8b97195
Merge pull request #1063 from nuttycom/backend/parsed_address
zcash_client_backend: Rename `RecipientAddress` to `Address`
2023-12-15 17:40:22 +00:00
Jack Grigg b6907b14e6 Use `sapling-crypto` crate directly outside `zcash_primitives` 2023-12-12 19:50:26 +00:00
Kris Nuttycombe 9ac3594bbb zcash_client_backend: Rename RecipientAddress to Address 2023-12-08 11:34:27 -07:00
Kris Nuttycombe aab9938b53 zcash_client_backend: Rename `RecipientAddress::Shielded` to `RecipientAddress::Sapling` 2023-12-07 15:24:47 -07:00
Jack Grigg 842ce36f7c Fix clippy lint 2023-12-06 18:19:15 +00:00
Jack Grigg d332aacf98 Merge branch 'main' into 1044-extract-zip32 2023-12-06 18:04:36 +00:00
Jack Grigg 3dfd478141 Migrate to published `zip32` crate outside this repository 2023-12-06 18:04:09 +00:00
Kris Nuttycombe ca54b3489d Apply suggestions from code review
Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2023-12-05 15:55:52 -07:00
Kris Nuttycombe cad4f25b75 zcash_client_backend: Replace `ReceivedSaplingNote` with `ReceivedNote`
`ReceivedNote` now allows Orchard notes to be represented as received
notes. As part of this change, received notes now track whether they
were received using internally- or externally-scoped viewing keys.
This eliminates the need to trial-regenerate notes using the wallet's
IVKs to determine scope at spend time.
2023-12-05 10:55:06 -07:00
Kris Nuttycombe 6b10a6dc86 zcash_client_backend: Move essential wallet types into the `wallet` module. 2023-12-05 10:55:04 -07:00
Kris Nuttycombe 4a7dd2bed2 zcash_client_sqlite: Add receiving key scope information to received notes. 2023-12-05 10:49:35 -07:00
Kris Nuttycombe 8c1480304e zcash_client_backend: Wrap entire Sapling note in `SaplingReceivedNote` 2023-12-05 10:49:35 -07:00
Kris Nuttycombe 214a3750c5 zcash_client_backend: Make `Balance` and `AccountBalance` fields private.
Public methods for mutation of these fields have been provided that
perform checking for overflow of the valid monetary range as part
of their operation.
2023-12-04 13:53:27 -07:00
Kris Nuttycombe 9aec53eec9 zcash_client_backend: Add Orchard components to `ScannedBlock` 2023-11-30 13:08:17 -07:00
Kris Nuttycombe 1e5d253c9c Fix dependencies to repair `cargo -p` subproject builds. 2023-11-29 12:37:18 -07:00
Jack Grigg 0d06e561bb Update Sapling imports to migrate off re-exports at old paths 2023-11-28 03:40:41 +00:00
Jack Grigg 106f5a353a Remove `MemoBytes` usage from `zcash_primitives::sapling` 2023-11-28 03:25:14 +00:00
Jack Grigg 7badba29ea zcash_primitives: Move `zip32::sapling` to `sapling::zip32` 2023-11-28 01:38:53 +00:00
Jack Grigg eb0b5a1b24 zcash_primitives: Remove `consensus::Parameters` from `sapling` module
Part of zcash/librustzcash#1044.
2023-11-22 04:29:36 +00:00
Kris Nuttycombe 7aab6fd7a7 zcash_client_backend: add `Display` and `Error` impls for proposal parsing errors. 2023-11-14 12:59:40 -07:00
Kris Nuttycombe aeb405ef5d Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-11-14 12:58:22 -07:00
Kris Nuttycombe 33169719ce zcash_client_backend: Add serialization & parsing for protobuf Proposal representation. 2023-11-09 20:07:16 -07:00
Kris Nuttycombe 6077a712e4
Merge pull request #1024 from nuttycom/wallet/orchard_block_metadata
zcash_client_backend: Add Orchard note commitment tree size to block metadata.
2023-11-09 15:44:56 -07:00
Kris Nuttycombe 1ab411ada8 zcash_client_sqlite: Fix broken intra-doc link on `unstable` feature. 2023-11-08 17:31:23 -07:00
Kris Nuttycombe 27f78d1894 zcash_client_backend: Add Orchard note commitment tree size to block metadata. 2023-11-08 16:46:44 -07:00
str4d e4b9d73d0c
Merge pull request #1003 from nuttycom/wallet/reusable_input_selection
zcash_client_backend: Factor out `InputSource` from `WalletRead`
2023-11-08 20:20:03 +00:00
Kris Nuttycombe aa063ae3fd zcash_client_backend: Factor out input source traits from `WalletRead`
Prior to this change, it's necessary to implement the entirety of the
`WalletRead` trait in order to be able to use the input selection
functionality provided by `zcash_client_backend::data_api::input_selection`.
This change factors out the minimal operations required for transaction
proposal construction to better reflect the principle of least authority
and make the input selection code reusable in more contexts.

In order to minimize the operations of the newly-created `InputSource`
and `ShieldingSource` traits, this change also removes the
`min_confirmations` field from transaction proposals, in favor of
storing explicit target and anchor heights. This has the effect of
limiting the lifetime of transaction proposals to `PRUNING_DEPTH -
min_confirmations` blocks.
2023-11-08 12:41:49 -07:00
Kris Nuttycombe e27dcf498e Use the bundled prover rather than local params files for testing by default.
`fetch_params.sh` is now deprecated and the bundled proving parameters
from `wagyu-zcash-parameters` are used everywhere, so the tests should
follow suit.

Fixes #1016
2023-11-03 16:13:34 -06:00
Jack Grigg bed5bc6cf6 Clean up unreleased changelog entries 2023-11-03 00:56:26 +00:00
Jack Grigg b2ff29db78 Refactor Sapling builder to separate out proof generation
Closes zcash/librustzcash#741.
2023-10-31 22:01:34 +00:00
Kris Nuttycombe 13fb0a4819
Merge pull request #1019 from nuttycom/wallet/proposals_with_minconf
zcash_client_backend: Move `min_confirmations` into `Proposal`
2023-10-31 12:59:40 -06:00
Kris Nuttycombe 4cd26b7ea9 zcash_client_backend: Move `min_confirmations` into `Proposal`
This fixes an API issue whereby it was possible to execute a `Proposal`
with a different value of `min_confirmations` than that with which the
`Proposal` was constructed.
2023-10-31 10:38:52 -06:00
Kris Nuttycombe a0935b5ecd zcash_client_backend: remove `WalletRead::is_valid_account_extfvk` 2023-10-27 15:01:26 -06:00
Kris Nuttycombe 9627c806e4 zcash_client_backend: Pass `Proposal` values by reference. 2023-10-26 16:11:10 -06:00
Kris Nuttycombe 570ea48588 Apply suggestions from code review
Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-10-26 15:24:45 -06:00
Kris Nuttycombe f1c08693a5 zcash_client_backend: Add propose_standard_transfer. 2023-10-25 08:08:49 -06:00
Kris Nuttycombe cc0cc2de84 zcash_primitives: add StandardFeeRule
`StandardFeeRule` is an enumeration of the standard fees that have
existed in the history of Zcash zips. It is provided to simplify
transition to new fee strategies; legacy elements of this enumeration
are introduced already-deprecated.
2023-10-25 08:08:49 -06:00
Kris Nuttycombe f7527e14c9 Use `NonNegativeAmount` for note and utxo value fields 2023-10-23 12:59:26 -06:00
ebfull 84eb0821de
Merge pull request #1021 from zcash/release-zcash_client_sqlite-0.8.1
Release zcash_client_sqlite 0.8.1
2023-10-19 12:24:46 -06:00
Sean Bowe 289f1fdf30 Release 0.8.1
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-10-19 18:26:11 +01:00
Daira Emma Hopwood 77ceb879e6 Merge remote-tracking branch 'origin/release-zcash_client_sqlite-0.8.1' 2023-10-19 01:16:24 +01:00
Sean Bowe b88adb4e82 Release 0.8.1 2023-10-18 14:58:03 -06:00
Daira Emma Hopwood 914c0ed5c9 Add regression test for incorrect note deduplication in `v_transactions`.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-10-18 14:54:46 -06:00
Kris Nuttycombe 2873dd4b60 zcash_client_sqlite: Fix incorrect note deduplication in `v_transactions`
The `v_transactions` view is built upon the set of received notes,
received note values being added to the balance for the transaction and
spent notes being deducted from this balance. This fixes an error
wherein if multiple identically-valued notes were spent in a
transaction, only one of those notes' values was being counted as having
been spent.
2023-10-18 14:54:31 -06:00
ebfull f70a4fe29e
Merge pull request #1020 from nuttycom/wallet/v_transactions_note_uniqueness
zcash_client_sqlite: Fix incorrect note deduplication in `v_transactions`
2023-10-18 09:36:42 -06:00
Daira Emma Hopwood 11e909a2d1 Add regression test for incorrect note deduplication in `v_transactions`.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-10-18 00:41:34 +01:00
Kris Nuttycombe 0de652c687 zcash_client_sqlite: Fix incorrect note deduplication in `v_transactions`
The `v_transactions` view is built upon the set of received notes,
received note values being added to the balance for the transaction and
spent notes being deducted from this balance. This fixes an error
wherein if multiple identically-valued notes were spent in a
transaction, only one of those notes' values was being counted as having
been spent.
2023-10-13 15:28:50 -06:00
Kris Nuttycombe 29c676ff12
Merge pull request #1009 from tw0po1nt/fix_txn_builder_panic
Gracefully handle when given an Orchard-only UA
2023-10-12 18:15:36 -06:00
Matthew Watt a788cc4c4d Fix merge conflicts 2023-10-12 06:16:22 -05:00
Kris Nuttycombe 1447d8ea01 zcash_client_backend: Move change memos into the `ChangeValue` components of `Proposal`s.
The existing API limited change outputs to having only a single memo
repeated across each change output. This change makes it so that each
proposed change output can have its own associated memo, and leaves it
up to the input selector to determine how requested change memos are
associated with change outputs.
2023-10-11 14:15:19 -06:00
Kris Nuttycombe a2b5c2c784 zcash_client_backend: Use `NonNegativeAmount` for fee and change amounts.
In order to use `uint64` for amounts that must be nonnegative in the
`proposal.proto` file, it is useful to update fee and change computation
to use `NonNegativeAmount` where possible.
2023-10-10 16:12:47 -06:00
Matthew Watt 73f263682e Remove unnecessary local 2023-10-10 07:50:07 -05:00
Matthew Watt 2a4d9e06da Run fmt 2023-10-10 07:47:08 -05:00
Matthew Watt b548e00c10
Update zcash_client_sqlite/src/wallet.rs
Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-10-10 06:36:40 -05:00
Matthew Watt 0e5a58b0b0
Update zcash_client_sqlite/src/wallet.rs
Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-10-10 06:36:20 -05:00
Kris Nuttycombe 5b40ddf072 zcash_client_backend: Use globally unique identifiers for notes.
Update zcash_client_backend error types to use (TxId, output_index)
as the identifier for notes instead of the internal database identifier.
2023-10-09 12:44:27 -06:00
sasha 74840829c8 zcash_client_backend: Make `ReceivedSaplingNote` internals private.
This also adds the txid and index to `ReceivedSaplingNote` for use as a
globally identifier for the note.
2023-10-09 12:22:12 -06:00
Matthew Watt c4175342ac Cleanup 2023-10-09 06:46:12 -05:00
Matthew Watt 9d7ac07b1a Fix test build failures 2023-10-08 19:37:02 -05:00
Matthew Watt 46ed4964c3 Display for PoolType 2023-10-08 19:19:51 -05:00
Matthew Watt 94f2240e08 Provide PoolType to UnsupportedPoolType case; stylistic changes 2023-10-08 19:05:50 -05:00
Kris Nuttycombe c16e777222 zcash_client_sqlite: Fix zcash_proofs dev-dependency 2023-09-28 17:39:59 -06:00
Kris Nuttycombe a2e772c93a zcash_client_backend: Return summary information from `scan_cached_blocks`
When scanning, a wallet only needs to update balance and transaction
information shown to users when the scan has resulted in a change to
wallet state. This modifies `scan_cached_blocks` to return the range of
block heights actually scanned, along with the counts of notes spent and
received by the wallet in that range.

Fixes #918
2023-09-28 17:39:59 -06:00
Jack Grigg f6d7714efe zcash_client_sqlite: Replace internal height tuples with `RangeInclusive`
We don't need to iterate over them, but the `*_extrema` internal methods
are semantically returning inclusive ranges, and using `RangeInclusive`
avoids bugs where the wrong half of the tuple is used (instead moving
the location of the tuple handling inside the `*_extrema` methods, which
cuts the number of occurrences from linear in the number of function
calls to constant).
2023-09-27 16:34:58 +00:00
Jack Grigg 7e89300db9 Move common package and dependency configs into workspace config
The MSRV for the main crates is 1.65, which is higher than the Rust
version that stabilised workplace dependencies (1.64). The implicit MSRV
for the component crates is still lower than this, so we don't migrate
these crates.
2023-09-26 22:01:32 +00:00
Jack Grigg 7a47f8494c zcash_client_sqlite 0.8.0 2023-09-25 18:20:44 +00:00
Jack Grigg 4bc65d66b1 zcash_client_backend 0.10.0 2023-09-25 18:19:52 +00:00
Jack Grigg 1a1abb62aa zcash_proofs 0.13.0 2023-09-25 15:11:00 +00:00
Jack Grigg d35d0961ab zcash_primitives 0.13.0 2023-09-25 15:06:57 +00:00
Jack Grigg e926151f8f zcash_client_sqlite: Use `Uuid::from_u128` for all UUIDs
Previously we used `Uuid::from_fields` to ensure that the various UUID
fields were correctly constructed, but now that we have a CI lint that
checks this automatically, we can consistently use `Uuid::from_u128`
which is easier to prepare from `uuidgen` output.
2023-09-25 12:05:42 +00:00
Jack Grigg 478b5d1858 zcash_client_sqlite: Clean up migrations graph comment 2023-09-25 11:14:24 +00:00
Kris Nuttycombe b90f285359 zcash_client_sqlite: Include spent utxos in v_transactions net value.
This fixes a bug in v_transactions whereby shielding transactions
displayed an incorrect balance.
2023-09-24 21:35:42 -06:00
Jack Grigg 30c58ebfb2 zcash_client_sqlite 0.8.0-rc.5 2023-09-22 23:26:43 +01:00
Jack Grigg 4afc24af6a zcash_client_backend 0.10.0-rc.4 2023-09-22 23:25:19 +01:00
Jack Grigg b76b028b3a zcash_client_sqlite: Set chain tip to truncation height when truncating
We don't know at truncation time what the latest chain tip is; the chain
might have reorged to a shorter heavier chain, or the reorg depth might
only be a few blocks. `WalletDb::chain_height` uses the scan queue as
its source of truth, so the `Verify` range we add during truncation
(to prioritise determining whether the rewind was sufficient) can't
extend beyond the block height we know to exist.

The next call to `WalletDb::update_chain_tip` will add additional ranges
beyond this height, which might include a `Verify` range that ends up
merging with the one added during truncation.
2023-09-22 21:09:23 +00:00
Jack Grigg 625a5ff594 zcash_client_sqlite: Remove is-mined checks from transparent balance
The `LEFT OUTER JOIN` was causing the `tx.block IS NULL` check to alias
two cases: an unspent transparent output, and a transparent output spent
in an unmined transaction. The latter only makes sense to include in the
UTXO count if the transaction is expired, and (due to limitations of the
transparent data model in the current wallet) if that expiry won't be
undone by a reorg. We now handle these two cases directly.

Partly reverts 8828276361.
Closes zcash/librustzcash#983.

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2023-09-22 21:09:23 +00:00
Jack Grigg cd6c962719 zcash_client_sqlite: Write a test for transparent balance behaviour 2023-09-22 17:20:10 +00:00
Jack Grigg 71e38fe190 zcash_client_sqlite: Enable `TestState` to mine wallet transactions 2023-09-22 17:20:07 +00:00
Jack Grigg 9e4fa96dd7 zcash_client_sqlite: Clean up existing transparent input test 2023-09-22 17:01:00 +00:00
str4d e817a75582
Merge pull request #987 from zcash/test-harness-fixes-to-rc-branch
Merge test harness fixes to the release candidate branch
2023-09-22 18:00:22 +01:00
Kris Nuttycombe b69d80f25d zcash_client_sqlite: Remove use of boolean constants from `v_tx_outputs`
At present, [zcash/zcash-android-wallet-sdk] supports Android API 27,
which bundles SQLite 3.19. SQLite support for the `TRUE` and `FALSE`
constants were introduced in SQLite 3.23, so we cannot currently use
these constants and retain support for Android API 27.

This version support limitation applies only to the `v_transactions`
and `v_tx_outputs` views, which are considered part of the public API
of this crate; other use of more recent SQLite features is fine because
they rely upon the SQLite bundled via our use of the `rusqlite` crate
and feature compatibility is verified via the unit tests of this crate.
2023-09-20 10:09:25 -06:00
Kris Nuttycombe e7b3e9c04e zcash_client_sqlite 0.8.0-rc.4 2023-09-19 15:01:52 -06:00
Kris Nuttycombe 6d2c53111a zcash_client_backend 0.10.0-rc.3 2023-09-19 15:00:51 -06:00
Kris Nuttycombe c0e29ad103 zcash_client_sqlite: fix join to blocks table in `v_transactions`
This allows us to display additional block information when a
transparent UTXO was provided for a block that we have scanned.
Also, this ensures that memos from a wallet to itself are not
double-counted.

Co-authored-by: str4d <thestr4d@gmail.com>
2023-09-19 13:15:50 -06:00
Kris Nuttycombe 15bfb41773 Apply suggestions from code review.
Co-Authored-By: str4d <thestr4d@gmail.com>
Co-Authored-By: Daira Hopwood <daira@jacaranda.org>
2023-09-19 13:15:50 -06:00
Kris Nuttycombe 6ebd66da76 zcash_client_sqlite: Remove inner join between `transactions` and `utxos` from `v_transactions`
Under normal usage conditions, the `transactions` table is not currently
populated for transactions involving transparent UTXOs, and so this join
was always resulting in transparent UTXO information being filtered out
from the transaction history.

Fixes [zcash/ZcashLightClientKit#1271]
2023-09-19 13:15:50 -06:00
Kris Nuttycombe 1575f2db88 zcash_client_backend: make the `SpanningTree` type usable outside of `zcash_client_sqlite`
This adds the `data_api::scanning::spanning_tree` module under
a new `unstable-spanning-tree` feature flag, making it available to
other implementations who want to be able to write their own storage
backends without having to reinvent the spanning tree logic.
2023-09-18 11:22:35 -06:00
Kris Nuttycombe b32aa3d2a6 Fix missing zcash_client_backend feature dependency. 2023-09-12 09:35:18 -06:00