test: proptest that LowestFee finds planted single-input optimum#45
Draft
evanlinjin wants to merge 1 commit into
Draft
test: proptest that LowestFee finds planted single-input optimum#45evanlinjin wants to merge 1 commit into
evanlinjin wants to merge 1 commit into
Conversation
…imum Plants a candidate sized exactly target + fee_for_1_input alongside up to 200 dust noise candidates, then asserts BnB picks just the planted one. Since (a) noise can't sum to cover the target and (b) any noise added to the planted candidate strictly raises the score (or invalidates the selection), [planted] is the unique optimum. Unlike can_eventually_find_best_solution, this stresses BnB at N > 20 without paying for exhaustive search. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Adds a constructive proptest covering an edge case that
can_eventually_find_best_solutiondoesn't reach: BnB at large N (up to ~200 candidates) finding an obvious 1-input optimum without paying the cost of exhaustive search.The construction:
value = target_value + fee_for_1_input(computed by probing with a dummy candidate's weight).n_noise ≤ 200 < target_value ≥ 10_000, noise can never sum to cover the target, and (b) adding any noise to the planted candidate either makes the fee delta exceed the +1 sat value (target no longer met) or triggers drain (score strictly >fee_for_1_input), the planted candidate alone is the unique optimum.10 * (n_noise + 2)rounds.No production code changes — this is a test-only addition.
Test plan
cargo test --release --test lowest_fee lowest_fee_finds_planted_single_input(256 proptest cases)cargo test --release --test lowest_fee(full suite, all 8 tests pass)🤖 Generated with Claude Code