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

Make WalletWrite documentation for colliding accounts more precise #1479

Closed
wants to merge 1 commit into from

Conversation

str4d
Copy link
Contributor

@str4d str4d commented Jul 31, 2024

Part of #1474.

Copy link

codecov bot commented Aug 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.82%. Comparing base (7f7b685) to head (65447c1).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1479   +/-   ##
=======================================
  Coverage   60.82%   60.82%           
=======================================
  Files         140      140           
  Lines       16472    16472           
=======================================
  Hits        10019    10019           
  Misses       6453     6453           

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

Comment on lines +1587 to +1596
/// would produce the same UFVK, an error will be returned. While any combination of
/// method calls can cause this, there are two main ways it can occur that users of the
/// `WalletWrite` trait should watch out for:
/// - An account is created via [`WalletWrite::create_account`] with an auto-selected
/// ZIP 32 account index, and that index is later imported explicitly via either
/// [`WalletWrite::import_account_hd`] or [`WalletWrite::import_account_ufvk`].
/// - An account is imported via [`WalletWrite::import_account_ufvk`], and the ZIP 32
/// account index corresponding to that account's UFVK is later imported either
/// implicitly via [`WalletWrite::create_account`] or explicitly via
/// [`WalletWrite::import_account_hd`].
Copy link
Contributor

@daira daira Aug 2, 2024

Choose a reason for hiding this comment

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

Suggested change
/// would produce the same UFVK, an error will be returned. While any combination of
/// method calls can cause this, there are two main ways it can occur that users of the
/// `WalletWrite` trait should watch out for:
/// - An account is created via [`WalletWrite::create_account`] with an auto-selected
/// ZIP 32 account index, and that index is later imported explicitly via either
/// [`WalletWrite::import_account_hd`] or [`WalletWrite::import_account_ufvk`].
/// - An account is imported via [`WalletWrite::import_account_ufvk`], and the ZIP 32
/// account index corresponding to that account's UFVK is later imported either
/// implicitly via [`WalletWrite::create_account`] or explicitly via
/// [`WalletWrite::import_account_hd`].
/// would produce the same UFVK, an error will be returned. This can occur in the
/// following cases:
/// - An account is created via [`WalletWrite::create_account`] with an auto-selected
/// ZIP 32 account index, and that index is later imported explicitly via either
/// [`WalletWrite::import_account_ufvk`] or [`WalletWrite::import_account_hd`].
/// - An account is imported via [`WalletWrite::import_account_ufvk`] or
/// [`WalletWrite::import_account_hd`], and then the ZIP 32 account index
/// corresponding to that account's UFVK is later imported either implicitly
/// via [`WalletWrite::create_account`], or explicitly via a call to
/// [`WalletWrite::import_account_ufvk`] or [`WalletWrite::import_account_hd`].

This is now exhaustive, I think. I had misunderstood the semantics previously, but that just shows the importance of getting this documentation right.

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

/// account index corresponding to that account's UFVK is later imported either
/// implicitly via [`WalletWrite::create_account`] or explicitly via
/// [`WalletWrite::import_account_hd`].
///
Copy link
Contributor

@daira daira Aug 9, 2024

Choose a reason for hiding this comment

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

Suggested change
///
///
/// Note that accounts having UFVKs that are not identical but have shared
/// components (for example, two accounts having the same Sapling FVK, one
/// of which also has an Orchard FVK while the other does not) are currently
/// allowed. This will not be allowed in future.
///

@str4d wrote (in response to slightly different wording of the last sentence that said "may not" rather than "will not"):

NACK, I think we should decide how to handle this, and not in this PR.

Absolutely we should, but this documents the current behaviour correctly. Then in the PR where we fix it (which I agree, should be before the release), we can and should change the comment accordingly.

Copy link
Contributor

Choose a reason for hiding this comment

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

These suggestions are included in #1489, which then goes on to fix it and change the comment.

@zcash zcash deleted a comment from str4d Aug 9, 2024
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.

Updated my comments, and split the suggested changes for clarity.

@daira
Copy link
Contributor

daira commented Aug 12, 2024

#1489 has been merged including these changes.

@daira daira closed this Aug 12, 2024
@daira daira deleted the 1474-doc-fixes branch August 12, 2024 14:47
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.

2 participants