Repository navigation
fix(rpc-client): send the ChainLock block hash in display order to submitchainlock - #1148
Conversation
…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]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesChainLock RPC
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to 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)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
Bots are done — your move: post |
Codecov Report❌ Patch coverage is
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
|
…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)
Closes #1128.
submit_chain_locksent the hex of the block hash's internal bytes. Dash Core expects the reversed display order, the onegetblockhashprints:submitchainlockreadsblockHashwithParseHashV(src/rpc/quorums.cpp#L1364).ParseHashVparses it withuint256S(src/rpc/util.cpp#L87-L95), i.e.SetHex, which fills the bytes from the end of the string (src/uint256.cpp#L20-L46), the inverse ofGetHex(#L10-L18).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 inrs-drive-abci(verify_chain_lock_through_core,make_sure_core_is_synced_to_chain_lock), where a TODO notessubmit_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:b67a40f3cd5804437a108f105533739c37e6229bc1adcab385140b59fd0f000000000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6Only the request argument changes: the
u32response and all (de)serialization impls are untouched.🤖 Generated with Claude Code
Summary by CodeRabbit
PR Hygiene ·
9240f45/self-reviewedrpc-client/src/client.rs) — QuantumExplorer or xdustinfaceWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.