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: Always check for seed relevance in init_wallet_db #1286

Merged
merged 7 commits into from
Mar 19, 2024

Conversation

str4d
Copy link
Contributor

@str4d str4d commented Mar 18, 2024

Closes #1283.

@str4d str4d added this to the Librustzcash Zashi 1.0 milestone Mar 18, 2024
@str4d str4d force-pushed the 1283-zcs-migration-seed-relevance branch from f9aa896 to a15ebf7 Compare March 18, 2024 23:43
Copy link

codecov bot commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 47.00000% with 53 lines in your changes are missing coverage. Please review.

Project coverage is 63.46%. Comparing base (da64e8a) to head (4fa0547).

Files Patch % Lines
zcash_client_sqlite/src/wallet/init.rs 25.92% 20 Missing ⚠️
..._sqlite/src/wallet/init/migrations/ufvk_support.rs 25.00% 12 Missing ⚠️
...ite/src/wallet/init/migrations/full_account_ids.rs 27.27% 8 Missing ⚠️
zcash_client_backend/src/data_api.rs 0.00% 7 Missing ⚠️
zcash_client_sqlite/src/wallet.rs 77.27% 5 Missing ⚠️
zcash_client_sqlite/src/lib.rs 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1286      +/-   ##
==========================================
- Coverage   63.54%   63.46%   -0.09%     
==========================================
  Files         121      121              
  Lines       13820    13890      +70     
==========================================
+ Hits         8782     8815      +33     
- Misses       5038     5075      +37     

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

nuttycom
nuttycom previously approved these changes Mar 19, 2024
Copy link
Contributor

@nuttycom nuttycom left a comment

Choose a reason for hiding this comment

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

utACK with minor confusion about migration errors.

zcash_client_backend/src/data_api.rs Show resolved Hide resolved
Comment on lines +253 to +254
seed: &SecretVec<u8>,
seed_fingerprint: &SeedFingerprint,
Copy link
Contributor

Choose a reason for hiding this comment

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

I find it surprising that this takes both the seed and the seed fingerprint, but I guess that since it's a helper it's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are from two different data sources:

  • seed comes from the caller.
  • seed_fingerprint comes from the wallet.

The helper is explicitly checking their consistency.

str4d added 7 commits March 19, 2024 00:32
The blanket `impl Account<A> for (A, Option<UnifiedFullViewingKey>)` is
removed because we cannot know the UIVK for `(A, None)`. We instead
provide a blanket impl for `(A, UnifiedIncomingViewingKey)`. We also
move both of them behind `test-dependencies` because they are only
intended for testing purposes.
The previous implementation was mixing the caller-provided seed with the
wallet-provided ZIP 32 account index, and throwing an error if the USK
derivation failed. We instead need to count that as a mismatch, because
the wallet account's actual seed would derive a USK fine (because wallet
accounts are required to have a known UIVK).
@str4d str4d force-pushed the 1283-zcs-migration-seed-relevance branch from a15ebf7 to 4fa0547 Compare March 19, 2024 00:35
@str4d
Copy link
Contributor Author

str4d commented Mar 19, 2024

Force-pushed to address review comments.

Copy link
Contributor

@nuttycom nuttycom 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 4fa0547

@str4d str4d merged commit 5b3ebca into main Mar 19, 2024
21 of 26 checks passed
@str4d str4d deleted the 1283-zcs-migration-seed-relevance branch March 19, 2024 01:00
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.

zcash_client_sqlite: Integrate "is relevant seed" logic into database migration
2 participants