mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
test: split test_IsStandard into independent test cases #36831
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!36831
Loading…
Reference in a new issue
No description provided.
Delete branch "test-split-isstandard"
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?
Part of #36692: This splits it into one test case per policy rule, each building its own transaction.
The first commit replaces
g_dustandg_bare_multiglobals by aStandardPolicystruct, which defaults to the node defaults and is passed to each check, e.g.CheckIsStandard(t, {.max_op_return_relay = 83}), so no case changes policy for another.Second commit splits
test_IsStandardinto independent test cases i.e. one test case per policy rule. Each starts from its own standard transaction built by a newMakeTxhelper. Since transactions are no longer carried over between checks, some values that are irrelevant to the rule under test differ from before.Third commit builds
IsStandardtest transactions declaratively. Each check constructs its transaction in one expression instead of mutating a shared one.CheckDustThresholdhelper also deduplicates repeated "not dust at the threshold, dust one satoshi below" from test cases.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.
🔵 Suggestion ·
CheckDustThresholdleaves its auxiliary outputs unexplainedThe threshold checks are correct, but the helper omits why its extra zero-value outputs are necessary to observe an output's dust threshold through
IsStandardTx.Location:
src/test/transaction_standardness_tests.cpp:81(head).🔵 Suggestion · Commit
083811f6leaves itsOP_RETURNvalue normalization unmentionedThe declarative rewrite also changes two tests'
OP_RETURNoutput values from90 * CENTto zero, adding an unmentioned fixture change to audit even though the policy results and asserted weights are unchanged.Location: src/test/transaction_tests.cpp:854 (commit).
Review coverage was incomplete.
Reviewed:
608b99a0d87c· Review report · Previous reportspermalink
Concept ACK
Looks good, in my review I ran across a few questions / NITS
NIT (non-blocking): rename test from
test_IsStandard_dusttotest_IsStandard_dust_limitto be more clear that it is different fromtest_IsStandard_dust_thresholdsNIT: rename
nDustThresholdto snake_caseon line 886 this is also a op_return80?
Good catch, they are the same script.
Addressed nits from @janb84:
nDustThresholdtodust_thresholdcommenttest_IsStandard_dusttotest_IsStandard_dust_limitACK
20fecda22cThanks for taking my suggestions!
I think it's ok but depending if you are nitpicking or how you are reading the commit message it can be misunderstood what is ment by "no check is added" while adding
BOOST_CHECK_EQUAL(42, op_return_42.size())and a second BOOST_CHECK_EQUAL(83, ...) ."no policy check" would remove the possible mis-understanding. Just to highlight it but i'm fine with it.
How should this be reviewed? This looks like it is removing 200 lines of test code and adding 200 other lines.
I understand that https://github.com/bitcoin/bitcoin/issues/36692 can be "fixed" with LLMs and that LLMs can "review" the "fix", but if this isn't trivial for humans to review, then I don't think it is worth it.
If there are 50 pull requests (each for a file), and each takes 10 minutes to review, it will be ~10hours/person if everything goes well. Just raising this to focus on creating pulls that are trivial to review.
I haven't looked closely, but maybe the globals removal like g_dust can be split off into a commit?
Thanks for taking a look.
I have split the PR into three commits, which should make it easier to review. The first two commits should be easy and quick. The last one is not a mechanical change, and I am happy to drop it if reviewers feel it is better to keep the PR focused on the changes that are trivial to review.
I've split the globals removal into its own commit. Also, I have added "no policy check" in the commit message.
re- ACK4d01b07cd5896283571dcc11497b62110f62ba72
changes since last ack; changes separated in several commits.
Although I found it doable to review in one commit I have to confess that the separation makes it easier.
ACK
4d01b07cd5Thanks for splitting this large 300 line test case into subtest, and also removing the globals, which I found both tedious to read and understand. Now it seems nicer.
Left some nits. Happy to re-ack if you take them.
review ACK
4d01b07cd5🔄Show signature
Signature:
I think it would be nice to move this
IsStandardTxtest suite into its own file, as you are touching all lines of this test anyway. Maybetransaction_standardness_tests.cpp, so that it is separate from let's say tx serialize tests or other tx tests.nit: According to git grep,
output_scriptis the more common spelling here. Also, can use the///doxygen comment syntax for less lines/bloat (here and in the other new functions)(same nit)
Thanks for the review! Addressed the nits:
///commentscript_pub_key->output_scriptcommentIsStandardTxtests into a newtransaction_standardness_tests.cpp(move-only commit, review with--color-moved=dimmed-zebra) suggestionreview ACK
608b99a0d8💽Show signature
Signature:
re ACK
608b99a0d8changes since last ACK: