Repository navigation
test: remove low-value functional test code and run the suite in under 60 seconds - #8151
PastaPastaPasta wants to merge 3 commits into
Conversation
p2p_instantsend.py asserted that the key "confirmation" was absent from getrawtransaction, but the key is "confirmations", so the check that a transaction without a lock is not mined before it is 10 minutes old never ran. It would have failed: the isolated node's mocktime lagged behind the bumps made while waiting for the lock, so the transaction was already old enough. Sync the isolated node's clock and assert the early block leaves the transaction in the mempool. The rejection of the doublespend block was checked with waitforblock timeouts of 10 ms and 1 ms, before the block could arrive; wait for it to be listed as invalid instead. feature_masternode_params.py only logged the masternode's services and indexes and asserted getblockcount() >= 0, and looked the block filter index up under the wrong name, so its "regular node has no filter index" check could not fail either. Assert the service bit and the index. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
mining_getblocktemplate_longpoll.py spent 60 of its 66 seconds in one case: the RPC only looks at the mempool after a minute on the steady clock, which mocktime cannot shorten. That case moves to mining_getblocktemplate_longpoll_mempool.py, which is added to the extended list in the next commit. feature_governance.py ended with a pruned-node scenario that mines 438 blocks and reindexes on a seven-node network although it uses no masternode. It moves to feature_governance_pruned.py with two nodes. The resync of every node after the isolated trigger now waits for the objects it needs instead of a full governance sync per node, and the repeat of superblocks at heights 200 and 220 is gone. feature_asset_locks.py keeps the scenarios through the v24 fork; version 2 unlocks, non-standard locks and crash replay move to feature_asset_locks_v24.py, with the shared helpers in test_framework/asset_locks.py. The scenario bodies are unchanged apart from three removals: asserts on a dict fetched before the block they were about, a repeat of the oldest-quorum check after v24 (the signature check has no deployment gate), and a restart directly followed by another. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…h functional tests The default suite now runs in about 53 seconds at -j48 instead of 68. Scenarios that repeated another one without reaching different code: - feature_llmq_simplepose.py --disable-spork23: spork23 gates one early return and the probe connections, which the capabilities variant still runs with the spork off. The flag moves to that test. - the single-type -llmq-qvvec-sync runs in feature_llmq_data_recovery.py (the combined run does both), the second deaf masternode and the second no-ban round in the simplepose tests, the quorums mined to make a quorum inactive in feature_llmq_signing.py and feature_llmq_singlenode.py (recovered sigs are only cleaned up by age), the repeated InstantSend publisher runs in interface_zmq_dash.py, the parts of p2p_quorum_data.py that do not depend on the request cleanup mode, a threshold-off case and a restart in wallet_dust_protection.py, extra masternodes and rounds in feature_dip3_deterministicmns.py, and smaller repeats elsewhere. Checks that could not fail or only restated the test's own input are removed, and feature_spentindex.py and feature_addressindex.py now check that an index disabled across a block catches up. Waits on real time become waits on the event: banscore and absent replies in p2p_quorum_data.py are read after a ping, feature_stats.py advances the scheduler, feature_mnehf.py mines the activation window directly, feature_governance_trigger_voting.py only waits for a trigger that exists. Tests that sync mempools through the transaction trickle delay relay without it (feature_protx_version.py, p2p_platform_ban.py, feature_dip4_coinbasemerkleroots.py, wallet_dust_protection.py). rpc_mnauth.py needs no masternode: the RPC does not consult the list. test_runner.py lists the split tests, runs the minute-long longpoll case with the extended tests, and starts mid-length tests before the short ones so the end of a parallel run is not waiting on them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
✅ Final review complete — no blockers (commit 25f5660) · triage: normal |
| @@ -0,0 +1,625 @@ | |||
| #!/usr/bin/env python3 | |||
There was a problem hiding this comment.
feature_asset_locks.py keeps everything through the v24 fork; v2 unlocks, non-standard locks and crash replay move to feature_asset_locks_v24.py. Scenario bodies are unchanged apart from three redundant lines/blocks named in the commit message (61 s → about 25 s and 28 s).
i’d say better to wait v24 activation and throw away pre-v24 tests. Still keep v1 asset locks / unlocks, but the slowest part - is withdrawal's limits and that could be safely erased.
|
No actionable comments were generated in the recent review. WalkthroughThe pull request updates functional tests across asset locks, governance, masternode and quorum behavior, P2P and RPC checks, indexes, wallets, and mining. It adds a shared asset-lock test mixin, a v24 asset-lock suite, a pruned-node governance test, and a separate mempool-triggered getblocktemplate longpoll test. It also changes test synchronization, timing, scenario coverage, and functional test-suite selection. Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk:
|
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The functional-test refactor is internally consistent: the split scenarios are registered, event-based synchronization replaces fixed waits, and the corrected assertions now exercise real failure paths. No in-scope correctness issues were identified. Lint, cppcheck, ClangFormat, and completed source-build checks passed; remaining source builds/tests are in progress, while the failed milestone check is a policy check unrelated to the code.
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: dash-core-commit-history); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a broad functional-test and test-runner refactor that changes scenario coverage, synchronization, node setup, and test partitioning, but it does not modify production critical surfaces such as consensus, funds movement, cryptography, networking deserialization, or storage migrations. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— dash-core-commit-history (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— dash-core-commit-history (completed, effort high); agentphase2-reviewer
|
Split into two PRs so the correctness fixes and the suite-speed work can be reviewed separately:
Same changes as this branch. Closing this one so the combined diff is not what gets reviewed. 🤖 Posted autonomously by Cursor on behalf of pasta. |
468397e test: activate the payout-shares v24 deployment with activate_by_name (pasta) 4f15516 test: require the address index to catch both blocks mined while disabled (pasta) eed2f50 test: make index and EHF checks observe the behavior they name (pasta) 596601c test: make two functional test checks able to fail (pasta) Pull request description: ## Issue being fixed or feature implemented Several Dash functional tests asserted something that could not fail, or checked a setup in which the behavior they named never happened. A typo in `p2p_instantsend.py` hid a scenario that was actually broken. This is the correctness half of #8151. The suite-speed work is #8156. ## What was done? - `p2p_instantsend.py` asserted that the key `"confirmation"` was absent from `getrawtransaction`. The key is `"confirmations"`, so the check that a transaction without a lock is not mined before it is 10 minutes old never ran. It would have failed: the isolated node's mocktime lagged behind the bumps made while waiting for the lock, so the transaction was already old enough. The isolated node's clock is synced, and the early block is now checked to leave the transaction in the mempool. The doublespend block was checked with `waitforblock` timeouts of 10 ms and 1 ms, before the block could arrive. The test now waits for that block to be listed as invalid. - `feature_masternode_params.py` logged the masternode's services and indexes and asserted `getblockcount() >= 0`. It also looked the block filter index up under the wrong name, so "a regular node has no filter index" could not fail. Both are real assertions now. - `feature_addressindex.py` and `feature_spentindex.py` toggled the index off and on at genesis, before any block the index could miss. `feature_addressindex.py` checks that `received` equals both coinbases mined while the index was disabled, and that the orphaned block's address is gone. `feature_spentindex.py` mines a spend while the index is disabled and checks that the index catches up. The txindex checks share the spentindex node, so the fourth node is gone. - `feature_mnehf.py` asserted that a payload it had just filled in still contained those values, and polled activation one block at a time. The payload check is gone. Activation is mined across the BIP9 windows, and the started, locked_in and active states are checked. - `feature_masternode_payout_shares.py` asserted that v24 was active after a loop that only exits once it is. ## How Has This Been Tested? These files match #8151 (`25f5660e2c9b`), except `feature_addressindex.py`: `received` is compared with the sum of both coinbases mined while the index was disabled. That test was run and passed. Merging this branch with #8156 reproduces the #8151 tree plus that assertion. The other functional tests were not re-run after the split; #8151's CI is green on those files. ## Breaking Changes None. ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone Top commit has no ACKs. Tree-SHA512: 445ed4740e496edadbf229276ad8a1f90f85c52c19994910d4487ebb2895de655861c08cc6ac4fde0422d1f84eea962923aec2e4cb23483bb8dc4f27a37177c9
9ae61c0 test: wait for the recovered signature before checking every masternode (pasta) 7cffb5d test: drop duplicate scenarios, fixed sleeps and oversized setups (pasta) 923abf7 test: split three slow functional tests by scenario (pasta) Pull request description: ## Issue being fixed or feature implemented The default functional suite takes about 68 seconds on a 28-core machine at `-j48`. A large part of that is duplicate scenarios, fixed sleeps, and setups bigger than the test needs. Three tests alone each take about a minute. This is the speed half of #8151. The checks that could not fail are #8155. ## What was done? **Three slow tests are split by scenario** (separately named files, shared code in a mixin as with `simplepose.py`). - `mining_getblocktemplate_longpoll.py`: the mempool-triggered return needs a real minute on the steady clock. It moves to `mining_getblocktemplate_longpoll_mempool.py` in the extended list, which CI runs. The block-triggered cases stay in the default run. - `feature_governance.py`: the pruned-node scenario mined 438 blocks and reindexed on a seven-node network without using a masternode. It moves to `feature_governance_pruned.py` with two nodes and the same assertions. The per-node resync waits for the objects it needs, and the repeat of superblocks at 200 and 220 is gone. - `feature_asset_locks.py` keeps everything through the v24 fork. v2 unlocks, non-standard locks and crash replay move to `feature_asset_locks_v24.py`. Scenario bodies are unchanged apart from three redundant lines: asserts on a dict fetched before the block they were about, a repeat of the oldest-quorum check after v24, and a restart directly followed by another. Review feedback on #8151 preferred deleting the pre-v24 cases once v24 is active, and dropping the withdrawal-limit section, instead of splitting the file. This PR keeps the split. v1 locks and unlocks stay, and that deletion can land on its own when v24 is active. **Duplicate scenarios and oversized setups.** - `feature_llmq_simplepose.py --disable-spork23` is dropped. Spork23 gates one early return and the probe connections, both still exercised with the spork off by `feature_llmq_simplepose_capabilities.py --disable-spork23`. - Repeated scenarios removed in `feature_llmq_data_recovery`, `feature_llmq_signing`, `feature_llmq_singlenode`, `feature_llmq_chainlocks`, the simplepose tests, `p2p_quorum_data`, `interface_zmq_dash`, `rpc_verifyislock`, `wallet_dust_protection`, `feature_dip3_deterministicmns` (11 masternodes to 5, and fewer payment and update rounds), `feature_protx_version` and `rpc_netinfo`. - `rpc_mnauth.py` is a one-node test. The RPC does not consult the masternode list, so the protx hash and operator key are stand-ins. - Real-time waits are replaced by the event they waited for. `p2p_quorum_data.py` reads banscore after a ping: the old settle sleep could observe a score that was still moving, and a peer that reached the ban threshold is waited on until its connection closes. `feature_stats.py` advances the scheduler. `feature_governance_trigger_voting.py` mines up to the maturity window in one batch. `feature_governance_cl.py` waits on `syncwithvalidationinterfacequeue` instead of scraping the debug log. - `noban_tx_relay` is set in four tests that only sync mempools and were waiting out the transaction trickle (`feature_protx_version`, `p2p_platform_ban`, `feature_dip4_coinbasemerkleroots`, `wallet_dust_protection`). - `test_runner.py` lists the split tests, runs the minute-long longpoll case with the extended tests, and starts mid-length tests before the short ones. **Coverage this drops, on purpose.** These are the spots where "faster" means the test observes less than it used to: - `feature_llmq_chainlocks.py` asserts that block 1 is chainlocked, not every block below the tip, and generates one non-chainlocked block instead of two. - `feature_llmq_signing.py` and `feature_llmq_singlenode.py` no longer mine extra quorums to retire a recovered signature by rotation. Recovered signatures only age out by time. The "nothing changed" check is immediate, not a 3 second window. - `wallet_dust_protection.py` no longer runs the threshold-off case or the "locks survive a restart" check. - `feature_llmq_simplepose.py` no longer accepts `--disable-spork23`. Deliberately left alone: the fixed sleeps in the retroactive-signing tests (no event anchors a "nothing was signed" check), the cycled session-timeout run and `test_platform_resigning` under `--spork21` (both reach different code), and `feature_evo_shares_activation.py` (immediate relay makes its activation loop hang; not investigated here). ## How Has This Been Tested? On the combined #8151 tree, which is this branch plus the correctness fixes, the default suite at `-j48` with datadirs on tmpfs went from 66–73 seconds (six runs) to 49–56 seconds (last five runs). Every changed test on that tree was run directly at least five times, including each listed variant, and `mining_getblocktemplate_longpoll_mempool.py` was run with the transaction sent from each node. `test/lint/lint-python.py`, `lint-python-dead-code.py`, `lint-whitespace.py` and `lint-files.py` were run there too. This branch was not re-timed on its own. Its files match #8151 (`25f5660e2c9b`), and merging it with the correctness branch reproduces that tree. `dash_hash` is not installed in this environment, so the functional tests were not re-run after the split. At that parallelism some tests time out intermittently on both the old and the new tree. On the new tree these were `feature_llmq_is_cl_conflicts`, `feature_llmq_is_retroactive`, `feature_llmq_chainlocks`, `feature_masternode_shares` and `wallet_basic`. On the old tree, `rpc_psbt` and `feature_llmq_data_recovery`. `feature_llmq_is_retroactive` and `feature_llmq_chainlocks` are touched here, but not at the lines that failed. They are ChainLock or sync waits that lose a race under load. ## Breaking Changes `feature_llmq_simplepose.py` no longer accepts `--disable-spork23`. ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone Top commit has no ACKs. Tree-SHA512: 5c400b2c27d32d1effd324c41c207fd93a600c93a2c660ccfc7a975f63cbf3e9015d8237445308d4ee2683757b21c540825132fdc668e5a6ab1a37d9fbb86c2d
Issue being fixed or feature implemented
The default functional suite takes about 68 seconds on a 28-core machine at
-j48, and a good part of that is spent on things that prove nothing: checks that cannot fail, scenarios run twice, fixed sleeps, and setups far larger than the test needs. Three tests alone set the floor at over a minute each.This goes through the Dash-specific functional tests, removes that, and gets the suite to about 53 seconds (49–56 over the last five runs) without dropping a scenario that reaches code nothing else reaches.
What was done?
Three commits.
Checks that could not fail now can.
p2p_instantsend.pyasserted that the key"confirmation"was absent fromgetrawtransaction; the key is"confirmations". The scenario behind it (a transaction without a lock is not mined before it is 10 minutes old) was in fact broken: the isolated node's mocktime lagged, so the transaction was mined early and the typo hid it. The clock is synced and the early block is now checked. The "doublespend block is rejected" check usedwaitforblockwith 10 ms and 1 ms timeouts, before the block could arrive; it now waits for the block to be listed as invalid.feature_masternode_params.pylogged the masternode's services and indexes and assertedgetblockcount() >= 0. It also used the wrong index name, so "a regular node has no filter index" could not fail. Both are real assertions now.Three slow tests are split by scenario (separately named files, shared code in a mixin as with
simplepose.py).mining_getblocktemplate_longpoll.py: the mempool-triggered return needs a real minute on the steady clock. It moves tomining_getblocktemplate_longpoll_mempool.pyin the extended list, which CI runs. The block-triggered cases stay in the default run (6 s).feature_governance.py: the pruned-node scenario mined 438 blocks and reindexed on a seven-node network without using a masternode. It moves tofeature_governance_pruned.pywith two nodes and the same assertions. The per-node resync waits for the objects it needs, and the repeat of superblocks at 200 and 220 is gone (68 s → about 33 s).feature_asset_locks.pykeeps everything through the v24 fork; v2 unlocks, non-standard locks and crash replay move tofeature_asset_locks_v24.py. Scenario bodies are unchanged apart from three redundant lines/blocks named in the commit message (61 s → about 25 s and 28 s).Duplicates, dead checks and sleeps.
feature_llmq_simplepose.py --disable-spork23is dropped: spork23 gates one early return and the probe connections, both still exercised with the spork off byfeature_llmq_simplepose_capabilities.py --disable-spork23, which keeps the flag.feature_llmq_data_recovery,feature_llmq_signing,feature_llmq_singlenode,feature_llmq_chainlocks, the simplepose tests,p2p_quorum_data,interface_zmq_dash,rpc_verifyislock,wallet_dust_protection,feature_dip3_deterministicmns(11 → 5 masternodes),feature_protx_version,feature_dip4_coinbasemerkleroots,rpc_netinfo.p2p_quorum_data,feature_stats,feature_mnehf,feature_governance_trigger_voting,feature_governance_cl,feature_llmq_connections.noban_tx_relayin four tests that only sync mempools and were waiting out the transaction trickle (feature_protx_version58 s → 20 s,wallet_dust_protection26 s → 4 s).rpc_mnauth.pyis a one-node test: the RPC does not consult the masternode list.feature_spentindex.pyandfeature_addressindex.pynow check that an index disabled across a block catches up; the old toggle happened at genesis and tested nothing.test_runner.pylists the new files and starts mid-length tests ahead of the short ones.Deliberately left alone: the fixed sleeps in the retroactive-signing tests (no event anchors a "nothing was signed" check), the cycled session-timeout run and
test_platform_resigningunder--spork21(both reach different code), andfeature_evo_shares_activation.py(immediate relay makes its activation loop hang; not investigated here).How Has This Been Tested?
test_runner.py -j48with datadirs on tmpfs, 28 cores: 66–73 s before (six runs), 49–56 s after (last five runs).mining_getblocktemplate_longpoll_mempool.pywas run with seeds that send the transaction from each node.test/lint/lint-python.py,lint-python-dead-code.py,lint-whitespace.py,lint-files.py.At this parallelism some tests time out intermittently on both the old and the new tree. On the new tree these were
feature_llmq_is_cl_conflicts,feature_llmq_is_retroactive,feature_llmq_chainlocks,feature_masternode_sharesandwallet_basic; on the old treerpc_psbtandfeature_llmq_data_recovery.feature_llmq_is_retroactiveandfeature_llmq_chainlocksare touched here, but not at the lines that failed; the others are untouched. They are ChainLock or sync waits that lose a race under load and are not addressed here.Breaking Changes
None.
feature_llmq_simplepose.pyno longer accepts--disable-spork23.Checklist:
🤖 Generated with Claude Code