Commit Graph

226 Commits

Author SHA1 Message Date
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 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 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
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 ae2a18db93 zcash_client_sqlite: Instrument `get_wallet_summary` 2024-01-22 23:55:19 +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 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
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
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
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 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 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
Jack Grigg 0d06e561bb Update Sapling imports to migrate off re-exports at old paths 2023-11-28 03:40:41 +00:00
Kris Nuttycombe 33169719ce zcash_client_backend: Add serialization & parsing for protobuf Proposal representation. 2023-11-09 20:07:16 -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
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 a0935b5ecd zcash_client_backend: remove `WalletRead::is_valid_account_extfvk` 2023-10-27 15:01:26 -06:00
Kris Nuttycombe f7527e14c9 Use `NonNegativeAmount` for note and utxo value fields 2023-10-23 12:59:26 -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
Matthew Watt c4175342ac Cleanup 2023-10-09 06:46:12 -05:00
Matthew Watt 94f2240e08 Provide PoolType to UnsupportedPoolType case; stylistic changes 2023-10-08 19:05:50 -05: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 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 9e4fa96dd7 zcash_client_sqlite: Clean up existing transparent input test 2023-09-22 17:01:00 +00:00
Kris Nuttycombe 2131cd547e zcash_client_sqlite: Return a balance for every account from `get_wallet_summary`
Fixes #948
2023-09-07 11:02:59 -06:00
Kris Nuttycombe f56c5d8f4b Measure scan progress from wallet birthday, not the fully scanned height. 2023-09-06 12:07:18 -06:00
Kris Nuttycombe 65420f59df zcash_client_backend: Add `WalletRead::block_max_scanned`
Fixes #941
2023-09-06 08:49:43 -06:00
str4d 236e9f2cd0
Merge pull request #914 from nuttycom/sbs/nonlinear_sync_aware_balance
Add `get_wallet_summary` to `WalletRead`
2023-09-06 01:04:42 +01:00
str4d 1e12e9d0e6
Clarify zero-conf shielded note behaviour for `get_wallet_summary`
Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-09-06 00:18:11 +01:00
Kris Nuttycombe 6cbb107c71 zcash_client_sqlite: allow zero-conf transactions in unshielded balance. 2023-09-05 16:49:36 -06:00