Skip to content

fix(dash): normalize PlatformNodeId to canonical byte order at consensus boundary#888

Closed
Shaurya2k06 wants to merge 2 commits into
dashpay:devfrom
Shaurya2k06:fix/platform-node-id-byte-order-887
Closed

fix(dash): normalize PlatformNodeId to canonical byte order at consensus boundary#888
Shaurya2k06 wants to merge 2 commits into
dashpay:devfrom
Shaurya2k06:fix/platform-node-id-byte-order-887

Conversation

@Shaurya2k06

@Shaurya2k06 Shaurya2k06 commented Jul 14, 2026

Copy link
Copy Markdown

Closes #887.

Problem

PlatformNodeId (#885) kept ProRegTx/ProUpServTx/SML wire bytes as-is, but Dash Core serializes platformNodeID as uint160 whose on-wire m_data is the reverse of the GetHex / dashmate / Tenderdash form. from_ed25519_public_key (#884) already produces canonical-forward bytes, so decoded payload ids never equal derived ids — including key-wallet provider matching in account_checker.rs.

Verified: wire 8cb97997… ↔ canonical 68794393… (exact reversal).

Changes

  • PlatformNodeId::consensus_decode reverses wire → canonical inner bytes
  • PlatformNodeId::consensus_encode reverses canonical → wire
  • from_ed25519_public_key, Display, FromHex, serde unchanged
  • Docs: inner representation is always canonical Tenderdash node id

Compatibility

  • On-wire bytes for a given logical id unchanged (round-trip byte-identical)
  • Decoded PlatformNodeId Display/compare semantics change to canonical (intentional)
  • Bincode layout still 20 raw bytes; persisted MN engine state from before this fix may hold wire-order ids — re-sync / clear masternode state after upgrade
  • No downstream local reverse (avoids double-reverse once this lands)

Tests

  • Issue wire↔canonical vectors + encode/decode round-trip
  • #884 golden pubkey → canonical id → reversed wire → decode back
  • Asymmetric byte pattern asserts reverse-on-wire
  • ProRegTx v2 fixture: decoded id is reverse of wire slice; re-encode == original bytes
  • cargo test -p dashcore --all-features, -p key-wallet --all-features, -p key-wallet-ffi --all-features, clippy -D warnings, fmt

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Shaurya2k06, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e645593a-b5a2-4860-a558-60826dacda99

📥 Commits

Reviewing files that changed from the base of the PR and between ac8828c and 00142b8.

📒 Files selected for processing (2)
  • dash/src/blockdata/transaction/special_transaction/provider_registration.rs
  • dash/src/platform_node_id.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@Shaurya2k06 Shaurya2k06 force-pushed the fix/platform-node-id-byte-order-887 branch 2 times, most recently from 7ae2ee7 to dac20f1 Compare July 14, 2026 10:25
…sus boundary

Dash Core serializes platformNodeID as uint160 whose wire blob is the reverse
of the dashmate/Tenderdash form; reverse on encode/decode so derived and
decoded ids compare equal.

Closes #887.

Signed-off-by: shaurya2k06 <shaurya2k06@gmail.com>
@Shaurya2k06 Shaurya2k06 force-pushed the fix/platform-node-id-byte-order-887 branch from 6af82c1 to bf059d3 Compare July 14, 2026 10:28
@github-actions github-actions Bot added the merge-conflict The PR conflicts with the target branch. label Jul 14, 2026
@github-actions

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-conflict The PR conflicts with the target branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PlatformNodeId byte order differs between consensus_decode (wire-reversed) and from_ed25519_public_key (canonical) — payload/derived ids never match

1 participant