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

Merged
merged 31 commits into from
Mar 4, 2025

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 62.88318% with 448 lines in your changes missing coverage. Please review.

Project coverage is 54.26%. Comparing base (584deb4) to head (6793a7d).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
.../init/migrations/transparent_gap_limit_handling.rs 34.41% 101 Missing ⚠️
zcash_client_sqlite/src/wallet.rs 55.85% 98 Missing ⚠️
zcash_client_sqlite/src/lib.rs 62.50% 57 Missing ⚠️
zcash_client_sqlite/src/wallet/transparent.rs 75.33% 55 Missing ⚠️
zcash_client_sqlite/src/wallet/encoding.rs 72.00% 28 Missing ⚠️
zcash_client_sqlite/src/wallet/orchard.rs 0.00% 27 Missing ⚠️
zcash_keys/src/keys.rs 70.45% 13 Missing ⚠️
zcash_client_sqlite/src/error.rs 0.00% 12 Missing ⚠️
.../src/wallet/init/migrations/ephemeral_addresses.rs 65.38% 9 Missing ⚠️
zcash_client_sqlite/src/wallet/sapling.rs 68.96% 9 Missing ⚠️
... and 13 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1673      +/-   ##
==========================================
+ Coverage   54.17%   54.26%   +0.08%     
==========================================
  Files         176      179       +3     
  Lines       20469    21243     +774     
==========================================
+ Hits        11089    11527     +438     
- Misses       9380     9716     +336     

☔ 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
account_id,
key_scope,
&wdb.gap_limits,
UnifiedAddressRequest::unsafe_custom(Allow, Allow, Require),
Copy link
Contributor

Choose a reason for hiding this comment

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

account.internal_id(),
KeyScope::EXTERNAL,
gap_limits,
UnifiedAddressRequest::unsafe_custom(Allow, Allow, Require),
Copy link
Contributor

Choose a reason for hiding this comment

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

.expect("gap limit fits in usize"),
)?;

// Find the first index that generates an address conforming to the request.
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we resolve the issue with there being a significant probability of not finding any Sapling addresses within the gap limit?

account_id,
key_scope,
gap_limits,
UnifiedAddressRequest::unsafe_custom(Allow, Allow, Require),
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +85 to +87
/// This column exists because the diversifier index is stored as a byte array, meaning that we
/// cannot use SQL integer operations on it for gap limit calculations, and thus need it as an
/// integer as well.
Copy link
Contributor

Choose a reason for hiding this comment

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

It occurs to me that we could store the diversifier index as pairs of SQL integers, the high 56 bits and the low 32 bits. That would be normalized, easily sortable in SQL, and easy to check in SQL that the high bits are all 0. Filed #1731.

find_gap_start(&db.conn, account_id, KeyScope::Ephemeral, db.gap_limits.ephemeral()), Ok(addr_index)
if addr_index == Some(NonHardenedChildIndex::ZERO)
);
//assert_matches!(ephemeral::first_unstored_index(&db.conn, account_id), Ok(addr_index) if addr_index == GAP_LIMIT);
Copy link
Contributor

@daira daira Mar 4, 2025

Choose a reason for hiding this comment

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

Is this assertion correct? Delete it if it isn't correct, otherwise uncomment it. Non-blocking.

daira
daira previously approved these changes Mar 4, 2025
@daira daira force-pushed the feature/transparent_gap_limit_handling branch from a93fb07 to 12e1a10 Compare March 4, 2025 08:33
daira
daira previously approved these changes Mar 4, 2025
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

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

utACK

@daira daira force-pushed the feature/transparent_gap_limit_handling branch from 12e1a10 to 635c94b Compare March 4, 2025 08:37
daira and others added 3 commits March 4, 2025 08:41
Co-authored-by: Jack Grigg <[email protected]>
Signed-off-by: Daira-Emma Hopwood <[email protected]>
…uts"

feature is not enabled.

Signed-off-by: Daira-Emma Hopwood <[email protected]>
Signed-off-by: Daira-Emma Hopwood <[email protected]>
@daira daira force-pushed the feature/transparent_gap_limit_handling branch from 635c94b to 19e0e39 Compare March 4, 2025 08:56
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

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

Self-ACK for the last three commits.

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.

Re-utACK 19e0e39

@str4d str4d merged commit 1dfd237 into zcash:main Mar 4, 2025
30 of 32 checks passed
@nuttycom nuttycom deleted the feature/transparent_gap_limit_handling branch March 4, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-please-do-not-rebase Status: Please do not rebase this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants