mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 12:20:38 +00:00
test: fuzz: check CoinGrinder completed flag #36905
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!36905
Loading…
Reference in a new issue
No description provided.
Delete branch "test-coingrinder-algo-completed"
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?
CoinGrindermarks its result as completed when it exhausts the search space before reachingTOTAL_TRIES, and leaves it incomplete when it stops at the limit. No unit test reads this flag, and thecoin_grinderandcoin_grinder_is_optimalfuzz targets only use it to decide whether to assert optimality, so a wrong value would go unnoticed.This PR checks
GetAlgoCompleted()incoin_grinder_testsfor cases that finish below the attempt limit (100,000), and asserts in both fuzz targets that the flag is true below the limit and false once it is reached.Kills the following mutants:
https://mutanthub.space/mutants/4402
https://mutanthub.space/mutants/4401
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.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, 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.
No verified findings are available from this review.
Review coverage was incomplete.
Reviewed:
e5ee8a965888· Review report · Previous reportspermalink
ACK
e5ee8a9658tACK
e5ee8a9658I applied each mutant separately on macOS arm64. For each build, I ran
coin_grinder_testsand replayed both seed corpora fromqa-assetsat9c61fa724using the standalone fuzz binary.coin_grinder_testscoin_grinder(681 inputs)coin_grinder_is_optimal(231 inputs)falseon search exhaustion)github.com/bitcoin/bitcoin@e5ee8a9658/src/wallet/test/fuzz/coinselection.cpp (L125))github.com/bitcoin/bitcoin@e5ee8a9658/src/wallet/test/fuzz/coinselection.cpp (L202))trueat the attempt limit)Both assertion line numbers refer to
src/wallet/test/fuzz/coinselection.cpp. I applied the mutations insrc/wallet/coinselection.cpp.For 4401,
f94e50c75af1ee1fbe07abb16850bcf5dd28775dwas the first input to trigger the assertion in my run. The runner shuffles the corpus. [Reproducing input](github.com/bitcoin-core/qa-assets@9c61fa724a/fuzz_corpora/coin_grinder/f94e50c75af1ee1fbe07abb16850bcf5dd28775d)One optional addition would be a unit test alongside
bnb_exhaustion_with_solution_testincoinselection_tests.cpp. I tried 20 groups built withMakeCoin(COIN + i)forifrom 0 to 19, a target of10 * COIN, zero change target andMAX_STANDARD_TX_WEIGHT. With the PR, CoinGrinder returned enough to cover the target after exactly 100,000 evaluations, withGetAlgoCompleted()false. The same test passed with 4402. With 4401, onlyBOOST_CHECK(!result->GetAlgoCompleted())failed.