Skip to content

fix(dash)!: use Dash Core's compact block inventory type and service flags - #1255

Merged
xdustinface merged 1 commit into
devfrom
pasta/inventory-service-flags
Nov 1, 2026
Merged

xdustinface merged 1 commit into
devfrom
pasta/inventory-service-flags

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Inventory::CompactBlock goes on the wire as type 4, Bitcoin's MSG_CMPCT_BLOCK. Dash Core's is 20 (src/protocol.h, GetDataMsg), and 4 is a retired type Dash Core skips, so a getdata for a compact block built with this crate asks for nothing, and a real one from a Dash peer decodes as Unknown { inv_type: 20 }. ServiceFlags has the same Bitcoin leftovers in the other direction: it names GETUTXO (bit 1) and WITNESS (bit 3), which Dash Core doesn't define, and it has no constant for Dash Core's NODE_P2P_V2 (bit 12, the BIP324 transport), which peers advertise.

This PR uses Dash Core's numbers:

  • Inventory::CompactBlock encodes and decodes as 20.
  • Inventory::WTx, WitnessTransaction and WitnessBlock are removed, because Dash has no BIP144 or BIP339. Types 4, 5, 0x40000001 and 0x40000002 decode as Inventory::Unknown and re-encode unchanged.
  • ServiceFlags::GETUTXO and ServiceFlags::WITNESS are removed and ServiceFlags::P2P_V2 (bit 12) is added, including in Display.

The service flags now match Dash Core's ServiceFlags from v22.0.0 through v24, and every inventory number the crate encodes is the one in Dash Core's GetDataMsg (types the crate has no variant for, such as sporks or governance objects, still decode as Unknown). Breaking, because public variants and constants go away.

Testing: new tests cover type 20 round-tripping and the non-Dash numbers decoding as unknown, and P2P_V2 and the dropped bits rendering. They fail on dev and pass here. Existing tests that used WITNESS keep the same bit through ServiceFlags::from(1 << 3) where they decode real bytes. cargo test -p dashcore, cargo clippy --workspace --all-features --all-targets -- -D warnings and cargo fmt --check pass.

🤖 Generated with Claude Code

PR Hygiene · 430298d

  • Bots — coderabbitai ✓
  • Self-review — posted; again after any push
  • Build green
  • Approvals
    • files with no dedicated owner (CHANGELOG.md, dash/src/network/address.rs, dash/src/network/constants.rs and 2 more) — QuantumExplorer or ZocoLini or xdustinface

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Summary by CodeRabbit

  • New Features
    • Added the Dash P2P v2 service flag at bit 12.
  • Bug Fixes
    • Compact block inventory messages now use type 20.
    • Bitcoin-specific witness inventory types and the GETUTXO and WITNESS service flags are no longer supported. Inventory types 4, 5, 0x40000001, and 0x40000002 are treated as unknown, with their original type and hash preserved when re-encoded.
    • Unnamed service flag bits continue to display as hexadecimal values.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 71dcd81 and 430298d.

Files selected for processing: 1
  • CHANGELOG.md
Files skipped from review as they are similar to previous changes: 1
  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The network service flags now include P2P_V2 and no longer include GETUTXO or WITNESS. Compact-block inventory uses type 20. The removed witness inventory variants are no longer decoded; the listed Bitcoin-specific inventory types decode as Unknown.

Changes: Dash network protocol updates

Layer / File(s) Summary
Service flag definitions and usage
dash/src/network/constants.rs, dash/src/network/address.rs, dash/src/network/message.rs, CHANGELOG.md
ServiceFlags adds P2P_V2 and removes GETUTXO and WITNESS. Formatting and related address and message tests use the updated flags.
Inventory variants and wire types
dash/src/network/message_blockdata.rs, CHANGELOG.md
CompactBlock uses inventory type 20. The removed witness inventory variants are no longer decoded; types 4, 5, 0x40000001, and 0x40000002 decode as Unknown and re-encode with their original type and hash.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to 43029

The protocol changes appear consistent across inventory and service-flag handling. No actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the two main changes: Dash Core's compact block inventory type and service flags. The changeset matches this. The compact block inventory type moves from 4 to 20, Bitcoin-only inventor…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the two main changes: Dash Core's compact block inventory type and service flags. The changeset matches this. The compact block inventory type moves from 4 to 20, Bitcoin-only inventory variants are removed, and ServiceFlags drops GETUTXO and WITNESS while adding P2P_V2 at bit 12. The title is specific and accurate. The conventional-commit prefix and the breaking-change marker match the breaking removals of public variants and constants.

Full details: Docstring Coverage

Explanation

Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 8 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Oct 31, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Oct 31, 2026
@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.56%. Comparing base (bab8b10) to head (430298d).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1255   +/-   ##
=======================================
  Coverage   80.56%   80.56%           
=======================================
  Files         291      291           
  Lines       77520    77538   +18     
=======================================
+ Hits        62454    62469   +15     
- Misses      15066    15069    +3     
Flag Coverage Δ
core 78.30% <100.00%> (+0.09%) ⬆️
ffi 56.99% <ø> (ø)
rpc 52.05% <ø> (ø)
spv 93.67% <ø> (-0.09%) ⬇️
wallet 82.71% <ø> (ø)
Files with missing lines Coverage Δ
dash/src/network/address.rs 91.76% <100.00%> (ø)
dash/src/network/constants.rs 86.91% <100.00%> (+1.20%) ⬆️
dash/src/network/message.rs 86.66% <100.00%> (ø)
dash/src/network/message_blockdata.rs 93.93% <100.00%> (+18.03%) ⬆️

... and 6 files with indirect coverage changes

@PastaPastaPasta

Copy link
Copy Markdown
Member Author

/self-reviewed

@github-actions

Copy link
Copy Markdown
Contributor

Ready for review — files with no dedicated owner: QuantumExplorer or ZocoLini or xdustinface.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. and removed waiting-self-review Waiting for the author to post /self-reviewed labels Oct 31, 2026
@github-actions github-actions Bot added the merge-conflict The PR conflicts with the target branch. label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

@PastaPastaPasta
PastaPastaPasta force-pushed the pasta/inventory-service-flags branch from 12f2b7f to 71dcd81 Compare November 1, 2026 00:12
@github-actions github-actions Bot removed the merge-conflict The PR conflicts with the target branch. label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. labels Nov 1, 2026
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

/self-reviewed

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 1, 2026
@github-actions github-actions Bot removed the waiting-bots Waiting for the review bots to report on this head label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them.

@github-actions github-actions Bot added the merge-conflict The PR conflicts with the target branch. label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Ready for review — files with no dedicated owner: QuantumExplorer or ZocoLini or xdustinface.
Full checklist in the description.

@github-actions github-actions Bot added the ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. label Nov 1, 2026
…flags

Inventory::CompactBlock went on the wire as Bitcoin's type 4; Dash
Core's MSG_CMPCT_BLOCK is 20. Drop the inventory types and service
flags Dash Core doesn't define (wtxid, BIP144 witness types, GETUTXO,
WITNESS) and add NODE_P2P_V2 (bit 12).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@PastaPastaPasta
PastaPastaPasta force-pushed the pasta/inventory-service-flags branch from 71dcd81 to 430298d Compare November 1, 2026 02:38
@github-actions github-actions Bot removed the merge-conflict The PR conflicts with the target branch. label Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. labels Nov 1, 2026
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

@coderabbitai review


🤖 Posted autonomously by Claude on behalf of pasta.

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Nov 1, 2026
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

/self-reviewed

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Ready for review — files with no dedicated owner: QuantumExplorer or ZocoLini or xdustinface.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human. and removed waiting-self-review Waiting for the author to post /self-reviewed labels Nov 1, 2026
@xdustinface
xdustinface merged commit 162b9dd into dev Nov 1, 2026
44 of 45 checks passed
@xdustinface
xdustinface deleted the pasta/inventory-service-flags branch November 1, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Bots have reported, the author has self-reviewed, and the build is green: this needs a human.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants