Skip to content

Conversation

@knst
Copy link
Collaborator

@knst knst commented Feb 17, 2025

What was done?

The majority of changes in this backport are scripted, better to keep commits as they are rather than squash together.

Original description:

Some cleanups after #6288 (see bitcoin#23300)

How Has This Been Tested?

Run unit 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 knst added this to the 23 milestone Feb 17, 2025
@coderabbitai
Copy link

coderabbitai bot commented Feb 17, 2025

Walkthrough

The changes modify multiple functional tests by removing or altering explicit synchronization calls such as self.sync_blocks() and self.sync_all() across various test modules. In many test cases—including those for wallet transactions, block template long polling, peer-to-peer interactions, mining operations, and network reconnection—the explicit wait for node synchronization after block generation or transaction processing has been removed. Additionally, a synchronization method has been switched from sync_blocks() to a lambda function that directly invokes self.sync_blocks, consolidating the synchronization process with block generation in one instance. Significant modifications also include enhancing the handling of string-based amounts in wallet transactions, correcting formatting issues, and updating copyright years from 2024 to 2025. These changes adjust the control flow and timing in test execution without altering overall test structure or declarations.


📜 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 66f4fc5 and 0b1d83a.

📒 Files selected for processing (32)
  • test/functional/feature_backwards_compatibility.py (0 hunks)
  • test/functional/feature_coinstatsindex.py (0 hunks)
  • test/functional/feature_dip4_coinbasemerkleroots.py (1 hunks)
  • test/functional/feature_fee_estimation.py (0 hunks)
  • test/functional/feature_index_prune.py (0 hunks)
  • test/functional/feature_llmq_dkgerrors.py (1 hunks)
  • test/functional/feature_llmq_rotation.py (5 hunks)
  • test/functional/feature_llmq_simplepose.py (2 hunks)
  • test/functional/mempool_packages.py (0 hunks)
  • test/functional/mining_getblocktemplate_longpoll.py (0 hunks)
  • test/functional/p2p_blockfilters.py (0 hunks)
  • test/functional/p2p_compactblocks_hb.py (0 hunks)
  • test/functional/p2p_node_network_limited.py (1 hunks)
  • test/functional/p2p_sendheaders.py (0 hunks)
  • test/functional/rpc_coinjoin.py (1 hunks)
  • test/functional/rpc_rawtransaction.py (0 hunks)
  • test/functional/test_framework/test_framework.py (1 hunks)
  • test/functional/wallet_abandonconflict.py (0 hunks)
  • test/functional/wallet_backup.py (0 hunks)
  • test/functional/wallet_balance.py (0 hunks)
  • test/functional/wallet_basic.py (0 hunks)
  • test/functional/wallet_hd.py (0 hunks)
  • test/functional/wallet_importdescriptors.py (1 hunks)
  • test/functional/wallet_keypool_topup.py (0 hunks)
  • test/functional/wallet_listreceivedby.py (0 hunks)
  • test/functional/wallet_mnemonicbits.py (1 hunks)
  • test/functional/wallet_multisig_descriptor_psbt.py (0 hunks)
  • test/functional/wallet_orphanedreward.py (0 hunks)
  • test/functional/wallet_reorgsrestore.py (0 hunks)
  • test/functional/wallet_send.py (0 hunks)
  • test/functional/wallet_txn_clone.py (0 hunks)
  • test/functional/wallet_txn_doublespend.py (0 hunks)
💤 Files with no reviewable changes (23)
  • test/functional/p2p_blockfilters.py
  • test/functional/wallet_txn_doublespend.py
  • test/functional/wallet_balance.py
  • test/functional/wallet_abandonconflict.py
  • test/functional/feature_coinstatsindex.py
  • test/functional/mempool_packages.py
  • test/functional/wallet_send.py
  • test/functional/wallet_txn_clone.py
  • test/functional/wallet_hd.py
  • test/functional/wallet_backup.py
  • test/functional/wallet_keypool_topup.py
  • test/functional/p2p_sendheaders.py
  • test/functional/wallet_listreceivedby.py
  • test/functional/feature_backwards_compatibility.py
  • test/functional/feature_index_prune.py
  • test/functional/wallet_multisig_descriptor_psbt.py
  • test/functional/wallet_reorgsrestore.py
  • test/functional/feature_fee_estimation.py
  • test/functional/wallet_orphanedreward.py
  • test/functional/p2p_compactblocks_hb.py
  • test/functional/mining_getblocktemplate_longpoll.py
  • test/functional/rpc_rawtransaction.py
  • test/functional/wallet_basic.py
🚧 Files skipped from review as they are similar to previous changes (9)
  • test/functional/feature_llmq_dkgerrors.py
  • test/functional/rpc_coinjoin.py
  • test/functional/feature_dip4_coinbasemerkleroots.py
  • test/functional/p2p_node_network_limited.py
  • test/functional/feature_llmq_simplepose.py
  • test/functional/wallet_importdescriptors.py
  • test/functional/wallet_mnemonicbits.py
  • test/functional/feature_llmq_rotation.py
  • test/functional/test_framework/test_framework.py
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: arm-linux-gnueabihf / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bb46968 and 8e6ca58.

📒 Files selected for processing (32)
  • test/functional/feature_backwards_compatibility.py (0 hunks)
  • test/functional/feature_coinstatsindex.py (0 hunks)
  • test/functional/feature_dip4_coinbasemerkleroots.py (2 hunks)
  • test/functional/feature_fee_estimation.py (0 hunks)
  • test/functional/feature_index_prune.py (0 hunks)
  • test/functional/feature_llmq_dkgerrors.py (1 hunks)
  • test/functional/feature_llmq_rotation.py (5 hunks)
  • test/functional/feature_llmq_simplepose.py (2 hunks)
  • test/functional/mempool_packages.py (0 hunks)
  • test/functional/mining_getblocktemplate_longpoll.py (0 hunks)
  • test/functional/p2p_blockfilters.py (0 hunks)
  • test/functional/p2p_compactblocks_hb.py (0 hunks)
  • test/functional/p2p_node_network_limited.py (1 hunks)
  • test/functional/p2p_sendheaders.py (0 hunks)
  • test/functional/rpc_coinjoin.py (1 hunks)
  • test/functional/rpc_rawtransaction.py (0 hunks)
  • test/functional/test_framework/test_framework.py (0 hunks)
  • test/functional/wallet_abandonconflict.py (0 hunks)
  • test/functional/wallet_backup.py (0 hunks)
  • test/functional/wallet_balance.py (0 hunks)
  • test/functional/wallet_basic.py (0 hunks)
  • test/functional/wallet_hd.py (0 hunks)
  • test/functional/wallet_importdescriptors.py (1 hunks)
  • test/functional/wallet_keypool_topup.py (0 hunks)
  • test/functional/wallet_listreceivedby.py (0 hunks)
  • test/functional/wallet_mnemonicbits.py (1 hunks)
  • test/functional/wallet_multisig_descriptor_psbt.py (0 hunks)
  • test/functional/wallet_orphanedreward.py (0 hunks)
  • test/functional/wallet_reorgsrestore.py (0 hunks)
  • test/functional/wallet_send.py (0 hunks)
  • test/functional/wallet_txn_clone.py (0 hunks)
  • test/functional/wallet_txn_doublespend.py (0 hunks)
💤 Files with no reviewable changes (24)
  • test/functional/wallet_listreceivedby.py
  • test/functional/mining_getblocktemplate_longpoll.py
  • test/functional/wallet_multisig_descriptor_psbt.py
  • test/functional/wallet_txn_doublespend.py
  • test/functional/wallet_backup.py
  • test/functional/p2p_blockfilters.py
  • test/functional/feature_fee_estimation.py
  • test/functional/feature_backwards_compatibility.py
  • test/functional/wallet_orphanedreward.py
  • test/functional/wallet_txn_clone.py
  • test/functional/wallet_abandonconflict.py
  • test/functional/feature_coinstatsindex.py
  • test/functional/wallet_keypool_topup.py
  • test/functional/p2p_compactblocks_hb.py
  • test/functional/mempool_packages.py
  • test/functional/wallet_send.py
  • test/functional/wallet_reorgsrestore.py
  • test/functional/wallet_balance.py
  • test/functional/wallet_hd.py
  • test/functional/p2p_sendheaders.py
  • test/functional/feature_index_prune.py
  • test/functional/rpc_rawtransaction.py
  • test/functional/test_framework/test_framework.py
  • test/functional/wallet_basic.py
✅ Files skipped from review due to trivial changes (2)
  • test/functional/rpc_coinjoin.py
  • test/functional/wallet_importdescriptors.py
🧰 Additional context used
🪛 GitHub Actions: Check Potential Conflicts
test/functional/feature_dip4_coinbasemerkleroots.py

[error] 1-1: Conflicts detected with multiple pull requests.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build container / Build container
🔇 Additional comments (10)
test/functional/p2p_node_network_limited.py (1)

70-70: LGTM! Improved synchronization clarity.

The change from self.no_op to an explicit synchronization lambda makes the code's intent clearer and ensures proper synchronization between the relevant nodes. This is particularly important as these blocks are crucial for testing the NODE_NETWORK_LIMITED functionality.

test/functional/wallet_mnemonicbits.py (1)

2-2: LGTM!

The copyright year update is accurate and consistent with other files in the PR.

test/functional/feature_llmq_dkgerrors.py (2)

2-2: LGTM!

The copyright year update is accurate and consistent with other files in the PR.


88-88: LGTM!

The use of sync_fun=self.no_op with generate is consistent with the PR's objective of cleaning up synchronization calls. Since this is part of the healing process and immediate synchronization isn't required, this change is appropriate.

test/functional/feature_llmq_simplepose.py (2)

2-2: LGTM: Copyright year updated.

Updated copyright year to reflect current year 2025.


112-112:

❓ Verification inconclusive

LGTM: Simplified block generation call.

Removed unnecessary sync_fun parameter in generate call, which aligns with the function's purpose of performing less synchronization checks as documented in the method's comments.

Let's verify if this change is consistent with other test files:


🏁 Script executed:

#!/bin/bash
# Description: Check for similar sync_fun parameter usage patterns in other test files

# Search for generate calls with sync_fun parameter
rg 'generate.*sync_fun.*=.*self\.no_op' test/functional/

Length of output: 19228


LGTM: Simplified block generation call.

The updated call in test/functional/feature_llmq_simplepose.py now omits the sync_fun parameter—this appears intentional based on the method’s comments aiming for reduced synchronization overhead. Note that while many other tests continue to pass sync_fun=self.no_op, this file’s change seems context-specific. Please verify that this divergence is deliberate and that the behavior in llmq_simplepose remains correct.

test/functional/feature_dip4_coinbasemerkleroots.py (3)

2-2: Update copyright year.

The copyright year has been updated to reflect the current year.


1-321:

❓ Verification inconclusive

Resolve potential conflicts before merging.

The GitHub Actions pipeline has detected potential conflicts with other pull requests. Please rebase this branch on the latest master and resolve any conflicts.


🏁 Script executed:

#!/bin/bash
# Description: Check for potential merge conflicts with master

# Fetch the latest master
git fetch origin master

# Check for conflicts
git merge-tree $(git merge-base HEAD origin/master) origin/master HEAD

Length of output: 287


Action Required: Verify and Resolve Merge Conflicts

The GitHub Actions pipeline reported potential conflicts, but the automated merge-tree command using origin/master failed with an error. This suggests that the default remote branch might not be named "master" (it could be "main" or another name). Please verify manually that your branch is rebased onto the correct base branch (e.g., "origin/main") and that no merge conflicts exist. You can check available remote branches with:

git branch -r

Then, if "origin/main" is the appropriate base, run:

git fetch origin main
git merge-tree $(git merge-base HEAD origin/main) origin/main HEAD

Resolve any conflicts revealed by these commands before merging.

🧰 Tools
🪛 GitHub Actions: Check Potential Conflicts

[error] 1-1: Conflicts detected with multiple pull requests.


317-317:

❓ Verification inconclusive

Verify the impact of switching to sync_all().

The change from sync_blocks() to sync_all() in the confirm_mns function is part of a broader pattern of synchronization method updates. While sync_all() provides more comprehensive synchronization by including transactions and other state information, we should verify that this change doesn't introduce any timing issues or performance impacts.


🏁 Script executed:

#!/bin/bash
# Description: Search for other instances of sync_blocks() to ensure consistency
# and identify potential patterns in sync method usage.

echo "Searching for sync_blocks() usage patterns..."
rg -A 3 'sync_blocks\(\)' test/functional/

echo "Searching for sync_all() usage patterns..."
rg -A 3 'sync_all\(\)' test/functional/

Length of output: 48885


Double-check the synchronization impact of using sync_all()

The update in the confirm_mns function to call sync_all()—which now offers broader state synchronization (including transactions and additional details)—appears consistent with changes observed across several test files (e.g., in wallet tests and DIP3-related tests). However, since many parts of the codebase still rely on sync_blocks(), please verify that this change does not introduce timing or performance overhead in time-sensitive scenarios. In particular:

  • Confirm that using sync_all() in test/functional/feature_dip4_coinbasemerkleroots.py (line 317) does not delay synchronization compared to previous tests.
  • Check for any subtle performance regressions or intermittent issues resulting from additional synchronization steps.
test/functional/feature_llmq_rotation.py (1)

2-2: LGTM!

Copyright year updated to 2025.


self.log.info("Mine single block, wait for chainlock")
self.generate(self.nodes[0], 1, sync_fun=self.no_op)
self.generate(self.nodes[0], 1)
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify test stability after removing synchronization.

The removal of sync_fun parameter from generate calls might affect test reliability. While this aligns with the broader changes to simplify synchronization across test files (as mentioned in the PR objectives), we should ensure that the test remains stable, especially given the complex nature of LLMQ rotation testing.

Also applies to: 118-118, 199-199, 391-391


🏁 Script executed:

#!/bin/bash
# Description: Check test stability by running it multiple times
# Note: This is a basic stability check. In practice, the test framework would handle this.

for i in {1..3}; do
  echo "Running test iteration $i"
  python3 test/functional/feature_llmq_rotation.py
  if [ $? -ne 0 ]; then
    echo "Test failed on iteration $i"
    exit 1
  fi
done

Length of output: 982


Action Required: Test failure due to missing dependency 'dash_hash'

The removal of the sync_fun parameter remains valid, but the test now fails because the module dash_hash is missing. This failure prevents verification of test stability for LLMQ rotation. Please ensure that:

  • The dependency dash_hash is either added to the project (e.g., updating requirements or including it in the environment) or removed from the import in test/functional/test_framework/messages.py if it’s no longer needed.
  • Re-run the stability checks for all affected lines (87, 118, 199, and 391) once the issue is addressed.

@knst knst force-pushed the bp-v23-p8 branch 2 times, most recently from c4d9bec to 9de8ac1 Compare February 17, 2025 17:33
@knst
Copy link
Collaborator Author

knst commented Feb 17, 2025

Somehow, ./contrib/devtools/copyright_header.py on CI works not same as it works on my localhost, maybe there's some bug. See https://gitlab.com/dashpay/dash/-/jobs/9160560432 - I can't explain where test/functional/feature_multikeysporks.py from. I made copyright update as non-scripted diff.

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

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

Please get CI linters happy; maybe just drop "scripted-diff:" from commit? (mark ready for review when resolved)

@PastaPastaPasta PastaPastaPasta marked this pull request as draft February 17, 2025 20:59
@knst knst marked this pull request as ready for review February 18, 2025 18:42
UdjinM6
UdjinM6 previously approved these changes Feb 20, 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 66f4fc5

@github-actions
Copy link

This pull request has conflicts, please rebase.

MarcoFalke and others added 6 commits February 22, 2025 02:13
The sync calls are redundant after a call to generate, because generate
already syncs itself.

-BEGIN VERIFY SCRIPT-
perl -0777 -pi -e 's/(generate[^\n]*\)[^\n]*)(\n|\s)+self.sync_(all|blocks)\([^\)]*\)\n/\1\n/g' $(git grep -l generate ./test)
-END VERIFY SCRIPT-
The previous diff touched most files in ./test/, so bump the headers to
avoid having to touch them again for a bump later.

BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./test/
END VERIFY SCRIPT-
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 0b1d83a

@PastaPastaPasta PastaPastaPasta merged commit 7fc9a7b into dashpay:develop Mar 4, 2025
25 checks passed
@knst knst deleted the bp-v23-p8 branch March 4, 2025 14:03
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