Skip to content

fix(rpc-client): send the ChainLock block hash in display order to submitchainlock - #1148

Merged
ZocoLini merged 1 commit into
devfrom
fix/submit-chain-lock-hash-order
Oct 10, 2026
Merged

ZocoLini merged 1 commit into
devfrom
fix/submit-chain-lock-hash-order

Conversation

@ZocoLini

@ZocoLini ZocoLini commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #1128.

submit_chain_lock sent the hex of the block hash's internal bytes. Dash Core expects the reversed display order, the one getblockhash prints:

Core therefore verified the signature against the wrong hash and answered invalid signature, except when it already held a ChainLock at that height or above, where it returns before checking (#L1374). That hid the bug in the common case. Platform calls this in rs-drive-abci (verify_chain_lock_through_core, make_sure_core_is_synced_to_chain_lock), where a TODO notes submit_chain_lock responds with invalid signature.

The hash now goes through into_json, as in the other methods, which writes the display order. For mainnet genesis:

  • before: b67a40f3cd5804437a108f105533739c37e6229bc1adcab385140b59fd0f0000
  • after: 00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6

Only the request argument changes: the u32 response and all (de)serialization impls are untouched.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Chain-lock submissions now serialize the block hash as a JSON value rather than a lowercase hexadecimal string. Signature serialization and the block-height argument remain unchanged.

PR Hygiene · 9240f45

  • Bots — coderabbitai ✓
  • Self-review — post /self-reviewed
  • Build green
  • Approvals
    • files with no dedicated owner (rpc-client/src/client.rs) — QuantumExplorer 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.

…ubmitchainlock`

`submit_chain_lock` sent the hex of the hash's internal bytes, while
Dash Core reads `blockHash` with `ParseHashV`, which expects the reversed
display order. Core then verified the signature against the wrong hash
and answered `invalid signature`, except when it already held a
ChainLock at that height, where it returns before checking. Pass the
hash through `into_json` as the other methods do.

Closes #1128

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: dashpay/rust-dashcore/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c84be7e7-7f06-4dd2-97fc-08b0e4401b11
📥 Commits

Reviewing files that changed from the base of the PR and between 7b4f91b and 9240f45.

📒 Files selected for processing (1)
  • rpc-client/src/client.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.


📝 Walkthrough

Walkthrough

submit_chain_lock now passes the ChainLock’s block_hash directly as an RPC argument instead of converting its bytes to a lowercase hexadecimal string. Signature serialization and the block-height argument are unchanged.

Changes

ChainLock RPC

Layer / File(s) Summary
Pass the block hash directly
rpc-client/src/client.rs
submit_chain_lock now passes chain_lock.block_hash directly as an RPC argument. Signature serialization and the block-height argument are unchanged.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: kwvg

Merge Risk: ⚪ Minimal · up to 9240f

The ChainLock hash is sent in the format Core expects. No actionable merge risk was identified in the reviewed change.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: sending the ChainLock block hash in display order to submitchainlock. It is specific and related to the pull request objectives.
Linked Issues check ✅ Passed Issue #1128 requires submit_chain_lock to send the block hash in display order. The reviewed change serializes block_hash with into_json instead of hex::encode(block_hash). The PR evidence sta…
Out of Scope Changes check ✅ Passed The whole-PR summary reports one changed line in rpc-client/src/client.rs. The change only alters the submit_chain_lock block-hash argument. This change directly implements issue #1128 and does no…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · 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.

@github-actions

github-actions Bot commented Oct 8, 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 the waiting-self-review Waiting for the author to post /self-reviewed label Oct 8, 2026
@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.06%. Comparing base (7b4f91b) to head (9240f45).

Files with missing lines Patch % Lines
rpc-client/src/client.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1148      +/-   ##
==========================================
+ Coverage   76.43%   78.06%   +1.63%     
==========================================
  Files         239      302      +63     
  Lines       56011    79257   +23246     
==========================================
+ Hits        42813    61875   +19062     
- Misses      13198    17382    +4184     
Flag Coverage Δ
core 75.14% <ø> (ø)
ffi 51.83% <ø> (-0.08%) ⬇️
rpc 49.21% <0.00%> (ø)
spv 92.43% <ø> (+0.04%) ⬆️
wallet 81.99% <ø> (?)
Files with missing lines Coverage Δ
rpc-client/src/client.rs 10.14% <0.00%> (ø)

... and 66 files with indirect coverage changes

@ZocoLini
ZocoLini merged commit f4abb26 into dev Oct 10, 2026
37 of 39 checks passed
@ZocoLini
ZocoLini deleted the fix/submit-chain-lock-hash-order branch October 10, 2026 12:36
shumkov pushed a commit that referenced this pull request Oct 19, 2026
…ubmitchainlock` (#1148)

`submit_chain_lock` sent the hex of the hash's internal bytes, while
Dash Core reads `blockHash` with `ParseHashV`, which expects the reversed
display order. Core then verified the signature against the wrong hash
and answered `invalid signature`, except when it already held a
ChainLock at that height, where it returns before checking. Pass the
hash through `into_json` as the other methods do.

Closes #1128

Adapted for this branch: the signature argument here is still built
with `hex::encode`, not `to_lower_hex_string`, so only the block hash
line changes.

Co-authored-by: Claude Opus 5.5 <[email protected]>
(cherry picked from commit f4abb26)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rpc-client: submit_chain_lock sends block hash in reversed byte order

1 participant