-
Notifications
You must be signed in to change notification settings - Fork 37.8k
wallet: fix crash during migration due to invalid multisig descriptors #31378
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
base: master
Are you sure you want to change the base?
wallet: fix crash during migration due to invalid multisig descriptors #31378
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31378. ReviewsSee the guideline for information on the review process. ConflictsNo conflicts as of last run. |
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.
Ruling out consensus-invalid scripts makes sense, but discarding non-standard scripts is a much bigger leap. Also it would be a wack-a-mole: does the migration crash on any non-standard script? How much of that do you want to cover? Is it not possible to make the migration not crash on valid but not standard scripts instead of changing IsMine
for those?
Ok, I might have made the PR/commit description too broad when the actual changes are very specific. Ultimately, we’re preserving/freezing the legacy wallet’s existing behavior ahead of its removal. We shouldn’t allow spendability or migration (even though it’s not possible anyway) of scripts that were not functional during the lifetime of the legacy wallet anyway.
It’s possible, but it would mean duplicating more code. Still, at least for this case, I don't think it matters much. #30328 inlines the I'll update the PR description to reflect the actual scope of this fix. it's not as broad as I initially described. |
4a1c3d8
to
d641931
Compare
…scripts as ours Ensure legacy wallet migration skips the never standard bare multisig with +3 keys and consensus-invalid multisig scripts. Treating them as valid causes migration to crash because we are enforcing this rules within the descriptors parsing logic.
d641931
to
74fa29e
Compare
cdaa3a5 "wallet: bugfix, stop treating multisig consensus-invalid/unspendable scripts as ours" modifies legacy I think that fixes to migration should be limited to the migration only code. Perhaps it would be easier to cherry pick the tests and migration specific fixes into #30328? |
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.
cdaa3a5 "wallet: bugfix, stop treating multisig consensus-invalid/unspendable scripts as ours" modifies legacy
IsMine()
, ostensibly to mix issues in migration. However, I don't think doing that makes sense that this point as legacyIsMine
is going to be removed from migration with #30328, and any changes to it may result in incompatibilities with legacy wallets and migrated wallets.
I'm not going too strong over this point but.. it's hard for me to see the incompatibilities when the changes block two consensus-invalid scripts and a +10 year-old non-standard script that is already blocked in other parts of the legacy wallet. Arguably, this could also be labeled as a legacy wallet bugfix.
I think that fixes to migration should be limited to the migration only code. Perhaps it would be easier to cherry pick the tests and migration specific fixes into #30328?
I was aiming to keep #30328 purely as a refactoring without mixing in bug fixes. Reviewing the PR's matching functionality has been challenging in its current state, so I think that it would be good if we don’t expand it more than strictly necessary.
Note: If, after this comment, the general consensus is still to leave IsMine
untouched, maybe postponing this PR until after #30328 would be the path that satisfies everyone?
Then let's do it afterwards. |
That sounds dumb. Why are we? |
@luke-jr can you rephrase your comment in a friendlier way please |
I assume this was simply because there was no need to represent them in the descriptors' language. They've been non-standard for at least the past 10 years now. However, there's no documentation about it. This restriction has always been present; it was introduced in the first commit that added descriptors in #13697. We could relax the parsing restriction if a real use case arises. Until then, the descriptor's inference and parsing must allow for round-trips. That being said, this PR might not end up getting merge. #31495 contains a general round-trip check that does not touch the legacy wallet |
Could turn into draft while the CI is failing? |
🤔 There hasn't been much activity lately and the CI seems to be failing. If no one reviewed the current pull request by commit hash, a rebase can be considered. While the CI failure may be a false positive, the CI hasn't been running for some time, so there may be a real issue hiding as well. A rebase triggers the latest CI and makes sure that no silent merge conflicts have snuck in. |
1 similar comment
🤔 There hasn't been much activity lately and the CI seems to be failing. If no one reviewed the current pull request by commit hash, a rebase can be considered. While the CI failure may be a false positive, the CI hasn't been running for some time, so there may be a real issue hiding as well. A rebase triggers the latest CI and makes sure that no silent merge conflicts have snuck in. |
Ensure legacy wallet migration skips the never standard bare multisig with +3 keys
and consensus-invalid multisig scripts. Treating them as valid causes migration to
crash because we are enforcing this rules within the descriptors parsing logic.
Testing Notes:
This can be verified by cherry-picking and running the test commit on master.
It will crash there but pass on this branch.