-
Notifications
You must be signed in to change notification settings - Fork 263
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
Check for colliding component FVKs #1489
Check for colliding component FVKs #1489
Conversation
…accounts. Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
fcbf3f3
to
90f8789
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1489 +/- ##
==========================================
- Coverage 61.16% 61.13% -0.03%
==========================================
Files 141 141
Lines 16661 16663 +2
==========================================
- Hits 10190 10187 -3
- Misses 6471 6476 +5 ☔ View full report in Codecov by Sentry. |
050a58e
to
59d9224
Compare
// Make a best effort to determine the AccountId of the pre-existing row | ||
// An account conflict occurred. This should already have been caught by | ||
// the check using `get_account_for_ufvk` above, but in case it wasn't, | ||
// make a best effort to determine the AccountId of the pre-existing row | ||
// and provide that to our caller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code just below this will no longer be reached when a collision occurs, which explains the small reduction in test coverage.
(if available) collides with an existing imported or derived FVK. This does not check for collisions on IVK for `Incoming` accounts. Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
59d9224
to
bd38645
Compare
let seed_based = st.wallet_mut().create_account(&seed, &birthday).unwrap(); | ||
let seed_based_account = st.wallet().get_account(seed_based.0).unwrap().unwrap(); | ||
let ufvk = seed_based_account.ufvk().unwrap(); | ||
|
||
assert_matches!( | ||
st.wallet_mut().import_account_ufvk(ufvk, &birthday, AccountPurpose::Spending), | ||
st.wallet_mut().import_account_hd(&seed, zip32_index_0, &birthday), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import_account_ufvk
check is done in check_collisions
below, so this is adding an extra check for collisions between create_account
and import_account_hd
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK bd38645
Post-hoc utACK bd38645 |
When adding an account, check whether any component of its UFVK (if available) collides with an existing imported or derived FVK.
This does not check for collisions on IVK for
Incoming
accounts (#1490), which is okay because those are not yet exposed in the public API.Builds on #1479, fixes #1474