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

zcash_client_sqlite: Ensure that all shielded change outputs are correctly flagged. #1585

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

Conversation

nuttycom
Copy link
Contributor

@nuttycom nuttycom commented Oct 23, 2024

Fixes #1571

…ash#1571

The update to a shielding transaction causes the information that the
output is considered change to be lost. This happens because the
scanning process does not have access to any information about the
inputs to the transaction, and so it does not recognize the output as
change.
…scind that determination.

This is a minimal and correct but incomplete fix for
zcash#1571. Additional work to distinguish change outputs
is necessary to update existing wallets that have made an incorrect
change determination in the past.
@nuttycom nuttycom changed the title zcash_client_sqlite: Once a note is determined to be change, don't rescind that determination. zcash_client_sqlite: Ensure that all shielded change outputs are correctly flagged. Oct 23, 2024
Copy link

codecov bot commented Oct 23, 2024

Codecov Report

Attention: Patch coverage is 91.83673% with 4 lines in your changes missing coverage. Please review.

Project coverage is 61.95%. Comparing base (bf8b39a) to head (0d82e1e).

Files with missing lines Patch % Lines
.../wallet/init/migrations/fix_bad_change_flagging.rs 80.95% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1585      +/-   ##
==========================================
+ Coverage   61.88%   61.95%   +0.07%     
==========================================
  Files         149      150       +1     
  Lines       18946    18994      +48     
==========================================
+ Hits        11724    11768      +44     
- Misses       7222     7226       +4     

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

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.

Reviewed 0d82e1e

// Complete the migration
init_wallet_db(st.wallet_mut().db_mut(), None).unwrap();

// Ensure that the transaction metadata is still correct after the update produced by scanning.
Copy link
Contributor

Choose a reason for hiding this comment

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

What scanning update? AFAICT this test doesn't do one; it just checks that the unscanned shielding transaction's metadata is not altered by the migration. It might indeed be useful to have two tests for this migration: one that ensures correct data isn't altered, and one that ensures incorrect data gets fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy/paste error - this comment was correct in the test for the change from IS_NULL to MAX, and the test is the same.

zcash_client_sqlite/src/wallet.rs Show resolved Hide resolved
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.

Bug in is_shielding state going from TRUE to FALSE after the first confirmation
2 participants