test: stabilize asset locks functional test#7409
Conversation
|
|
✅ Review complete (commit d9d7695) |
WalkthroughThis PR refactors functional test helper code for asset-unlock transactions and quorum commitment waiting. In feature_asset_locks.py, request-id computation is extracted into a reusable method, a new method selects an asset-unlock transaction targeting the oldest matching active quorum, generate_batch gains an optional sync callback, and several tests are updated to use these helpers instead of hard-coded assertions and manual retry loops. In test_framework.py, the minableCommitments scan logic is extracted into node_has_quorum_commitment, used by wait_for_quorum_commitment and mine_quorum. Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant Test as AssetLocksTest
participant Helper as create_assetunlock_for_oldest_quorum
participant Node as selectquorum
Test->>Helper: start_index, withdrawal, pubkey
loop candidate indices
Helper->>Helper: create_assetunlock_request_id(index)
Helper->>Node: selectquorum(request_id)
Node-->>Helper: quorum hash
Helper->>Helper: compare with expected quorum
end
Helper-->>Test: tx, payload, quorumHash
sequenceDiagram
participant MineQuorum as mine_quorum
participant WaitUntil as wait_until
participant Node0 as nodes[0]
participant Helper as node_has_quorum_commitment
MineQuorum->>WaitUntil: wait for final commitment
WaitUntil->>Helper: node_has_quorum_commitment(nodes[0], quorumHash, llmqType)
Helper->>Node0: check minableCommitments
Node0-->>Helper: commitment data
Helper-->>WaitUntil: True/False
WaitUntil-->>MineQuorum: commitment confirmed
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/functional/test_framework/test_framework.py (1)
2205-2207: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueHardcoded
timeout=15diverges from surrounding parameterized waits.Every other
wait_for_*helper in this class accepts a configurabletimeout(andmine_quorumitself doesn't expose one either, so this is consistent with the file's overall lack of amine_quorumtimeout param). Still, baking15directly into this newwait_untilcall makes it harder to tune independently ofwait_for_quorum_commitment's existingtimeout=15default if the two ever need to diverge.♻️ Optional: extract a local timeout variable
- self.log.info("Waiting final commitment on mining node") - self.wait_until(lambda: self.node_has_quorum_commitment(self.nodes[0], q, llmq_type), timeout=15) + self.log.info("Waiting final commitment on mining node") + self.wait_until(lambda: self.node_has_quorum_commitment(self.nodes[0], q, llmq_type), timeout=15) # keep in sync with wait_for_quorum_commitment default timeout🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/functional/test_framework/test_framework.py` around lines 2205 - 2207, The new wait in mine_quorum uses a hardcoded timeout that should stay configurable like the other wait helpers in TestFramework. Update the final commitment wait around node_has_quorum_commitment to use a local timeout variable or pass through an existing parameter pattern, and keep it aligned with wait_for_quorum_commitment so the two can diverge later if needed. Use the mine_quorum and wait_for_quorum_commitment symbols to locate the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/functional/test_framework/test_framework.py`:
- Around line 2205-2207: The new wait in mine_quorum uses a hardcoded timeout
that should stay configurable like the other wait helpers in TestFramework.
Update the final commitment wait around node_has_quorum_commitment to use a
local timeout variable or pass through an existing parameter pattern, and keep
it aligned with wait_for_quorum_commitment so the two can diverge later if
needed. Use the mine_quorum and wait_for_quorum_commitment symbols to locate the
change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f1407c66-146c-44bd-8811-e5b05e334653
📒 Files selected for processing (2)
test/functional/feature_asset_locks.pytest/functional/test_framework/test_framework.py
There was a problem hiding this comment.
Code Review
Small, well-scoped test stabilization PR limited to two functional-test files. Adds an explicit mining-node commitment wait to close a race in mine_quorum, threads an optional sync_fun through generate_batch, and factors out oldest-quorum asset-unlock selection with a bounded (100-index) deterministic search. All changes preserve semantics and target real intermittency.
Source: reviewers: claude-general (opus), codex-general (gpt-5.5), claude-dash-core-commit-history (opus), codex-dash-core-commit-history (gpt-5.5); verifier: claude (opus).
Issue being fixed or feature implemented
Fixes #7310.
feature_asset_locks.pycould fail intermittently under high concurrency while waiting for a freshly minedllmq_test_platformquorum or while syncing mempools during an asset-unlock reorg path.What was done?
mine_quorum().generate_batch()to use block-only sync for the asset-unlock invalidation padding where mempool equality is not part of the assertion.How Has This Been Tested?
upstream/developwithmake -j8.feature_asset_locks.pyruns.python3.9 test/functional/feature_asset_locks.py --tmpdir=/private/tmp/dash_assetlocks_fixed_solo2 --portseed=301.feature_asset_locks.pyinstances using seeds 100-119 with--timeout-factor=4; all 20 passed.Breaking Changes
None.
Checklist:
This pull request was created by Codex.