Skip to content

p2p_core%feat!: type senddsq, qsendrecsigs, sendcmpct, sendtxrcncl, ssc and getblocks - #74

Merged
kwvg merged 6 commits into
dashpay:developfrom
PastaPastaPasta:p2p-control
Oct 22, 2026
Merged

kwvg merged 6 commits into
dashpay:developfrom
PastaPastaPasta:p2p-control

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Motivation

Several messages that peers of the reference implementation (dashpay/dash v24.0.0-rc.3) send with a payload are not typed in dash-p2p-core:

  • senddsq and qsendrecsigs are declared as empty, so P2pMsg::decode_payload refuses every honest message with PayloadNotEmpty. The reference implementation sends both with a flag, the first one at the end of the handshake unless it rejects the peer's transactions.
  • sendcmpct, sendtxrcncl, ssc and getblocks are stubs, so their payload is carried as bytes and never checked.

This pull request gives each of them a type that reads its payload as the reference implementation does. Each type sits in the module of the subsystem it belongs to, and comes with a corpus section generated by running a program against the reference implementation at the pin above. Each section is embedded with its program. Every corpus test also checks that P2pMsg::decode_payload reads the payloads as the typed variant.

Module Messages
coinjoin.rs (new) senddsq
quorum_sigs.rs (new) qsendrecsigs
blocks.rs (new) sendcmpct, getblocks
tx_reconcile.rs (new) sendtxrcncl
gov.rs ssc

Additional Information

Description Notes Reference implementation Corpus
Read senddsq as one bool A non-zero byte reads as true, as it does in the reference implementation. read, send coinjoin.json5 senddsq
Read qsendrecsigs as one bool - read, send, send on authentication quorum_sigs.json5 qsendrecsigs
Type sendcmpct A flag, then a 64-bit version. Every version decodes; the reference implementation ignores the ones it does not support rather than refusing them. read, send blocks.json5 sendcmpct
Type sendtxrcncl A 32-bit version, then a 64-bit salt. read, send tx_reconcile.json5 sendtxrcncl
Type ssc Two signed 32-bit integers, the kind of item and the count. It is sent before the governance objects or votes it counts, so the type lives with GovSync as GovSyncStatusCount. read, send objects, send votes gov.json5 ssc
Type getblocks A locator, then a stop hash, laid out as getheaders. read blocks.json5 getblocks

The reference implementation disconnects a peer whose getblocks locator holds more than 101 hashes. That is a decision taken after decoding, and getheaders does not enforce it here either, so it is left out.

Breaking Changes

Changes below for dash-p2p-core.

  • P2pMsg::SendDsq and P2pMsg::QSendRecSigs carry the new SendDsq and QSendRecSigs. Decoding them takes one byte instead of an empty payload.
  • P2pMsg::SendCmpct, P2pMsg::SendTxRcncl, P2pMsg::Ssc and P2pMsg::GetBlocks carry the new SendCmpct, SendTxRcncl, GovSyncStatusCount and GetBlocks instead of the payload bytes. A payload that does not decode to one of them is refused.

How Has This Been Tested?

just comb

just comb (just test lint fuzz::test, CodeQL 2.27.2 included) passed on every commit, on develop (62d91ea), on x86_64 Linux. After the review's rename of tx_reconciliation to tx_reconcile, the three rewritten commits (sendtxrcncl, ssc, getblocks) were checked again with cargo fmt --check, cargo clippy -p dash-p2p-core --all-targets --all-features -- -D warnings, cargo test -p dash-p2p-core --all-features and the commit lint; the other three commits are unchanged.

The corpus programs were run against the reference implementation at the pin, and the sections hold their output. Each section says how to run its program.

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 tests
  • I have made corresponding changes to the documentation
  • I did not use agentic assistance (i.e. LLMs, AI) except as disclosed and can answer questions,
    comments and concerns without said assistance. I assume authorship of the code submitted.
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

Agent disclosure

Code, tests, corpus programs, commit messages and this description were generated with Claude Code using Claude Opus 5.5, running autonomously as an agent on behalf of the author. The agent also ran the corpus programs against the reference implementation. The branch was reviewed by a Claude Code agent using Opus 5.5.

🤖 Generated with Claude Code

@PastaPastaPasta PastaPastaPasta added this to the 0.1 milestone Oct 19, 2026
@PastaPastaPasta PastaPastaPasta added the topic:P2P Pull requests that concern primarily concern the dash-p2p-core crate. label Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Note

This pull request has no conflicts! 🎊 🎉 🎊

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

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 371b2b4 and b713938.

⛔ Files ignored due to path filters: 5
  • pkgs/p2p_core/corpus/blocks.json5 is excluded by !**/*.json5
  • pkgs/p2p_core/corpus/coinjoin.json5 is excluded by !**/*.json5
  • pkgs/p2p_core/corpus/gov.json5 is excluded by !**/*.json5
  • pkgs/p2p_core/corpus/quorum_sigs.json5 is excluded by !**/*.json5
  • pkgs/p2p_core/corpus/tx_reconcile.json5 is excluded by !**/*.json5
📒 Files selected for processing: 2
  • pkgs/p2p_core/src/msg/mod.rs
  • pkgs/p2p_core/src/msg/tx_reconcile.rs

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

📝 Summary

Summary by CodeRabbit

  • New Features
    • Added support for additional peer-to-peer messages for block relay, governance synchronization, CoinJoin, quorum signatures, and transaction reconciliation.
    • These messages can now be recognized and processed through the protocol’s message handling.
    • Added support for encoding and decoding the new messages, with optional serialization compatibility.

The P2P message module adds typed messages for block relay, CoinJoin, governance synchronization, quorum signatures, and transaction reconciliation. Each message has P2P codec support, and corpus tests cover wire handling and message dispatch. Tests also check serde round trips when the serde feature is enabled. The module publicly re-exports the new message types and registers them as parsed messages instead of using their former stub registrations.

Suggested reviewers: kwvg

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to b7139

The distinct CoinJoin queue command remains registered. No identified issue needs resolution before merge.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly identifies the six P2P message types that the pull request adds typed payloads for. The p2p_core%feat! prefix is noisy but does not prevent understanding the main change.
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.
Description check Passed The pull request description directly explains the typed payload changes for six P2P messages, the reference implementation behavior, tests, breaking changes, and validation performed.
  • 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

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Oct 20, 2026 •

Copy link
Copy Markdown

🕓 Review not started yet because the new head is waiting for the 30-minute push debounce.

  • Request normal review — click when the PR is ready for review.
  • Request priority review — click to move this review to the front of the queue.

Commit b713938. Normal review starts when eligible; priority review starts as soon as a slot is available.

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Final validation — Phase 1 + Phase 2

Verified the supplied findings against head f813760. The six payload layouts match the pinned Dash Core readers, and no blocking defect was found; one non-blocking suggestion remains for public-dispatch regression coverage. This was a static review with no local builds or tests; the supplied CI snapshot and current PR checks show successful build, test, lint, and cross-platform checks.

🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — The diff changes peer-facing deserialization in msg/control.rs, msg/blocks.rs, and msg/gov.rs, but its six straightforward payload types reuse existing codecs and dispatch machinery rather than introducing large or intricate parsing logic.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (lane failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `pkgs/p2p_core/src/msg/control.rs`:
- [SUGGESTION] pkgs/p2p_core/src/msg/control.rs:103-114: Cover typed dispatch and malformed-payload rejection for the four promoted stubs
  These tests call `check_wire`, which decodes the concrete struct directly without exercising `P2pMsg::decode_payload`. The same applies to `SyncStatusCount` and `GetBlocks`, so all four corpus suites would still pass if their registrations reverted to raw stubs, losing the payload validation this PR promises. Extend the dispatch-test pattern already used for `SendDsq` and `QSendRecSigs`: assert the expected typed variants for valid corpus payloads and errors for empty/truncated payloads and an appended byte. Include a non-minimal CompactSize locator count for `getblocks`. These can be ordinary parameterized tests without introducing an error-corpus format. The current registrations and shared decoder appear correct; this is regression coverage, not an observed decoding defect.

Comment thread pkgs/p2p_core/src/msg/control.rs Outdated

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review — Final validation — Phase 1 + Phase 2

Reviewed the complete base-to-head diff at 4a27668 and found no actionable defects. The six typed payloads match the pinned Dash Core layouts, retain the shared bounded and strict decoder path, and now have typed-dispatch regression coverage. Validation was static only; current GitHub checks report passing lint, MSRV build/test, stable-platform, and cross-build jobs.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.1-sol (effort low) — The diff changes peer-facing deserialization in pkgs/p2p_core/src/msg/mod.rs, but the six payload types use straightforward existing codecs and corpus tests rather than introducing large or intricate parsing logic.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (lane failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@kwvg kwvg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Implementation is sound, suggestions are mostly convention-related

Comment thread pkgs/p2p_core/src/msg/gov.rs Outdated
Comment thread pkgs/p2p_core/src/msg/control.rs Outdated
Comment thread pkgs/p2p_core/src/msg/control.rs Outdated
The reference implementation sends and reads `senddsq` with a flag, so
requiring an empty payload refused every honest message. The variant now
carries a `SendDsq`.
The reference implementation sends and reads `qsendrecsigs` with a flag,
so requiring an empty payload refused every honest message. The variant
now carries a `QSendRecSigs`.
The payload is a flag and a version, as the reference implementation
reads it. The variant now carries a `SendCmpct`, and a payload that
does not decode to one is refused.
@PastaPastaPasta PastaPastaPasta changed the title p2p_core%feat!: type the control messages the reference implementation sends with a payload p2p_core%feat!: type senddsq, qsendrecsigs, sendcmpct, sendtxrcncl, ssc and getblocks Oct 22, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Re-review — Final validation — Phase 1 + Phase 2

Independently reviewed the complete diff from 62d91ea to 371b2b4 and found no actionable in-scope issues. The six typed payloads match the pinned Dash Core wire layouts, preserve shared decoding protections and short IDs, and include typed-dispatch regression coverage that resolves the prior finding. Validation was static only; the exact-head CI snapshot and current PR checks show successful lint, MSRV build/tests, stable-platform builds, and cross-builds.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 3: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.1-sol (effort low) — The diff changes peer-facing network deserialization in Rust for multiple P2P message types, including blocks and transaction reconciliation payloads, making it an intricate critical-surface change.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
  • Fresh verifier: gpt-6.1-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — general (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6.1-sol — security-auditor (completed, effort xhigh); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.

@PastaPastaPasta
PastaPastaPasta requested a review from kwvg October 22, 2026 05:16
Comment thread pkgs/p2p_core/src/msg/tx_reconcile.rs
@kwvg

kwvg commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

@PastaPastaPasta, just do a rename and force-push based on the review comment and then I can approve this PR.

The payload is a version and a salt, as the reference implementation
reads it. The variant now carries a `SendTxRcncl`, and a payload that
does not decode to one is refused.
The payload is an item kind and a count, as the reference implementation
reads it. The variant now carries a `GovSyncStatusCount`, and a payload
that does not decode to one is refused.
The payload is a version, a locator and a stop hash, as the reference
implementation reads it. The variant now carries a `GetBlocks`, and a
payload that does not decode to one is refused.
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

@kwvg Done. The module and its corpus are renamed to tx_reconcile in the commit that creates them (now f315d3e), and the branch is force-pushed at b713938. The other commits' content is unchanged; I re-checked the three rewritten commits with fmt, clippy, the crate's tests and the commit lint.


🤖 Posted autonomously by Claude on behalf of pasta.

@kwvg kwvg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

utACK b713938

@kwvg
kwvg merged commit e95acf0 into dashpay:develop Oct 22, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:P2P Pull requests that concern primarily concern the dash-p2p-core crate.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants