mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 11:50:39 +00:00
test: cover missing BIP352 cases #36995
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36995
Loading…
Reference in a new issue
No description provided.
Delete branch "test-bip352-mutants"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The existing BIP352 tests leave several cases insufficiently covered. To identify these gaps, I ran manual mutation testing against
src/common/bip352.cpp, complemented bybcore-mutation. Out of 55 mutations, 33 survived with the existing tests.With these tests, 52 of the 55 mutations are detected. The three remaining mutations are equivalent to the original implementation.
One mutation replaces the
return std::nulloptwithbreakwhenGetOpfails while scanning a P2PKH scriptSig. The function reaches the samereturn std::nulloptafter the loop. Another removes the early return for the case where there are no eligible keys, checking only whether there are no inputs. With no keys, libsecp256k1 already returns a failure, so the result remainsNOT_ELIGIBLE. The third mutation changes the P2PKH scriptSig scanning loop condition frompc < txin.scriptSig.end()topc <= txin.scriptSig.end(). Whenpcreaches the end of the scriptSig,GetOpfails, and the function returns the samestd::nullopt.The new tests cover scan label reporting, P2PKH public key extraction when the
scriptSigcontains unrelated pushes, invalid public keys across supported input types, P2SH-P2WPKH eligibility, Taproot script-path spends, annex handling, control block validation, prevouts summary errors, Silent Payments destination validation, label copy assignment, maximum-size control block acceptance, and the behavior ofScanwhen none of the outputs is a valid x-only key.The existing
bip352_skips_transactions_spending_unknown_segwit_versionstest is also extended to cover SegWit versions v2 through v16 and check the exactNOT_ELIGIBLEerror. The address decoding tests also cover a v0 address with a valid Bech32m checksum but one extra data byte (67 instead of 66). The existingbip352_scan_skips_invalid_taproot_outputstest is extended to verify thatScanreturns an empty list, rather than an error, when none of the outputs is a valid x-only key.The changes are limited to
src/test/bip352_tests.cpp. No production code is modified.The tests also pass on top of the P2SH changes from #36776. The annex-related mutations are detected independently of #36992.
Using
bcore-mutationwith--one-mutantand thebip352_teststest suite, the mutation score improves from 83.93% (9 of 56 mutations surviving on master) to 91.07% (5 of 56 surviving with the first PR version) and finally to 98.21% (1 of 56 surviving with this version). The only remaining survivor is the equivalent P2PKH loop-boundary mutation described above.src/common/bip352.cppis not included in the continuous mutation-testing runs on corecheck, so these gaps are not covered by those runs.The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.
I found no actionable issues in this static review.
Reviewed:
e8f9dd94b694· Review report · Previous reportspermalink