Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transparent address gap limit handling & general address rotation functionality. #1673

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

nuttycom
Copy link
Contributor

No description provided.

@nuttycom nuttycom marked this pull request as draft December 23, 2024 20:43
@nuttycom nuttycom force-pushed the feature/transparent_gap_limit_handling branch 16 times, most recently from 62c1394 to bd2df86 Compare December 28, 2024 04:13
@nuttycom nuttycom changed the title WIP: Add transparent address gap limit handling & general address rotation functionality. Add transparent address gap limit handling & general address rotation functionality. Dec 28, 2024
@nuttycom nuttycom marked this pull request as ready for review December 28, 2024 04:14
@nuttycom nuttycom force-pushed the feature/transparent_gap_limit_handling branch from bd2df86 to 4b99663 Compare December 28, 2024 04:27
@nuttycom nuttycom requested a review from str4d December 28, 2024 04:27
Copy link

codecov bot commented Dec 28, 2024

Codecov Report

Attention: Patch coverage is 60.18265% with 436 lines in your changes missing coverage. Please review.

Project coverage is 54.15%. Comparing base (dc709d2) to head (89dcdfc).

Files with missing lines Patch % Lines
.../init/migrations/transparent_gap_limit_handling.rs 34.41% 101 Missing ⚠️
zcash_client_sqlite/src/wallet.rs 60.68% 92 Missing ⚠️
zcash_client_sqlite/src/lib.rs 58.74% 59 Missing ⚠️
zcash_client_sqlite/src/wallet/transparent.rs 75.00% 57 Missing ⚠️
zcash_client_sqlite/src/wallet/orchard.rs 0.00% 27 Missing ⚠️
zcash_client_sqlite/src/wallet/encoding.rs 55.35% 25 Missing ⚠️
zcash_client_sqlite/src/error.rs 0.00% 11 Missing ⚠️
zcash_client_sqlite/src/util.rs 18.18% 9 Missing ⚠️
.../src/wallet/init/migrations/ephemeral_addresses.rs 65.38% 9 Missing ⚠️
zcash_client_sqlite/src/wallet/sapling.rs 68.96% 9 Missing ⚠️
... and 9 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1673      +/-   ##
==========================================
- Coverage   54.17%   54.15%   -0.03%     
==========================================
  Files         176      179       +3     
  Lines       20469    21175     +706     
==========================================
+ Hits        11089    11467     +378     
- Misses       9380     9708     +328     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nuttycom nuttycom force-pushed the feature/transparent_gap_limit_handling branch 2 times, most recently from 1386dd1 to 49230de Compare December 30, 2024 22:20
str4d added a commit that referenced this pull request Dec 30, 2024
@nuttycom nuttycom force-pushed the feature/transparent_gap_limit_handling branch 2 times, most recently from b39c6c3 to 3ac0396 Compare December 30, 2024 22:33
str4d
str4d previously approved these changes Feb 11, 2025
Copy link
Contributor

@str4d str4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK eca51d6

@nuttycom nuttycom force-pushed the feature/transparent_gap_limit_handling branch from eca51d6 to 813dd24 Compare February 11, 2025 18:01
@nuttycom
Copy link
Contributor Author

force-pushed to fix conflicts with main

@nuttycom nuttycom marked this pull request as draft February 11, 2025 18:07
@nuttycom
Copy link
Contributor Author

Marked as draft at 813dd24 since we intend to make crate releases prior to the merge of this PR.

@nuttycom nuttycom force-pushed the feature/transparent_gap_limit_handling branch from 813dd24 to 709b9be Compare February 11, 2025 23:26
@nuttycom
Copy link
Contributor Author

force-pushed to rebase on main.

nuttycom and others added 14 commits February 25, 2025 13:22
This is a large change that unifies the handling of ephemeral
transparent addresses for ZIP 320 support with generalized "gap limit"
handling for transparent wallet recovery. The best way to understand
this commit is to start from the `transparent_gap_limit_handling`
database migration that drives the change in behavior.
…resses.

The rationale behind this change is that current implementations of UTXO
retrieval do not attempt to avoid revealing that multiple addresses
belong to the same wallet when using a light wallet server to check for
transparent UTXOs. A comprehensive solution to this problem requires
changes to the light wallet protocol such that wallets no longer need to
submit batches of addresses to the light wallet server, and can instead
determine whether outputs exist for their addresses locally.

By setting the default gap limit to 10 addresses, we make it possible
for wallets that add privacy-preserving UTXO checking in the future
(either by connecting to full node indexes directly in a
privacy-preserving manner or via changes that take advantage of an
updated light wallet protocol) to then start generating new addresses
within a range of the industry-standard 20 address gap limit that have
not yet been revealed to belong to the wallet.
In the presence of gap-limit addresses, querying for UTXOs based
exclusively upon the last height at which such a query was executed is
inadequate to fully recover the contents of a wallet; when a transaction
is discovered in the past, this may advance the gap limit, and newly
exposed addresses may receive outputs immediately following the
discovered transaction. We can expect that when a transparent output
belonging to the wallet is discovered, that the height at which that
transaction was mined was checked in a query that included _all_ of
addresses having child indices less than or equal to that of the
involved address. Therefore, it's safe to start looking for addresses in
the gap as of that point.
Also, this removes the default value for the `addresses.key_scope`
column, better reflecting the fact that all address insertion code needs
to properly set the key scope.
@nuttycom nuttycom force-pushed the feature/transparent_gap_limit_handling branch from 709b9be to cac7d28 Compare February 25, 2025 20:25
@nuttycom
Copy link
Contributor Author

force-pushed to rebase on main and fix changelogs after crate releases.

@nuttycom nuttycom force-pushed the feature/transparent_gap_limit_handling branch from 8db439f to f9fc8bb Compare February 25, 2025 20:31
@nuttycom nuttycom force-pushed the feature/transparent_gap_limit_handling branch from 2d61c05 to 89dcdfc Compare February 26, 2025 00:30
@nuttycom nuttycom marked this pull request as ready for review February 26, 2025 00:30
@nuttycom
Copy link
Contributor Author

nuttycom commented Feb 26, 2025

Logical changes since last reviews (post-rebase-on-main) are here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants