test: stabilize governance superblock waits#7329
Conversation
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
|
✅ Review complete (commit fefdd42) |
WalkthroughThis PR extends the governance testing framework to support multiple trigger signal types. The framework layer refactors Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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/feature_governance.py (1)
392-392: ⚡ Quick winBind the loop variable in the lambda to avoid closure issues.
The lambda captures
sb_block_heightby reference. While this works in practice becausewait_untilblocks the loop, it's safer to explicitly bind the variable to prevent potential issues if the code is refactored.🔧 Proposed fix
- self.wait_until(lambda: have_funded_trigger_for_height(self.nodes, sb_block_height)) + self.wait_until(lambda sb_height=sb_block_height: have_funded_trigger_for_height(self.nodes, sb_height))🤖 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/feature_governance.py` at line 392, The lambda passed to wait_until captures sb_block_height by reference which can cause closure issues; change the lambda to bind the loop variable explicitly (e.g., give sb_block_height as a default argument) so wait_until calls have_funded_trigger_for_height with a bound value; update the call using wait_until(lambda h=sb_block_height: have_funded_trigger_for_height(self.nodes, h)) to ensure stable behavior when refactoring.
🤖 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/feature_governance.py`:
- Line 392: The lambda passed to wait_until captures sb_block_height by
reference which can cause closure issues; change the lambda to bind the loop
variable explicitly (e.g., give sb_block_height as a default argument) so
wait_until calls have_funded_trigger_for_height with a bound value; update the
call using wait_until(lambda h=sb_block_height:
have_funded_trigger_for_height(self.nodes, h)) to ensure stable behavior when
refactoring.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 279a4ccb-c991-4596-8357-10572720ff9d
📒 Files selected for processing (2)
test/functional/feature_governance.pytest/functional/test_framework/governance.py
97ae2fb to
fefdd42
Compare
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
I verified the checked-out PR at fefdd42 against the actual patch and surrounding test/RPC code. The change is consistent with Dash governance semantics: superblock mining uses the cached funding state, the new helper preserves the previous default valid behavior for existing callers, and I did not find any correctness issue that warrants a review comment.
Reviewed commit: fefdd42
Summary
Fixes #7328.
feature_governance.pycan observe governance votes and triggers before everynode has finished updating the aggregate vote count, or before a trigger is in
the same funded state used by superblock mining. This made the test
intermittently fail on the final vote-count assertion and, locally, at the first
superblock payment check.
Changes
continuing.
have_trigger_for_height()so callers can wait on a specificgovernance vote signal.
have_funded_trigger_for_height()and use it before mining superblocks,aligning the test wait with
IsSuperblockTriggered()'s cached-fundingcondition.
Validation
python3 -m py_compile \ test/functional/feature_governance.py \ test/functional/feature_governance_cl.py \ test/functional/test_framework/governance.py CONFIG=/Users/claw/Projects/dash/worktrees/tracker-1176/test/config.ini python3 test/functional/feature_governance.py \ --configfile="$CONFIG" \ --timeout-factor=4Tests successfulship