Skip to content

test: intermittent error due to missing _other_ quorums #6671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

knst
Copy link
Collaborator

@knst knst commented May 16, 2025

Issue being fixed or feature implemented

In functional test feature_asset_locks.py a quorum for InstantSend is not generated intentionally but usually it is enough time to be formed while other quorums are generated.
Similar situation for p2p_instantsend.py and feature_notifications.py.

This fix is one of the blockers for #6631 because with smaller delays extra quorums (beyond expected) almost never formed.

Example of logs:

2025-05-15T19:50:51.884000Z TestFramework (INFO): Test no IS for asset unlock...
2025-05-15T19:50:52.892000Z TestFramework (INFO): Send tx with expected_error:'None'...
2025-05-15T19:51:54.214000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
        def check_instantlock():
            self.bump_mocktime(1)
            try:
                return node.getrawtransaction(txid, True)["instantlock"]
            except:
                return False
    ....
    not true after 60.0 seconds

Meanwhile, there's just no quorum for signing InstantSend, logs from nodes:

node3 2025-05-15T19:50:54.054321Z (mocktime: 2014-12-04T18:19:47Z) [ scheduler] [llmq/signing.cpp:712] [AsyncSignIfMember] [llmq] CSigningManager::AsyncSignIfMember -- failed to select quorum. id=ce79d1f19020ec65caa8a81306362ddad6ffd0e6fc45e18c83630f401b38d54c, msgHash=83b6e8b1549ad9f2750e13e61aabdf08fd31eb1e80cbbd3729920c4c840318ae

What was done?

How Has This Been Tested?

Run functional tests

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 (for repository code-owners and collaborators only)

knst added 4 commits May 16, 2025 20:18
… IS quorum

2025-05-15T19:50:51.884000Z TestFramework (INFO): Test no IS for asset unlock...
2025-05-15T19:50:52.892000Z TestFramework (INFO): Send tx with expected_error:'None'...
2025-05-15T19:51:54.214000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
        def check_instantlock():
            self.bump_mocktime(1)
            try:
                return node.getrawtransaction(txid, True)["instantlock"]
            except:
                return False
'''
2025-05-15T19:51:54.214000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/home/knst/projects/dash-v21/test/functional/test_framework/test_framework.py", line 162, in main
    self.run_test()
  File "/home/knst/projects/dash-v21/test/functional/feature_asset_locks.py", line 266, in run_test
    self.test_asset_unlocks(node_wallet, node, pubkey)
  File "/home/knst/projects/dash-v21/test/functional/feature_asset_locks.py", line 373, in test_asset_unlocks
    self.wait_for_instantlock(is_id, node)
  File "/home/knst/projects/dash-v21/test/functional/test_framework/test_framework.py", line 1655, in wait_for_instantlock
    if self.wait_until(check_instantlock, timeout=timeout, sleep=1, do_assert=expected) and not expected:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knst/projects/dash-v21/test/functional/test_framework/test_framework.py", line 902, in wait_until
    return wait_until_helper(test_function, timeout=timeout, lock=lock, timeout_factor=self.options.timeout_factor, sleep=sleep, do_assert=do_assert)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/knst/projects/dash-v21/test/functional/test_framework/util.py", line 287, in wait_until_helper
    raise AssertionError("Predicate {} not true after {} seconds".format(predicate_source, timeout))
AssertionError: Predicate ''''
        def check_instantlock():
            self.bump_mocktime(1)
            try:
                return node.getrawtransaction(txid, True)["instantlock"]
            except:
                return False
''' not true after 60.0 seconds
2025-05-15T19:51:54.265000Z TestFramework (INFO): Stopping nodes

 node3 2025-05-15T19:50:54.054321Z (mocktime: 2014-12-04T18:19:47Z) [ scheduler] [llmq/signing.cpp:712] [AsyncSignIfMember] [llmq] CSigningManager::AsyncSignIfMember -- failed to select quorum. id=ce79d1f19020ec65caa8a81306362ddad6ffd0e6fc45e18c83630f401b38d54c, msgHash=83b6e8b1549ad9f2750e13e61aabdf08fd31eb1e80cbbd3729920c4c840318ae
 node2 2025-05-15T19:50:54.054326Z (mocktime: 2014-12-04T18:19:47Z) [ scheduler] [llmq/signing.cpp:712] [AsyncSignIfMember] [llmq] CSigningManager::AsyncSignIfMember -- failed to select quorum. id=ce79d1f19020ec65caa8a81306362ddad6ffd0e6fc45e18c83630f401b38d54c, msgHash=83b6e8b1549ad9f2750e13e61aabdf08fd31eb1e80cbbd3729920c4c840318ae
@knst knst added this to the 23 milestone May 16, 2025
Copy link

coderabbitai bot commented May 16, 2025

Walkthrough

The changes introduce conditional quorum mining and enhanced logging across several functional test files. Instead of unconditionally mining quorums, the tests now check if the required quorum types already exist on node 0 before proceeding to mine new ones, logging the outcome in each case. This logic is applied for InstantSend and ChainLocks quorums in feature_asset_locks.py, feature_notifications.py, and p2p_instantsend.py. Additionally, logging statements were added to wait_for_instantlock and wait_for_chainlocked_block methods in the test framework to indicate when the code is waiting for InstantLock or ChainLock, without changing any method signatures or control flow.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9cb43c2 and b0dea8c.

📒 Files selected for processing (4)
  • test/functional/feature_asset_locks.py (1 hunks)
  • test/functional/feature_notifications.py (1 hunks)
  • test/functional/p2p_instantsend.py (1 hunks)
  • test/functional/test_framework/test_framework.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
test/functional/p2p_instantsend.py (1)
test/functional/test_framework/test_framework.py (2)
  • mine_cycle_quorum (1917-2039)
  • mine_quorum (1829-1915)
test/functional/feature_asset_locks.py (1)
test/functional/test_framework/test_framework.py (1)
  • mine_quorum (1829-1915)
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • 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: mac-build / Build source
  • GitHub Check: linux64_multiprocess-build / Build source
  • GitHub Check: linux64_tsan-build / Build source
  • GitHub Check: arm-linux-build / Build source
  • GitHub Check: linux64_nowallet-build / Build source
  • GitHub Check: win64-build / Build source
🔇 Additional comments (8)
test/functional/test_framework/test_framework.py (2)

1655-1656: Enhanced diagnostic logging for easier test debugging.

This addition improves debugging capabilities by adding an explicit log message indicating when the framework is expecting an InstantLock for a specific transaction.


1666-1667: Enhanced diagnostic logging for easier test debugging.

Similar to the InstantLock logging, this addition provides clear indication that the code is waiting for a ChainLock on a specific block, improving test visibility.

test/functional/p2p_instantsend.py (2)

26-27: LGTM: Added explicit logging for InstantSend quorum mining.

Clear log message helps identify what the test is doing and improves debugging capabilities.


28-32: Added conditional quorum mining to prevent redundant quorum creation.

This change addresses the core issue by checking if any llmq_test quorums already exist on node 0 before attempting to mine a new one. This prevents intermittent test failures that occurred when InstantSend quorums weren't intentionally generated.

test/functional/feature_notifications.py (2)

106-107: LGTM: Added explicit logging for InstantSend quorum mining.

Clear log message improves visibility and debugging capabilities.


108-113: Added conditional quorum mining to prevent redundant quorum creation.

This change follows the same pattern as in other tests, checking if any llmq_test quorums already exist on node 0 before mining a new one, which helps prevent intermittent test failures.

test/functional/feature_asset_locks.py (2)

323-328: Added conditional check for InstantSend quorum existence.

Now checks if an IS quorum already exists before mining a new one, which helps prevent redundant quorum creation and makes the test more efficient. This change aligns with the PR's goal of fixing intermittent failures due to missing quorums by adding explicit checks.


329-333: Added conditional check for platform quorum existence.

Similar to the InstantSend quorum check, this change verifies if a platform quorum already exists before mining a new one. This consistent approach across test files ensures quorums are always available when needed without duplicate mining efforts.

✨ Finishing Touches
  • 📝 Generate Docstrings

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 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.

@knst knst requested review from UdjinM6 and PastaPastaPasta May 16, 2025 19:42
@knst knst changed the title test: intermittert error due to missing _other_ quorums test: intermittent error due to missing _other_ quorums May 18, 2025
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 b0dea8c

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.

2 participants