#35997 refactor: bench: make_hard_case to find a solution
https://github.com/bitcoin/bitcoin/pull/35997 · · +11/-6 in 1 files, 1 commits · labels: Refactoring
Goal
- Make the coin selection exhaustion benchmark use realistic target and UTXO amounts
- Ensure the benchmark verifies a valid solution is found when reaching the search limit
Updates the `BnBExhaustion` coin selection benchmark in `src/bench/coin_selection.cpp`. It alters `make_hard_case` to generate more realistic target and UTXO amounts while keeping search attempts at the 100,000 evaluation limit, and adds assertions verifying the evaluated count and solution properties.
Problem: The existing BnB exhaustion benchmark used artificially large synthetic UTXO values and did not assert that an actual solution was found upon hitting the evaluation limit.
Category: Test infrastructure (#41 of 45)
P4 · cleanup
- P4 because it only adjusts parameters and assertions in an isolated microbenchmark
- Does not fix test flakiness or improve shared test framework infrastructure
P4 because it only modifies parameters and adds assertions in an isolated microbenchmark. It does not fix flaky tests or improve general test framework capabilities.
Membership: Changes benchmark setup and execution code in src/bench/coin_selection.cpp.
Factors: security/stability 0, bug 0, performance 0, user value 0, leverage 0
Reviewability: Ready
- Ready to review
- Small, self-contained change with passing CI
The PR is small and self-contained with no outstanding author questions or failing CI.
Author status: active
Agreement: Positive
- Verified that benchmark reaches evaluation limits with proper assertions (Dontbyshai)
- Minor follow-up adjustment to parameter realism has no objections
Positive; Dontbyshai verified and ACKed earlier push, author updated parameters since without objection.
Dontbyshai tested and approved the benchmark logic and assertions. The author made a minor follow-up adjustment to parameter realism with no objections raised.
- Dontbyshai ACKed: 'The results confirm that the benchmark reaches the limit of 100,000 evaluations.'
Review verdicts (DrahtBot): 0
- Concept ACK: Dontbyshai
Files
17 lines under test/bench/ci.
- src/bench/coin_selection.cpp +11/-6
Card
This PR refactors the BnBExhaustion benchmark in src/bench/coin_selection.cpp to use more realistic UTXO values and target sizes while maintaining exhaustion of the 100,000 evaluation limit. It also adds assertions to verify that a valid solution is produced. As an internal benchmark adjustment, it has marginal importance. One reviewer tested and verified the behavior before a minor follow-up parameter adjustment by the author.