Commit Graph

3930 Commits

Author SHA1 Message Date
Jack Grigg 1e5b62bfce zcash_client_backend: Add a Tor client using the Arti library 2024-07-18 01:25:17 +00:00
Jack Grigg 4cefa92c28 Move SQLite dependency definitions from `zcash_client_sqlite` to root 2024-07-17 18:39:48 +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 f8bedd89e7 Make ephemeral_addresses.address unique
This also provides additional documentation for why it's necessary
to store ephemeral_addresses table entries at indicies that do not
correspond to valid addresses.
2024-07-17 11:14:44 -06: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
str4d 909c015e00
Merge pull request #1448 from zcash/zcash-0.1
`zcash 0.1.0`
2024-07-15 17:11:16 +01:00
Jack Grigg 013757b81c zcash 0.1.0 2024-07-15 15:31:57 +00:00
Jack Grigg 51e8fff161 zcash: Initial crate that just re-exports `zcash_primitives` 2024-07-15 15:30:54 +00:00
str4d b4bb31ffd2
Merge pull request #1447 from zcash/zcash_extensions-0.1
`zcash_extensions 0.1.0`
2024-07-15 16:29:07 +01:00
Jack Grigg aab11fd23c QA: Add `cargo vet` publisher for `zcash_extensions 0.1.0` 2024-07-15 15:02:46 +00:00
Kris Nuttycombe 034bad879c
Merge pull request #1444 from daira/sqlite3-debugging
Add utility methods on `TestState` to dump the contents of a database table, or run an sqlite3 command
2024-07-15 08:50:40 -06:00
Kris Nuttycombe 73d0c5b68b
Merge pull request #1446 from zcash/tonic-0.12
zcash_client_backend: Migrate to `tonic 0.12` with `http 1`
2024-07-15 08:47:29 -06:00
Jack Grigg 6ec8f6c933 zcash_extensions 0.1.0 2024-07-15 14:19:58 +00: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 615f6254f8 Add utility methods on `TestState` to dump the contents of a database
table, or to run an sqlite3 command. The latter is marked `unsafe`.
The name of the table must be a static string containing only `[a-ZA-Z_]`
characters. These are only usable if both `#[cfg(test)]` and the
"unstable" feature are enabled.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-07 02:12:12 +01:00
Daira-Emma Hopwood 56aa348a41 Extend the `send_multi_step_proposed_transfer` test to check the behaviour
when another wallet creates a transaction with an output to one of our
ephemeral addresses, and repair the implementation to pass this test.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-07 01:16:49 +01: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 22b8cff6d1 The `TxId` argument to `EphemeralAddressReuse` does not need to be optional.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-04 20:37:07 +01:00
Daira-Emma Hopwood bda6451273 Change `unwrap`s to `expect`s when constructing `NonHardenedChildIndex`.
Also change the return type of `find_index_for_ephemeral_address_str` to
`Result<Option<NonHardenedChildIndex>, SqliteClientError>` so that the
`expect` is in the right place.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-04 20:13:35 +01:00
Daira-Emma Hopwood 27ca6e44d6 Remove unneeded `impl SealedChangeLevelKey for EphemeralIvk`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-07-04 20:13:35 +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 b48f6272f0 Minor simplification in a test.
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 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
Kris Nuttycombe 34cf6d286a
Merge pull request #1439 from nuttycom/fix_shardtree_root_insertion
zcash_client_backend: Fix panic related to insertion of frontiers below subtree roots.
2024-06-30 08:33:12 -06: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 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 9c082dca3e `zcash_primitives::transaction::fees::zip317::FeeRule::non_standard` has
been deprecated, because in general it can calculate fees that violate
ZIP 317, which might cause transactions built with it to fail. Maintaining
the generality of the current implementation imposes ongoing maintenance
costs, and so it is likely to be removed in the near future.

Use `transaction::fees::zip317::FeeRule::standard()` instead to comply
with ZIP 317.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-28 19:03:08 +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