fuzz: wallet: add target for spkm migration#29694
fuzz: wallet: add target for spkm migration#29694brunoerg wants to merge 4 commits intobitcoin:masterfrom
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/29694. ReviewsSee the guideline for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
114066e to
d0c3ca9
Compare
|
cc: @achow101 |
d0c3ca9 to
2e7ac47
Compare
|
Inputs for this are available at: brunoerg/qa-assets#2 |
2e7ac47 to
77c31c8
Compare
|
Force-pushed addressing (multisig and hd chain cover): |
77c31c8 to
ed1a16b
Compare
ed1a16b to
cdc9458
Compare
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
|
Force-pushed addressing #29694 (comment) |
1421097 to
9750b3f
Compare
5e2e916 to
457f1d4
Compare
|
Rebased |
a7749a9 to
cbffd66
Compare
|
https://cirrus-ci.com/task/5046981191532544?logs=ci#L1799 |
cbffd66 to
0c0e79d
Compare
|
Just fixed CI, ready for review! |
pablomartin4btc
left a comment
There was a problem hiding this comment.
You are skipping the backup restore in commit: "wallet: skip backup restoration when using in-memory dbs"; shouldn't the backup itself be skipped too when in_memory?
src/wallet/wallet.cpp
Outdated
There was a problem hiding this comment.
I think if you add the condition there, there are other stuff that's missing and I think they need to be done which are:
- the for after
// Unload the wallets; - the lines after
// Verify that there is no dangling wallet
There was a problem hiding this comment.
Why? the for after // Unload the wallets are basically playing with created_wallets which is used only if the db is not in memory. Same for the lines after // Verify that there is no dangling wallet which needs ptr_wallet.
There was a problem hiding this comment.
the for after
// Unload the wallets...
There's the removal of the wallet from the context (if (!RemoveWallet(context, w, /*load_on_start=*/false)) {) using created_wallets - that was done when the wallet was loaded (in LoadWalletInternal-> AddWallet(context, wallet); ).
the lines after
// Verify that there is no dangling walletwhich needsptr_wallet.
At the end of the condition is returning an error (return util::Error{error};)
Be aware that if you remove the commit wallet: skip backup restoration when using in-memory dbs altogether you need to add a conditional to avoid the restore section.
At some point I think we need to refactor the wallet and extract the wallet migration behaviour into a new/ few object/ s.
For in-memory SQLite databases, exclusive locking is generally not necessary because in-memory dbs are private to the connection that created them.
By using in-memory databases, we do not have dbs file to delete and restore.
0c0e79d to
c2bbe12
Compare
|
🐙 This pull request conflicts with the target branch and needs rebase. |
|
I'm reworking this target, will draft it. |
|
Closing in favor of #32624. |
779e782 fuzz: wallet: add target for `MigrateToDescriptor` (brunoerg) Pull request description: This PR adds fuzz coverage for the scriptpubkeyman migration (`MigrateToDescriptor`). Note that it's a test for the migration of the scriptpubkey manager, not for the whole migration process as tried in #29694, because: 1) The wallet migration deals with DBs which is expensive for fuzzing (was getting around 3 exec/s); 2) Mocking would require lots of refactors. This target loads keys, HDChain (even inactive ones), watch only and might add tons of different scripts, then calls `MigrateToDescriptor`. It does not play with encrypted stuff because it would make the target super slow. Also, after the migration there are some assertions that would work as a regression test for #31452, for example. ACKs for top commit: frankomosh: Code Review ACK 779e782 marcofleon: reACK 779e782 Tree-SHA512: 08ef5166602c21658765bc063c5421e81055d094d346c4e2a28215209c6b7768b99a424f3ba47cf718dc8d827a588da22394ba23402a40a71a976d80d65e6c2e
This PR adds a fuzz target for
ScriptPubKeyManmigration. It creates aLegacyDataSPKMwhich can have some keys/scripts/etc, and then migrate it to descriptor. I tried to keep it as compatible as possible with future legacy wallet removal.