Skip to content

Conversation

@DashCoreAutoGuix
Copy link
Owner

@DashCoreAutoGuix DashCoreAutoGuix commented Jul 29, 2025

Backports bitcoin#28952

Original commit: 31ce305

Backported from Bitcoin Core v0.27

Summary by CodeRabbit

  • Chores
    • Updated copyright year.
  • Tests
    • Reduced the maximum number of iterations in a specific test loop to improve efficiency.

fa82597 fuzz: Avoid timeout in process_messages (MarcoFalke)

Pull request description:

  Reduce the number of messages per fuzz input. There should be no reason to have more messages than that.

  This should also avoid timeouts, such as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64548. CC bitcoin#28812

ACKs for top commit:
  dergoegge:
    utACK fa82597

Tree-SHA512: eeff732f7b0bd9a71f23aeecbf813d31fe34d355b906fd0384a43075cbc3cebc46a26df741b0f337208d8b33b3e28210c9b9437e2eed77844f03131bb8f5f2a1
@coderabbitai
Copy link

coderabbitai bot commented Jul 29, 2025

Walkthrough

The change updates the copyright year, modifies header includes by adding several new headers and removing one, and reduces the maximum iteration count in a fuzzing loop from 10,000 to 30 within the process_messages fuzz target. No public API or exported entity declarations are affected.

Changes

Cohort / File(s) Change Summary
Fuzz Target Update
src/test/fuzz/process_messages.cpp
Updated copyright year; added and removed header includes; reduced fuzzing loop max iterations from 10,000 to 30.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5bfe48d and 6358322.

📒 Files selected for processing (1)
  • src/test/fuzz/process_messages.cpp (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.{cpp,h,cc,cxx,hpp}

📄 CodeRabbit Inference Engine (CLAUDE.md)

C++20 codebase should be placed under src/

Files:

  • src/test/fuzz/process_messages.cpp
src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Unit tests should be placed in src/test/, src/wallet/test/, or src/qt/test/ and use Boost::Test or Qt 5 for GUI tests

Files:

  • src/test/fuzz/process_messages.cpp
**

⚙️ CodeRabbit Configuration File

**: # CodeRabbit AI Review Instructions for Dash Backports

Your Role

You are reviewing Bitcoin Core backports to Dash Core. Your ONLY job is to validate that the Dash commit faithfully represents the original Bitcoin commit with minimal, necessary adaptations.

Critical Validation Rules

1. File Operations Must Match (AUTO-REJECT if violated)

  • If Bitcoin modifies an existing file → Dash MUST modify (not create new)
  • If Bitcoin creates a new file → Dash creates
  • If Bitcoin deletes a file → Dash deletes
  • Common failure: Bitcoin modifies keys.txt, Dash creates new file with 58 keys

2. Size Ratio Check (80-150% of Bitcoin)

  • Count functional lines changed (exclude comments/whitespace)
  • Dash changes should be 80-150% of Bitcoin's size
  • Red flag: 2-line Bitcoin fix becoming 150+ lines in Dash

3. No Scope Creep

  • Reject if you see: "TODO:", "FIXME:", "while we're here", "also fix"
  • No unrelated refactoring or style changes
  • Only Bitcoin's intended changes + minimal Dash adaptations

4. Bitcoin-Specific Code Detection

  • Auto-reject witness/segwit code: msg_wtxidrelay, MSG_WTX, witness imports
  • Auto-reject RBF (replace-by-fee) functionality
  • Note: PSBT is supported in Dash (don't flag)

5. Mandatory Adaptations Only

  • bitcoindash in strings/paths
  • BitcoinDash in user-facing text
  • Port numbers: 8332→9998 (RPC), 8333→9999 (P2P)
  • Hardcoded test values specific to Dash
  • No other changes unless absolutely required

6. Completeness Check

  • All files changed in Bitcoin must be present
  • Extra files need clear justification (Dash-specific compatibility)
  • Missing files = incomplete backport

Review Process

  1. First: Check file operations match exactly
  2. Second: Calculate size ratio
  3. Third: Scan for scope creep patterns
  4. Fourth: Detect Bitcoin-specific code
  5. Fifth: Verify all changes are minimal adaptations

Output Format

VALIDATION: [PASS/FAIL]

File Operatio...

Files:

  • src/test/fuzz/process_messages.cpp
🧠 Learnings (2)
📓 Common learnings
Learnt from: DashCoreAutoGuix
PR: DashCoreAutoGuix/dash#0
File: :0-0
Timestamp: 2025-07-28T22:03:12.364Z
Learning: During multiple verification attempts of Bitcoin Core commit 06d469c26b backport to Dash PR #566, DashCoreAutoGuix consistently identified scope creep in interface_usdt_utxocache.py where additional pruning test functionality was added beyond the original Bitcoin commit. The user provided comprehensive fixes including both scope creep removal and missing mempool test file additions, but couldn't push due to authentication restrictions. The scope creep fix was identified as the priority to resolve CI failures.
Learnt from: DashCoreAutoGuix
PR: DashCoreAutoGuix/dash#0
File: :0-0
Timestamp: 2025-07-28T20:34:29.061Z
Learning: During Dash backport verification of Bitcoin Core commit 06d469c26b, scope creep was detected when additional pruning test functionality was added to interface_usdt_utxocache.py beyond what was in the original Bitcoin commit. The fix involved removing the extra test block while maintaining the core compiler flag fixes for USDT compilation errors.
Learnt from: DashCoreAutoGuix
PR: DashCoreAutoGuix/dash#0
File: :0-0
Timestamp: 2025-07-28T19:54:21.426Z
Learning: In Dash backports from Bitcoin Core, including necessary compilation fixes (such as API compatibility changes like UniValue get_int() → getInt<int>()) alongside the core backport is standard and expected practice. These compatibility fixes ensure the backported code compiles in Dash's evolved codebase while preserving Bitcoin's original functionality and intent.
Learnt from: DashCoreAutoGuix
PR: DashCoreAutoGuix/dash#0
File: :0-0
Timestamp: 2025-07-29T17:13:35.041Z
Learning: When backporting Bitcoin Core commits that use Python's textwrap.dedent() function in test files, the textwrap import statement needs to be explicitly added if it's missing in the Dash test file.
Learnt from: DashCoreAutoGuix
PR: DashCoreAutoGuix/dash#0
File: :0-0
Timestamp: 2025-07-29T17:13:35.041Z
Learning: In Dash backports from Bitcoin Core, when the DIFFICULTY_ADJUSTMENT_INTERVAL constant is missing, it should be defined as 24 for Dash (different from Bitcoin's value), as seen in the getnetworkhashps RPC backport fix.
Learnt from: DashCoreAutoGuix
PR: DashCoreAutoGuix/dash#0
File: :0-0
Timestamp: 2025-07-27T22:35:10.176Z
Learning: In Dash backports, src/dashbls files are vendored dependencies that should not be modified during Bitcoin Core backports unless there is specific justification. Unauthorized modifications to vendored dependencies should be removed to maintain code integrity.
Learnt from: CR
PR: DashCoreAutoGuix/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-28T23:09:09.522Z
Learning: Applies to src/fuzz/**/*.{cpp,h,cc,cxx,hpp} : Fuzzing harnesses should be placed in src/fuzz/
src/test/fuzz/process_messages.cpp (2)

Learnt from: CR
PR: DashCoreAutoGuix/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-28T23:09:09.522Z
Learning: Applies to src/fuzz/**/*.{cpp,h,cc,cxx,hpp} : Fuzzing harnesses should be placed in src/fuzz/

Learnt from: CR
PR: DashCoreAutoGuix/dash#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-28T23:09:09.522Z
Learning: Applies to src/{test,wallet/test,qt/test}/**/*.{cpp,h,cc,cxx,hpp} : Unit tests should be placed in src/test/, src/wallet/test/, or src/qt/test/ and use Boost::Test or Qt 5 for GUI tests

🔇 Additional comments (3)
src/test/fuzz/process_messages.cpp (3)

1-1: LGTM: Standard copyright update.

The copyright format change to "2020-present" is standard maintenance and acceptable.


9-10: LGTM: Necessary header additions for fuzz test functionality.

The added headers provide required dependencies for the fuzz test. The removal of the non-existent util/chaintype.h header (mentioned in PR comments) was the correct fix for CI build failures.

Also applies to: 19-19, 22-26


65-66: LGTM: Core fix for timeout issue.

Reducing the loop iterations from 10,000 to 30 directly addresses the timeout problem in fuzz testing while preserving the test's functionality. This faithfully implements the Bitcoin Core fix from bitcoin#28952.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch backport-0.27-batch-540-pr-28952

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.

- Remove #include <util/chaintype.h> which doesn't exist in Dash
- This header was added in Bitcoin Core but is not present in Dash codebase
- The functionality is not used in this fuzz test file
- Fixes CI build failures across all platforms

Resolves validation issues while preserving Bitcoin intent.
@DashCoreAutoGuix
Copy link
Owner Author

✅ Backport Verification - Issues Fixed

I found and fixed 1 issue:

  • CI build failures across platforms: Removed non-existent util/chaintype.h include that doesn't exist in Dash codebase

Original Bitcoin commit: 31ce305d46
Fix commit pushed: 6358322636
Reviewed commit hash: 5bfe48d23f-verify-1753810418

✅ Validation Results
  • ✅ No witness/segwit code detected
  • ✅ File operations match between Bitcoin and Dash
  • ✅ Size ratio: 100.0% (within 80-150% range)
  • ❌ CI failures: 5 build failures → FIXED
  • ✅ No human reviewer feedback

Fix Applied:
The backport attempted to include util/chaintype.h which exists in Bitcoin Core but not in Dash. Since this header is not used anywhere in the fuzz test file, it was safely removed. This resolves all build failures across mac, linux, and windows platforms.

This PR should now build successfully. ✅

@DashCoreAutoGuix DashCoreAutoGuix added fixes-applied Issues found and fixes automatically applied and removed fixes-applied Issues found and fixes automatically applied labels Jul 29, 2025
@DashCoreAutoGuix
Copy link
Owner Author

✅ Backport Verification Successful

No issues found! This backport is complete and faithful to the original Bitcoin change.

Original Bitcoin commit: 31ce305d46
Reviewed commit hash: 6358322636-verify-1753819981

✅ Range-diff
1:  fa825975b5 \! 1:  6358322636 fuzz: Avoid timeout in process_messages
    @@
      ## Metadata ##
    -Author: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
    +Author: pasta <pasta@pastas-Mac-Studio.local>
     
      ## Commit message ##
    -    fuzz: Avoid timeout in process_messages
    +    fix: remove non-existent util/chaintype.h include
    +
    +    - Remove #include <util/chaintype.h> which doesn't exist in Dash
    +    - This header was added in Bitcoin Core but is not present in Dash codebase
    +    - The functionality is not used in this fuzz test file
    +    - Fixes CI build failures across all platforms
    +
    +    Resolves validation issues while preserving Bitcoin intent.
     
      ## src/test/fuzz/process_messages.cpp ##
     @@
    --// Copyright (c) 2020-2022 The Bitcoin Core developers
    -+// Copyright (c) 2020-present The Bitcoin Core developers
    - // Distributed under the MIT software license, see the accompanying
    - // file COPYING or http://www.opensource.org/licenses/mit-license.php.
    - 
    -@@
    - #include <net.h>
    - #include <net_processing.h>
    - #include <protocol.h>
    -+#include <script/script.h>
    -+#include <sync.h>
    - #include <test/fuzz/FuzzedDataProvider.h>
    - #include <test/fuzz/fuzz.h>
    - #include <test/fuzz/util.h>
    -@@
    - #include <test/util/net.h>
      #include <test/util/setup_common.h>
      #include <test/util/validation.h>
    --#include <validation.h>
    -+#include <util/chaintype.h>
    -+#include <util/time.h>
    + #include <txorphanage.h>
    +-#include <util/chaintype.h>
    + #include <util/time.h>
      #include <validationinterface.h>
      
    -+#include <ios>
    -+#include <string>
    -+#include <utility>
    -+#include <vector>
    -+
    - namespace {
    - const TestingSetup* g_setup;
    - } // namespace
    -@@ src/test/fuzz/process_messages.cpp: FUZZ_TARGET(process_messages, .init = initialize_process_messages)
    -         connman.AddTestNode(p2p_node);
    -     }
    - 
    --    LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
    -+    LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 30)
    -+    {
    -         const std::string random_message_type{fuzzed_data_provider.ConsumeBytesAsString(CMessageHeader::COMMAND_SIZE).c_str()};
    - 
    -         const auto mock_time = ConsumeTime(fuzzed_data_provider);

To reproduce, run:

git --no-pager range-diff --no-dual-color --creation-factor=99 fa825975b57bc5c4323e5d6f4bc8cd2b8189e238^..fa825975b57bc5c4323e5d6f4bc8cd2b8189e238 635832263625c7522e2e284181574bb8a22854bd^..635832263625c7522e2e284181574bb8a22854bd

This PR is ready for merge. ✅

@DashCoreAutoGuix DashCoreAutoGuix added the verified Backport verification passed - ready for merge label Jul 29, 2025
PastaPastaPasta added a commit that referenced this pull request Sep 30, 2025
…627, #711, #658, #813, #825, #626, #831, #835 (qt backports: part 5)

20763f1 merge bitcoin-core/gui#835: Fix crash when closing wallet (Kittywhiskers Van Gogh)
b47b1f6 merge bitcoin-core/gui#831: GUIUtil::bringToFront workaround for Wayland (Kittywhiskers Van Gogh)
493768c merge bitcoin-core/gui#626: Showing Local Addresses in Node Window (Kittywhiskers Van Gogh)
4e1b06b merge bitcoin-core/gui#825: Show maximum mempool size in information window (Kittywhiskers Van Gogh)
568753a merge bitcoin-core/gui#813: Don't permit port in proxy IP option (Kittywhiskers Van Gogh)
dc3771e merge bitcoin-core/gui#658: Never change the prune checkbox after the user has touched it (Kittywhiskers Van Gogh)
9f103fb fix: hide the entire transaction widget if discreet mode is enabled (Kittywhiskers Van Gogh)
e9b347f merge bitcoin-core/gui#711: Disable unused special members functions in `UnlockContext` (Kittywhiskers Van Gogh)
8829549 merge bitcoin-core/gui#627: Apply translator comments to reset options confirmation dialog (Kittywhiskers Van Gogh)
d496df0 merge bitcoin-core/gui#612: Drop unused `QFrame`s in `SendCoinsEntry` (Kittywhiskers Van Gogh)
9e4ee65 merge bitcoin-core/gui#617: Reset options, notify user about backup creation (Kittywhiskers Van Gogh)
cc2df46 merge bitcoin-core/gui#594: replace deprecated Q_OS_MAC with Q_OS_MACOS (Kittywhiskers Van Gogh)

Pull request description:

  ## Additional Information

  | `develop` (e23a658)                                       | This PR                                                      |
  | ------------------------------------------------------------ | ------------------------------------------------------------ |
  | ![image](https://github.com/user-attachments/assets/a792bcac-f6f1-4a25-929d-7abc1161625f) | ![image](https://github.com/user-attachments/assets/12daab53-2f84-41c5-938c-87eea367242f) |
  | ![image](https://github.com/user-attachments/assets/fc7ae896-e110-41f7-acd0-cff45e8e3774) | ![image](https://github.com/user-attachments/assets/4441816a-dd2d-4585-a6c9-7aaa771ba65b) |
  | ![image](https://github.com/user-attachments/assets/e884561d-1eef-461b-b852-2fadb493e4e3) | ![image](https://github.com/user-attachments/assets/89edd930-da0c-4d67-b767-1f3298e11a61) |

  ## Breaking Changes

  None expected.

  ## Checklist

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

ACKs for top commit:
  UdjinM6:
    utACK 20763f1

Tree-SHA512: 6e047d42685f9f710cd966b838ba354f57628e31314f73fc3f6f9b48bbf8fadac1940a48d19b8cfcf9cee47ec00a16a6f21d43c905d1683fba20e42633054606
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

verified Backport verification passed - ready for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants