Repository navigation
fuzz: Backport the spkm_migration target (bitcoin/bitcoin#32624) - #445
Open
chrisguida wants to merge 2 commits into
Open
chrisguida wants to merge 2 commits into
chrisguida wants to merge 2 commits into
Conversation
Github-Pull: bitcoin#32977 Rebased-From: ba01585
Github-Pull: bitcoin#32624 Rebased-From: 779e782
|
Wallets upgraded via |
Ari4ka
approved these changes
Oct 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of bitcoin#32624 (the
spkm_migrationfuzz target forLegacyDataSPKM::MigrateToDescriptor), rooted atbranch-29.Why now: the same upstream commit drops
SelectParams(ChainType::MAIN)frominitialize_spkmin thescriptpubkeymantarget. That call frees the regtestCChainParamsthat the target'sTestingSetupchainman still references, so any wallet code that reads consensus params through the chain interface reads freed memory. #429 adds the first such read, and its fuzz CI job fails with a heap-use-after-free there (reported by @kwsantiago). Upstream removed the line as redundant without noticing the dangling reference.Commits, in upstream order:
MigrateToDescriptordecides whether to migrate the internal chain from the HD chain's own version instead of the wallet's feature version. The new target's accounting assumes this. The other five commits of wallet: Remove wallet version and several legacy related functions bitcoin/bitcoin#32977 remove the wallet-version machinery, which 29.x still needs for legacy wallets, so they are left out. For real wallets the two criteria agree: new chains are created split only when the wallet supports HD_SPLIT, and the wallet upgrade path bumps the chain version together with the wallet version.MigrateToDescriptorbitcoin/bitcoin#32624, the whole PR: adds thespkm_migrationtarget and drops theSelectParamsline. Rebased around 29.x'sTooDeepDerivPathhelper; otherwise unchanged.Left out: bitcoin#28333 (commit "Migrate hd seed once") and bitcoin#35437 (identical seeds with different IDs), which later adjusted this target. They are not needed for the qa-assets corpora to pass on 29.x, and they change migration behaviour, so they are a separate decision.
Verification, ASan/UBSan fuzz build (clang 19,
BUILD_FOR_FUZZING=ON, the fuzz CI job's sanitizers minus libFuzzer) on the 29.x-knots tip with these two commits:scriptpubkeymanclean over its 6784-input qa-assets corpus,spkm_migrationclean over its 1328. With bitcoin#32624 alone,spkm_migrationfails its accounting assertion on 14 of those inputs; that is the reason for commit 1. The use-after-free reproduces at #429's head a049372 and is gone with theSelectParamsline removed.