Skip to content

test: set 0.05s delay for wait_until in functional tests #6631

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 5 commits into
base: develop
Choose a base branch
from

Conversation

knst
Copy link
Collaborator

@knst knst commented Apr 15, 2025

Issue being fixed or feature implemented

Waiting for 0.5s in functional test for every action is a bit excessive, especially for p2p tests that sending messages by localnetwork and waiting at least 0.5 seconds before checking if message is received.

What was done?

Decreasing default delay from 0.5s to 0.05s. It affects mostly p2p tests, but many other tests become faster too.
For quorum formation; for sporks and some other dash specific features bigger delays (0.5s, 1s) are used and they are out of scope of this PR.

How Has This Been Tested?

Speed up on CI for 30% and more.

[develop] linux64-test https://gitlab.com/dashpay/dash/-/jobs/10049432489
ALL | ✓ Passed | 7241 s (accumulated)
Runtime: 1272 s
[PR] linux64-test https://gitlab.com/dashpay/dash/-/jobs/10067158169
ALL | ✓ Passed | 5421 s (accumulated)
Runtime: 938 s
-25%

[develop] linux64-nowallet https://gitlab.com/dashpay/dash/-/jobs/10049432511
ALL | ✓ Passed | 2739 s (accumulated)
Runtime: 488 s
[PR] linux64-nowallet https://gitlab.com/dashpay/dash/-/jobs/10067158174
ALL | ✓ Passed | 1232 s (accumulated)
Runtime: 243 s
-49%

[develop] linux64-tsan https://gitlab.com/dashpay/dash/-/jobs/10049432499
ALL | ✓ Passed | 10399 s (accumulated)
Runtime: 2023 s
[PR] linux64-tsan https://gitlab.com/dashpay/dash/-/jobs/10072993489
ALL | ✓ Passed | 8710 s (accumulated)
Runtime: 1543 s
-25%

[develop] Functional tests on localhost (-O3, debug, no sanitizers, -j20):
ALL | ✓ Passed | 6680 s (accumulated)
Runtime: 372 s
[PR] Functional tests on localhost (-O3, debug, no sanitizers, -j20):
ALL | ✓ Passed | 4609 s (accumulated)
Runtime: 365 s
Benefits of running locally in 20 parallel jobs are very slight. Accumulated time is decreased for 40% as expected, but total time is decreased just for 2%.
It is because the slowest tests requires many quorums to be formed and they are still slow.

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 force-pushed the test-mini-delays branch from c0faa06 to 4f3832e Compare April 22, 2025 10:38
PastaPastaPasta added a commit that referenced this pull request Apr 25, 2025
…waiting votes to be propagated

be9cf82 test: fix intermittent failure in feature_governance.py waiting votes to be propagated (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  While implementing #6631 found instability in feature_governance.py

  ## What was done?
  Governance votes are not delivered instantly between notes. If any vote is delayed a bit the wrong amount of votes will be remembered and test will fail further when comparing its count.

  ## How Has This Been Tested?
  Tested locally with changes from #6631
  without them - 90+% probability feature_governance.py to fail, with them - no failure happens locally.

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] 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
  - [x] I have assigned this pull request to a milestone

ACKs for top commit:
  UdjinM6:
    utACK be9cf82

Tree-SHA512: 113f22314c1a269bfe804e8ad3f1aa02dd31155af08f073345bce52d93d23746cee543814f5b44791698e40eca843a747660fddf2a4eafb235c3b3044fe06ba6
@knst knst force-pushed the test-mini-delays branch 2 times, most recently from fd6ce4f to 1017a12 Compare May 12, 2025 17:52
@knst knst added this to the 23 milestone May 12, 2025
knst added 5 commits May 18, 2025 00:35
Quorums are already generated and mined, all calculations are done.

Waiting long (0.5seconds) is not necessary
Bumping mocktime and generation new blocks no useful anymore
Same delay is used for Bitcoin Core. Though, it can be appliable
directly for each usages such as quorum generation or waiting
for IS lock. It happends because some functional tests not only
waiting during delay, but also does something strange such as
bumping mocktime or generating new blocks. Also, some works during
quorum generation are assuming to be done while we waiting, but it's
not properly validated after delay, just assumed as it is done.
@knst knst force-pushed the test-mini-delays branch from 1017a12 to f7526ef Compare May 17, 2025 17:36
@knst knst marked this pull request as ready for review May 19, 2025 18:47
@knst knst requested review from PastaPastaPasta and UdjinM6 May 19, 2025 18:48
Copy link

coderabbitai bot commented May 19, 2025

Walkthrough

The changes adjust the polling intervals in wait loops within the test framework and related functional tests. The default sleep interval in the core wait_until and wait_until_helper functions is reduced from 0.5 seconds to 0.05 seconds, increasing polling frequency. Method signatures for wait_for_quorum_list and wait_for_quorums_list are updated to remove the sleep parameter, and their internal logic is simplified to direct state checks without mocktime or block generation steps. One test explicitly sets a 1-second sleep interval for a specific wait loop. No changes are made to the logic of the conditions being waited on.

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


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

📒 Files selected for processing (3)
  • test/functional/feature_mnehf.py (1 hunks)
  • test/functional/test_framework/test_framework.py (3 hunks)
  • test/functional/test_framework/util.py (1 hunks)
🔇 Additional comments (6)
test/functional/test_framework/util.py (1)

250-250: Approve reducing the default sleep interval

This change reduces the default sleep interval in wait_until_helper from 0.5 seconds to 0.05 seconds, which will make polling 10x more frequent in wait loops throughout the test framework.

test/functional/feature_mnehf.py (1)

232-232: Explicitly setting a slower polling interval for EHF activation

This change explicitly sets a 1-second sleep interval for this specific wait condition, overriding the new 0.05-second default. This is appropriate since waiting for EHF activation doesn't need the frequent polling that other operations might benefit from.

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

901-901: Approve reducing default sleep interval in wait_until

Reduced the default sleep parameter from 0.5 to 0.05 seconds, consistent with the change in util.py.


1680-1680: Approve wait_for_sporks_same still using 1-second sleep

This wait function still uses a 1-second sleep interval, which is appropriate for spork synchronization that doesn't need frequent polling.


1802-1807: Simplify wait_for_quorum_list with faster polling

The method has been simplified to directly check for quorum hash presence without additional side effects like block generation or mocktime bumping. Now uses the faster 0.05-second sleep interval.


1808-1813: Simplify wait_for_quorums_list with faster polling

Similar to wait_for_quorum_list, this method has been simplified to directly check for multiple quorum hashes without side effects, using the faster 0.05-second sleep interval.

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

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.

1 participant