Commit Graph

907 Commits

Author SHA1 Message Date
Jack Grigg 4f95bd22d4
Merge pull request #1462 from nuttycom/1434-store_decrypted_tx
zcash_client_sqlite: Store received UTXOs in `store_decrypted_tx`
2024-07-26 23:11:47 +01:00
Kris Nuttycombe 3cec9ee4a7 zcash_client_sqlite: Store received UTXOs in `store_decrypted_tx`.
This fixes an issue wherein transparent outputs of transactions added to
the wallet via `decrypt_and_store_transaction` would not be properly
recorded as UTXOs belonging to the wallet.

Part of #1434
2024-07-26 15:47:16 -06:00
Kris Nuttycombe 5ad3205e58 zcash_client_sqlite: Demonstrate the failure of store_decrypted_tx to persist transparent outputs.
Related to #1434
2024-07-26 15:46:57 -06:00
Kris Nuttycombe 2021377626 Minor documentation formatting. 2024-07-25 20:05:01 -06:00
Kris Nuttycombe e555854f87 Merge remote-tracking branch 'upstream/main' into ufvk_import_support 2024-07-25 16:31:34 -06:00
Andrew Arnott cc39084de4
Improve docs around account creation 2024-07-23 20:32:26 -06:00
Andrew Arnott 664526f74a
Fixes for nearly all PR comments 2024-07-23 19:47:37 -06:00
Jack Grigg 8a7e663343
Merge pull request #1449 from zcash/doc-fix-without-features
zcash_client_backend: Fix `cargo doc` without all features
2024-07-19 03:32:52 +01:00
Jack Grigg ac5bac9969 zcash_client_backend: Add exchanges we know how to query for USD/ZEC
Currently only unauthenticated connections are supported (i.e. no API
keys can be configured). However, AFAICT none of these exchanges provide
non-IP-based rate limits for authenticated connections to public APIs,
so authentication wouldn't help to make connections over Tor more
reliable.
2024-07-18 17:53:58 +00:00
Jack Grigg 739e878c8b zcash_client_backend: Add USD/ZEC exchange rate querying over Tor
This fetches price data from multiple exchanges over Tor, and takes the
median of the successful responses.

Closes zcash/librustzcash#1416.
2024-07-18 17:53:58 +00:00
Andrew Arnott 2ee56f77f2
Merge remote-tracking branch 'upstream/main' into ufvk_import_support 2024-07-17 23:31:08 -06:00
Jack Grigg 907d37b928 zcash_client_backend: Fix `cargo doc` without all features 2024-07-18 01:37:45 +00:00
Jack Grigg b3de2ab81b zcash_client_backend: Add internal HTTP GET support to `tor::Client` 2024-07-18 01:25:17 +00:00
Jack Grigg 1e5b62bfce zcash_client_backend: Add a Tor client using the Arti library 2024-07-18 01:25:17 +00:00
Jack Grigg eaa43b4e25
Merge pull request #1257 from daira/implement-transparent-source-only
Add support for transparent-source-only (TEX) addresses
2024-07-17 19:27:36 +01:00
Kris Nuttycombe 24b6d50d77 Apply suggestions from code review
Co-authored-by: Jack Grigg <thestr4d@gmail.com>
2024-07-17 07:51:58 -06:00
Kris Nuttycombe dbb5eeb704 Fix a potential crash related to varying behavior between change strategies.
It was possible for `GreedyInputSelector` to crash if the change
strategy being used for input selection were to place a ZIP 320
ephemeral output anywhere but as the last element in the returned change
values. This has been replaced by an error; the error will also be
returned if the change strategy returns more than one ephemeral output
in the change values.
2024-07-16 15:43:21 -06:00
Kris Nuttycombe aa4312326d Use `EphemeralBalance` instead of `EphemeralParameters`
The `EphemeralParameters` type makes too many states representable, in
particular, it represents that it is possible for a proposal step to
have both ephemeral inputs and ephemeral outputs. This change reduces
the representable state space to make it so that only one or the other
is true, and also makes clear that the change memo must be attached to
the change output of the intermediate step, and not to the ultimate
output to the final recipient (where we expect there to be no shielded
change, and therefore it is not possible to attach a memo.)
2024-07-16 13:53:31 -06:00
Jack Grigg 270eec2574 CI: Don't test `zcash_client_backend/lightwalletd-tonic` on WASM
Broken until hyperium/tonic#1783 is addressed.
2024-07-11 18:09:49 -07:00
Jack Grigg e5517b61cc zcash_client_backend: Migrate to `tonic 0.12` with `http 1` 2024-07-11 22:23:55 +00:00
Daira-Emma Hopwood 9856a70840 Simpler handling of a potential overflow.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-04 22:58:10 +01:00
Daira-Emma Hopwood 6bc22f411e Documentation fixes and improvements.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-04 20:13:35 +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
Daira-Emma Hopwood 8636daa4f3 Tiny simplification.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-29 12:22:44 +01:00
Daira-Emma Hopwood 14bdcdeaaa We cannot spend prior outputs at all when "transparent-inputs" is not
enabled. (I got this right in a previous commit but broke it when
refactoring the proposal error handling.)

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-29 12:22:44 +01:00
Daira-Emma Hopwood 7838c048a2 Make `ephemeral_parameters` and `EphemeralParameters::NONE` available
unconditionally.

This removes a bunch of `#[cfg(feature = "transparent-inputs")]`
conditionals, with negligible (if any, after compiler optimization)
overhead. It also requires callers of functions with an
`ephemeral_parameters` parameter to do the intended thing to work
with "transparent-inputs" either enabled or disabled.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-29 12:22:44 +01:00
Daira-Emma Hopwood bc38f2af80 Document the `possible_change` parameter to `check_for_uneconomic_inputs`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-29 01:34:19 +01:00
Daira-Emma Hopwood 286439aa96 Define a constant `EphemeralParameters::NONE` instead of deriving `Default`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-29 01:33:50 +01:00
Daira-Emma Hopwood d32b7dbd8f Remove `ChangeValue::new`. Also document `ChangeValue::is_ephemeral` as
an addition in the changelog.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-28 21:49:51 +01: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
Kris Nuttycombe cd7ca2c64f zcash_client_sqlite: Update to `shardtree` commit 337f59179eda51261e9ddfc6b18e8fb84ea277c9
Fixes #1431
2024-06-28 13:52:08 -06:00
Daira-Emma Hopwood 25006ab013 Documentation improvement from code review.
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-28 20:52:05 +01:00
Daira-Emma Hopwood baccb4361b Restore the logic to determine whether we are spending inputs that are
uneconomic to spend.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-28 17:47:08 +01:00
Daira-Emma Hopwood feabe6df93 Remove complicated code to calculate the number of dust spends.
See #1316 for re-adding it.

The previous code was essentially dead because it had no side effects
other than potentially returning an error. That error is unnecessary
and incorrect when we are not actually performing dust spends.

When we re-enable them, we should not try to make dust spends in
any transaction with non-default `ephemeral_parameters`, or if the
`dust_output_policy` is `DustAction::AddDustToFee`. That would
guarantee that we will always have a shielded change output, which
makes the calculations more tractable and excludes some potentially
complicated interactions.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-28 17:47:08 +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 81a2846593 Simpler way to calculate `has_shielded_inputs`.
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 7a05b44df9 Make mutable inputs to closures in `create_proposed_transaction` explicit.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-27 01:45:45 +01:00
Daira-Emma Hopwood b77813933a Refactor ephemeral output-related parameters to balance calculation.
This now only supports a single ephemeral input and/or output when
constructing a proposal (multiple ephemeral outputs are still supported
when creating transactions).

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-27 01:45:45 +01:00
Daira-Emma Hopwood ffb2ddf594 `zcash_client_backend::fees::ChangeValue` is now an enum, allowing only
valid combinations of output pool, memo presence, and ephemerality.

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-27 01:45:45 +01:00
Daira-Emma Hopwood c926e7ce0a Filter ephemeral transparent `ChangeValue`s by `is_ephemeral()` as well as
pool type.

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 7d8a96f827 Don't cache metadata between steps; it's not an important optimization.
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 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 6b465b702e Document the mapping functions on `zcash_client_backend::wallet::Recipient`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-25 08:40:08 +01:00