Skip to content

Conversation

@knst
Copy link
Collaborator

@knst knst commented May 7, 2025

Issue being fixed or feature implemented

Fork withdrawals is activated long time ago. No more need to test functionality for pre-'withdrawals' fork when only 2 quorum could be used for signing messages.

What was done?

Removed pre-'withdrawals' logic to enforce using only 2 quorums for signing of withdrawals from code and from functional test feature_asset_locks.py
Functional test feature_asset_locks.py generate less quorums and less blocks which significantly shortened runtime of this test, 166->139seconds on median; up to 40 seconds if quorum has been generated non-favourable way.

How Has This Been Tested?

Run in parallel 20 jobs

  • PR:

feature_asset_locks.py | ✓ Passed  | 133 s
feature_asset_locks.py | ✓ Passed  | 134 s
feature_asset_locks.py | ✓ Passed  | 134 s
feature_asset_locks.py | ✓ Passed  | 134 s
feature_asset_locks.py | ✓ Passed  | 135 s
feature_asset_locks.py | ✓ Passed  | 135 s
feature_asset_locks.py | ✓ Passed  | 137 s
feature_asset_locks.py | ✓ Passed  | 138 s
feature_asset_locks.py | ✓ Passed  | 138 s
feature_asset_locks.py | ✓ Passed  | 139 s
feature_asset_locks.py | ✓ Passed  | 139 s
feature_asset_locks.py | ✓ Passed  | 140 s
feature_asset_locks.py | ✓ Passed  | 140 s
feature_asset_locks.py | ✓ Passed  | 140 s
feature_asset_locks.py | ✓ Passed  | 141 s
feature_asset_locks.py | ✓ Passed  | 141 s
feature_asset_locks.py | ✓ Passed  | 142 s
feature_asset_locks.py | ✓ Passed  | 142 s
feature_asset_locks.py | ✓ Passed  | 143 s
feature_asset_locks.py | ✓ Passed  | 143 s

ALL                    | ✓ Passed  | 2768 s (accumulated) 
Runtime: 143 s
  • develop
TEST                   | STATUS    | DURATION

feature_asset_locks.py | ✓ Passed  | 151 s
feature_asset_locks.py | ✓ Passed  | 157 s
feature_asset_locks.py | ✓ Passed  | 160 s
feature_asset_locks.py | ✓ Passed  | 161 s
feature_asset_locks.py | ✓ Passed  | 161 s
feature_asset_locks.py | ✓ Passed  | 163 s
feature_asset_locks.py | ✓ Passed  | 164 s
feature_asset_locks.py | ✓ Passed  | 165 s
feature_asset_locks.py | ✓ Passed  | 166 s
feature_asset_locks.py | ✓ Passed  | 166 s
feature_asset_locks.py | ✓ Passed  | 167 s
feature_asset_locks.py | ✓ Passed  | 167 s
feature_asset_locks.py | ✓ Passed  | 170 s
feature_asset_locks.py | ✓ Passed  | 171 s
feature_asset_locks.py | ✓ Passed  | 172 s
feature_asset_locks.py | ✓ Passed  | 174 s
feature_asset_locks.py | ✓ Passed  | 181 s
feature_asset_locks.py | ✓ Passed  | 185 s
feature_asset_locks.py | ✓ Passed  | 197 s
feature_asset_locks.py | ✖ Failed  | 49 s

ALL                    | ✖ Failed  | 3247 s (accumulated) 
Runtime: 197 s

Breaking Changes

Removed pre-'withdrawals' requirement of using only 2 last quorums

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@github-actions
Copy link

This pull request has conflicts, please rebase.

@knst knst mentioned this pull request May 20, 2025
5 tasks
@knst knst changed the title tests: withdrawals test improvements test: feature_asset_locks.py improvements Aug 15, 2025
@knst knst changed the title test: feature_asset_locks.py improvements feat: remove pre-withdrawal logic for enforcing 2 quorums only and related test changes Aug 15, 2025
@knst knst changed the title feat: remove pre-withdrawal logic for enforcing 2 quorums only and related test changes feat: remove pre-'withdrawals' logic for enforcing 2 quorums only and related test changes Aug 15, 2025
@knst knst force-pushed the tests-withdrawals-improvements branch from a85c976 to 21c9161 Compare August 15, 2025 17:08
@knst knst added this to the 23 milestone Aug 15, 2025
@github-actions
Copy link

github-actions bot commented Aug 15, 2025

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@knst knst force-pushed the tests-withdrawals-improvements branch from 21c9161 to 56711d9 Compare August 15, 2025 18:17
@knst knst marked this pull request as ready for review August 15, 2025 20:01
@knst
Copy link
Collaborator Author

knst commented Aug 15, 2025

@coderabbitai review this PR please, I see no incremental reviews yet

@coderabbitai
Copy link

coderabbitai bot commented Aug 15, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Aug 15, 2025

Tip

For best results, initiate chat on the files or code changes.

@knst I can see that a review has already been triggered for this PR. As mentioned in the automated response, CodeRabbit operates as an incremental review system, which means:

  1. Review Status: The review process has been initiated for PR feat: remove pre-'withdrawals' logic for enforcing 2 quorums only and related test changes #6661
  2. Incremental Nature: CodeRabbit will review new commits and changes incrementally rather than re-reviewing the entire PR each time
  3. Current State: If you're not seeing review comments yet, it may be because the review is still in progress or the changes are being analyzed

This PR focuses on removing legacy pre-'withdrawals' logic that enforced 2-quorum restrictions, which is a good cleanup effort since the 'withdrawals' fork has been active for some time. The performance improvements in the test suite (reducing runtime from 166s to 139s median) are also beneficial.

The review should appear shortly if it hasn't already. If you continue to experience issues with the review not appearing, you may want to check if automatic reviews are paused for this repository or if there are any configuration issues.

@coderabbitai
Copy link

coderabbitai bot commented Aug 15, 2025

Walkthrough

  • chainparams.cpp: Adjusted REGTEST V23 version-bits window from 350 to 250; updated thresholdStart to 200 and thresholdMin to 150; nFalloffCoeff and useEHF unchanged.
  • evo/assetlocktx.cpp: Simplified quorum scanning to always use signingActiveQuorumCount + 1; removed deployment-based branching; comments updated.
  • test/functional/feature_asset_locks.py: Reworked asset unlock tests—updated activation heights, quorum handling, timing (generate_batch reductions), added getassetunlockstatuses checks, updated platform reward expectation, adjusted mempool handling to use txid, and revised log messages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
src/evo/assetlocktx.cpp (1)

125-127: Scan “active + 1” quorums unconditionally: good simplification; add a small guard

The unconditional rule matches the PR objective and simplifies the logic. As a minor defensive improvement, consider guarding against unexpected zero or negative values for signingActiveQuorumCount (even if current params never set it to 0) to avoid passing 0 to ScanQuorums.

Apply this diff to harden the computation:

-    // We check all active quorums + 1 the latest inactive
-    const int quorums_to_scan = llmq_params_opt->signingActiveQuorumCount + 1;
+    // We check all active quorums + 1 (the latest inactive)
+    const int quorums_to_scan =
+        static_cast<int>(std::max<int>(1, llmq_params_opt->signingActiveQuorumCount)) + 1;
test/functional/feature_asset_locks.py (3)

58-58: Avoid magic numbers: reuse mn_rr_height

You introduce self.mn_rr_height = 560 but still hardcode 560 later. Prefer using the field consistently to prevent drift.

Apply this diff in test_mn_rr:

-        self.activate_mn_rr(expected_activation_height=560)
+        self.activate_mn_rr(expected_activation_height=self.mn_rr_height)

375-383: New getassetunlockstatuses checks are valuable; consider asserting the tip height explicitly

The added RPC-based status assertions look sound and provide better coverage for index state. Consider also asserting tip before/after to make the intent crystal clear (optional).


671-676: Loop to target the last active quorum is bounded—good; consider extracting helper (optional)

The index < 511 bound prevents infinite loops. As a small readability win, consider a helper that tries N indices to find the last-active quorum to avoid duplicating this idiom.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fb87a5a and 56711d9.

📒 Files selected for processing (3)
  • src/chainparams.cpp (1 hunks)
  • src/evo/assetlocktx.cpp (1 hunks)
  • test/functional/feature_asset_locks.py (10 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.{cpp,h,cc,cxx,hpp}

📄 CodeRabbit Inference Engine (CLAUDE.md)

src/**/*.{cpp,h,cc,cxx,hpp}: Dash Core C++ codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
Dash uses unordered_lru_cache for efficient caching with LRU eviction

Files:

  • src/evo/assetlocktx.cpp
  • src/chainparams.cpp
src/{masternode,evo}/**/*.{cpp,h,cc,cxx,hpp}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Masternode lists must use immutable data structures (Immer library) for thread safety

Files:

  • src/evo/assetlocktx.cpp
test/functional/**/*.py

📄 CodeRabbit Inference Engine (CLAUDE.md)

Functional tests should be written in Python and placed in test/functional/

Files:

  • test/functional/feature_asset_locks.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: kwvg
PR: dashpay/dash#6543
File: src/wallet/receive.cpp:240-251
Timestamp: 2025-02-06T14:34:30.466Z
Learning: Pull request #6543 is focused on move-only changes and refactoring, specifically backporting from Bitcoin. Behavior changes should be proposed in separate PRs.
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
Learnt from: kwvg
PR: dashpay/dash#6761
File: src/chainlock/signing.cpp:247-250
Timestamp: 2025-07-29T14:32:48.369Z
Learning: In PR #6761, kwvg acknowledged a null pointer check issue in ChainLockSigner::Cleanup() method but deferred it to follow-up, consistent with the pattern of avoiding scope creep in refactoring PRs.
📚 Learning: 2025-07-15T14:53:04.819Z
Learnt from: knst
PR: dashpay/dash#6691
File: src/test/llmq_params_tests.cpp:148-151
Timestamp: 2025-07-15T14:53:04.819Z
Learning: In the Dash Core LLMQ implementation, signingActiveQuorumCount is never 0 in the actual parameters defined in params.h, making division by zero scenarios unrealistic in the max_cycles() function.

Applied to files:

  • src/evo/assetlocktx.cpp
🧬 Code Graph Analysis (1)
test/functional/feature_asset_locks.py (5)
test/functional/test_framework/messages.py (1)
  • CAssetUnlockTx (1225-1271)
test/functional/test_framework/util.py (1)
  • assert_equal (69-74)
test/functional/test_framework/test_framework.py (3)
  • get_node (1216-1221)
  • activate_mn_rr (1581-1582)
  • activate_by_name (1537-1576)
test/functional/interface_zmq_dash.py (1)
  • send_tx (92-97)
test/functional/feature_mnehf.py (1)
  • send_tx (105-120)
🪛 Flake8 (7.2.0)
test/functional/feature_asset_locks.py

[error] 367-367: continuation line under-indented for visual indent

(E128)

🔇 Additional comments (8)
src/chainparams.cpp (1)

823-826: REGTEST v23 window and thresholds update is consistent

nWindowSize=250 with thresholds at 80% (200) and 60% (150) matches the stated intent and aligns with the updated functional test expectations (e.g., v23 activation at height 750).

test/functional/feature_asset_locks.py (7)

364-368: Good clarification on mempool vs consensus validation paths

The comment explicitly explaining why mempool returns “not-verified” (lack of CreditPool/index context) is helpful and reduces confusion during test failures.


403-405: Spork reset sequencing looks correct

Resetting IS and quorum DKG sporks back to defaults after the negative checks keeps subsequent assertions deterministic. LGTM.


451-451: Reducing generate_batch to 25 improves runtime without changing semantics

Dropping the batch size here is a sensible speedup given the updated quorum scanning rule and activation heights.


652-655: Explicit withdrawals activation height usage matches regtest params

activate_by_name('withdrawals', 600) aligns with consensus.WithdrawalsHeight=600 for regtest. Good consistency.


677-681: Post-deactivation checks match the “active + 1” rule

Explicitly verifying the signing quorum leaves the active set after mining one more quorum aligns with the implementation change in C++.


705-708: v23 activation at height 750 matches updated regtest window (250) semantics

This keeps the test tightly aligned with the new window and threshold computations.


723-737: v23 path mirrors withdrawals path correctly

Replicating the inactive-but-valid and then too-old transitions for v23 provides symmetric coverage. Nice.

@coderabbitai
Copy link

coderabbitai bot commented Aug 15, 2025

@knst I'll pause the automatic reviews for this PR.

✅ Actions performed

Reviews paused.

@UdjinM6
Copy link

UdjinM6 commented Aug 17, 2025

@coderabbitai resume

@coderabbitai
Copy link

coderabbitai bot commented Aug 17, 2025

✅ Actions performed

Reviews resumed.

@UdjinM6
Copy link

UdjinM6 commented Aug 17, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Aug 17, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@knst
Copy link
Collaborator Author

knst commented Aug 18, 2025

@UdjinM6 review is here; it has been triggered at some point, but not immediatelly posted. I restarted coderabbit and got the same answer as you "it's incremental and no action taken".
Here's it: #6661 (review)

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reindexed with no issues, no slowdown or anything

light ACK 56711d9

@PastaPastaPasta PastaPastaPasta merged commit 3c6ab9f into dashpay:develop Aug 19, 2025
36 of 38 checks passed
@knst knst deleted the tests-withdrawals-improvements branch August 19, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants