mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:26:38 +00:00
test: SRD tie-break test #36740
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!36740
Loading…
Reference in a new issue
No description provided.
Delete branch "srd-tiebreak-check"
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?
I was researching coin selection when I came across this bug, so I thought I'd fix it
Pr #33223 adjusts weight selection to keep the lighter coin when two coins have the same value, but the test has two mistakes, as confirmed in this comment
mixed_weight_poolbut passesutxo_pooltoTestSRDSuccess.4 * 3 * 67= 804 WU) fits any two coins (544 WU)If you reverse #33223, it still passes, which means it misses the tie-break
The fix
The test now uses `mixed_weight_pool and adds an extra light coin so that only two light coins can fit together and evicts a coin on every tie to pass.
Lowers the max weight to 536 WU; SRD now has to evict the heavier coin on every tie to succeed
This should show failed tests with bitcoin#33223 reverted and pass on master.
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.
Earlier concerns remain unresolved; see the Run archive linked from the Review report.
No verified findings are available from this review.
Review coverage was incomplete.
Reviewed:
751956e3ca9b· Review report · Previous reportspermalink
Concept ACK.
PR 33223 added a tie breaker condition such that if two UTXOs are the same effective_value, sort such that the lighter UTXO is preferred. This creates a lighter and thus cheaper transaction.
The sort is defined by 33223 here:
However, the test added did not actually test the new behavior since selecting two UTXOs needed to hit the target did not cause an eviction to take place. Confirmed that this PR fixes that by lowering the weight limit which causes the heap to pop an item, and in so doing, must sort and then perform the eviction. The second lighter UTXO is added such that the only solution that causes completion is when both lighter UTXOs remain and the heavier UTXOs evicted.
Approach ACK
just a nit, but I think this for loop just adds test complexity. There are only two utxos, so it would be more clean to just assert the weight of each UTXO without a loop.
nit, I think this require is superfluous since even without it, the next asserts couldn't pass.
done, removed
replaced the loop with a weight check
From https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md
noted, Thanks for this
ACK
2ade73da7atACK
2ade73da7aTested on macOS 27.0.1 arm64, using master
fcf76ea549for comparison.srd_testpasses on the PR.With the comparator change from #33223 reverted, the PR’s test fails while master’s test passes.
I also checked that the 536 WU limit only allows the two lighter coins together. Whenever a heavier coin makes the selection exceed that limit, it must be evicted for selection to succeed.
@Zeegaths please write your pull request descriptions in your own words. Not doing so is in violation of our AI policy. Most of the lines are basically redundant statements. Reviewers are expected to know basic git usage, how to run the tests and make them fail by undoing prior work, and read a diff to figure out which tests are changed. What it should say is why the change is important to you.
i see what you mean. lmk if that works
It does read a bit better. I think people can count for themselves how many tests are being run though.
got it, thankyou
Note that this is a non-deterministic code path being tested. It looks like because of issue 1) it would never fail if 33223 is revered. However, I think 2) may fail if 33223 is undone and the random selection happened to select the lighter coin on it's first attempt even with no eviction, although this is very unlikely.
noted
When you force push like this it dismisses the reviews people have done. And if you don't explain why you are force pushing, it requires people to need to re-review all changes. Is this just a rebase? If so, it's nice to say that so people reviewing save time trying to figure out what changed.
yes, It's just a rebase
re-ACK
b1240a856eThe range-diff against
2ade73da7ashows an unchanged patch.Tested ACK
b1240a856e.cc @murchandamus
ACK
b1240a856etested ACK
tested the committed changes and they fail against the production fix at
eff9e79but pass on the PR's latest commit atb1240a8Please use the helper function rather than duplicating the checks
Switched the checks to the helper function 751956e
ACK
751956e3caCI looks like its down, however tests pass locally.
reACK
751956e3ca. Only change is switching to the TestSRDSuccess helper.