Skip to content

Conversation

@knst
Copy link
Collaborator

@knst knst commented Jul 28, 2025

Issue being fixed or feature implemented

Fixes #6748

RPC dkgstatus return mineable commitment even if node does not have any information about quorum commitment.
See CQuorumBlockProcessor::GetMineableCommitments for details of implementation.

It happens if wait_for_quorum_commitment is called before node received QC by p2p.

commitment: {'version': 3,
    'llmqType': 104,
    'quorumHash': '70bd80a3e00da0c13ba11a12e5e3665baf1c5574f5b3003bb5b31500cab5cec9',
    'quorumIndex': 0,
    'signersCount': 0,
    'signers': '00',
    'validMembersCount': 0,
    'validMembers': '00',
    'quorumPublicKey': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    'quorumVvecHash': '0000000000000000000000000000000000000000000000000000000000000000',
    'quorumSig': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    'membersSig': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
}

This failure can happen not only for feature_asset_locks.py but for each functional tests that uses quorums, but it happened most often for feature_asset_locks.py because there is only 2 nodes instead 3 and it happens more often.

Issue indeed has been observed by me in other functional tests, but that had happens rarely compare to feature_asset_locks.py

What was done?

Helper wait_for_quorum_commitment validates that not just commitment is provided (which can be mock), but a public key is not 00...00.

How Has This Been Tested?

Run multiple feature_asset_locks.py and wait for a failure like that to happen, which happens no more with this PR:

2025-07-08T16:39:57.003000Z TestFramework (INFO): Mining final commitment
2025-07-08T16:39:58.019000Z TestFramework (INFO): Waiting for quorum to appear in the list
2025-07-08T16:39:58.019000Z TestFramework (INFO): quorums: {'llmq_test': ['165c35bff42cae1499590010f323bba4e19922639ea220220017aae028df0281', '6bb33b6cd447df28f8adb171b93001e6b223bb42662466795f7fd482ddfc7fbf'], 'llmq_test_instantsend': ['165c35bff42cae1499590010f323bba4e19922639ea220220017aae028df0281', '6bb33b6cd447df28f8adb171b93001e6b223bb42662466795f7fd482ddfc7fbf'], 'llmq_test_dip0024': [], 'llmq_test_platform': ['165c35bff42cae1499590010f323bba4e19922639ea220220017aae028df0281', '6bb33b6cd447df28f8adb171b93001e6b223bb42662466795f7fd482ddfc7fbf']}
2025-07-08T16:40:58.050000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
2025-07-08T16:40:58.9769454Z         def wait_func():
2025-07-08T16:40:58.9769845Z             return quorum_hash in self.nodes[0].quorum('list')[llmq_type_name]

Breaking Changes

N/A

Checklist:

  • 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

@knst knst added this to the 23 milestone Jul 28, 2025
@knst knst requested review from PastaPastaPasta, UdjinM6 and kwvg July 28, 2025 13:35
@github-actions
Copy link

github-actions bot commented Jul 28, 2025

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@coderabbitai
Copy link

coderabbitai bot commented Jul 28, 2025

Walkthrough

A logging statement was added to the CDKGSessionManager::GetVerifiedContributions method in src/llmq/dkgsessionmgr.cpp, providing detailed information when a verified contribution's verification vector is not found in the database. In test/functional/test_framework/test_framework.py, the wait_for_quorum_commitment method was updated to skip quorum commitments whose quorumPublicKey is a 96-character zero hex string and to use the default sleep interval in self.wait_until by removing the explicit sleep=1 argument. No changes were made to the signatures of exported or public entities.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ab9fc70 and 928cf34.

📒 Files selected for processing (1)
  • test/functional/test_framework/test_framework.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/functional/test_framework/test_framework.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: Lint / Run linters
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
  • GitHub Check: arm-linux-gnueabihf / Build depends
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: x86_64-pc-linux-gnu / Build depends
✨ 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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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: 0

🔭 Outside diff range comments (1)
src/llmq/dkgsessionmgr.cpp (1)

334-336: Missing error check for secret-key contribution fetch

db->Read(...) returns false when the secret-key contribution is absent, but the code ignores the return value and silently inserts a default-constructed CBLSSecretKey into the cache. Down-stream consumers will treat this as a valid (yet zero) key and may fail later with obscure errors.

                 CBLSSecretKey skContribution;
-                db->Read(std::make_tuple(DB_SKCONTRIB, llmqType, pQuorumBaseBlockIndex->GetBlockHash(), proTxHash), skContribution);
+                if (!db->Read(std::make_tuple(DB_SKCONTRIB, llmqType,
+                                              pQuorumBaseBlockIndex->GetBlockHash(), proTxHash),
+                              skContribution)) {
+                    LogPrint(BCLog::LLMQ,
+                             "%s -- missing sk contribution for llmq=%d block=%s protx=%s\n",
+                             __func__, ToUnderlying(llmqType),
+                             pQuorumBaseBlockIndex->GetBlockHash().ToString(),
+                             proTxHash.ToString());
+                    return false;
+                }
🧹 Nitpick comments (1)
src/llmq/dkgsessionmgr.cpp (1)

319-324: Prefer category-scoped logging to reduce noise

LogPrintf writes unconditionally to the main log. In a busy network, every missing contribution would now hit the log, potentially spamming nodes during catch-up and replay. Use the existing LLMQ debug category instead so operators can opt-in, and keep the log level consistent with nearby messages.

-                    LogPrintf("%s -- this node does not have verified contribution for llmq=%d block=%s protx=%s\n",
-                              __func__, ToUnderlying(llmqType), pQuorumBaseBlockIndex->GetBlockHash().ToString(),
-                              proTxHash.ToString());
+                    LogPrint(BCLog::LLMQ,
+                             "%s -- this node does not have verified contribution for llmq=%d block=%s protx=%s\n",
+                             __func__, ToUnderlying(llmqType),
+                             pQuorumBaseBlockIndex->GetBlockHash().ToString(),
+                             proTxHash.ToString());
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 94f0caa and 5a768a5.

📒 Files selected for processing (2)
  • src/llmq/dkgsessionmgr.cpp (1 hunks)
  • test/functional/test_framework/test_framework.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
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/llmq/dkgsessionmgr.cpp
test/functional/**/*.py

📄 CodeRabbit Inference Engine (CLAUDE.md)

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

Files:

  • test/functional/test_framework/test_framework.py
🧠 Learnings (3)
📓 Common learnings
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#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.
src/llmq/dkgsessionmgr.cpp (1)

Learnt from: kwvg
PR: #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.

test/functional/test_framework/test_framework.py (1)

Learnt from: kwvg
PR: #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.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: linux64_sqlite-build / Build source
  • GitHub Check: linux64_ubsan-build / Build source
  • GitHub Check: linux64-build / Build source
  • GitHub Check: linux64_fuzz-build / Build source
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: Lint / Run linters
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
  • GitHub Check: arm-linux-gnueabihf / Build depends
🔇 Additional comments (2)
test/functional/test_framework/test_framework.py (2)

2075-2076: LGTM! Correctly filters out invalid quorum commitments.

This change appropriately addresses the intermittent error described in issue #6748. By skipping quorum commitments with a zero public key (96 characters of zeros), the function now properly excludes invalid/empty commitments that were previously causing false positives when the node had no actual quorum information.


2083-2083: LGTM! Improved responsiveness by using default sleep interval.

Removing the explicit sleep=1 parameter allows the function to use the default 0.05-second sleep interval, which should make quorum commitment detection more responsive and help reduce the likelihood of timeout errors.

@knst knst force-pushed the tests-fix-waiting-qc branch from 5a768a5 to ab9fc70 Compare July 28, 2025 13:53
@kwvg kwvg changed the title test: fix intermittern error in wait_for_quorum_commitment test: fix intermittent error in wait_for_quorum_commitment Jul 28, 2025
@knst knst requested a review from UdjinM6 July 29, 2025 15:16
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.

utACK 928cf34

Copy link
Collaborator

@kwvg kwvg left a comment

Choose a reason for hiding this comment

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

utACK 928cf34

@PastaPastaPasta PastaPastaPasta merged commit d68bc28 into dashpay:develop Jul 30, 2025
32 of 34 checks passed
@knst knst deleted the tests-fix-waiting-qc branch July 30, 2025 14:47
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.

tests: feature_asset_locks.py is flakey

4 participants