Repository navigation
fix(rpc): decode Core v24 getblockchaininfo and add getdeploymentinfo - #1165
Conversation
Dash Core v24 moved deployment status out of getblockchaininfo into the
new getdeploymentinfo RPC (dash#6888): getblockchaininfo carries
`softforks` only with -deprecatedrpc=softforks. GetBlockchainInfoResult
required the field, so decoding any Core v24 answer failed with
"missing field `softforks`", which stops Platform's InitChain and
empties DAPI's blockchain status.
- `GetBlockchainInfoResult.softforks` defaults to an empty map when
Core leaves it out; its type is unchanged.
- `RpcApi::get_deployment_info(block_hash)` calls getdeploymentinfo at
the given block, or at the chain tip for `None`, and decodes
`{hash, height, deployments}` into `GetDeploymentInfoResult`. Its deployments are the `SoftforkInfo`
entries getblockchaininfo reported, built by the same Core function.
Core v23 answers it with method not found (-32601).
Tests decode real answers of Dash Core v24.0.0-rc.3 and v23.1.8 on
regtest, and pin that each buried deployment v23 reported in softforks
v24 reports identically in deployments.
Test would have caught this in CI: the Core v24 getblockchaininfo test
fails before the fix ("missing field `softforks`", the error seen on a
devnet) and passes after it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
While a version bits deployment is signalled, Core v24 reports the optional `bit`, `statistics`, `activation_height` and `signalling` fields in getdeploymentinfo. One entry that fails to decode fails the whole answer, so pin the started and locked_in states, captured from Core v24.0.0-rc.3 regtest with -vbparams. Test-only: no behaviour change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — coderabbitai not yet. Wait for the missing reviews, or a writer can post |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #1165 +/- ##
==========================================
+ Coverage 78.76% 78.80% +0.04%
==========================================
Files 302 302
Lines 80644 80770 +126
==========================================
+ Hits 63518 63650 +132
+ Misses 17126 17120 -6
|
|
Bots are done — your move: post |
Problem
Dash Core v24 moved deployment status out of
getblockchaininfointo the newgetdeploymentinfoRPC (dash#6888).getblockchaininfonow carriessoftforksonly when Core runs with-deprecatedrpc=softforks.GetBlockchainInfoResult.softforkswas a required field, so every Core v24 answer failed to decode withmissing field `softforks`.On a devnet running Core v24.0.0-rc.3, this stopped Platform's InitChain (
get_fork_info("mn_rr")readssoftforks), so no new Platform node could start. It also left the Core section of DAPI'sgetBlockchainStatusempty.Changes
GetBlockchainInfoResult.softforksis#[serde(default)]: an empty map when Core leaves it out. The type is unchanged, so callers compile as before.RpcApi::get_deployment_info(block_hash: Option<&BlockHash>)callsgetdeploymentinfo, at the chain tip forNone, and returnsGetDeploymentInfoResult { hash, height, deployments: HashMap<String, SoftforkInfo> }. This matches theRPCHelpManof v24.0.0-rc.3. Core buildsdeploymentswith the sameDeploymentInfo()that filledsoftforks, so the existingSoftforkInfodecodes it. Fields v24 adds to bip9 entries (status_next,ehf,signalling, …) are ignored.getdeploymentinfowith HTTP 404 and{"code":-32601,"message":"Method not found"}. Throughjsonrpc0.18's simple_http transport this arrives asError::JsonRpc(jsonrpc::Error::Rpc(RpcError { code: -32601, .. })), so a caller can fall back togetblockchaininfo().softforks. Platform does that.Tests
The fixtures are real answers from the official v24.0.0-rc.3 and v23.1.8 arm64 macOS release binaries (sha256 matches the release
SHA256SUMS), running regtest at height 440.deserialize_getblockchaininfo_without_softforks_from_core_v24: fails before the fix withmissing field `softforks`, the error seen on the devnet, and passes after it.deserialize_getdeploymentinfo_from_core_v24decodes all 18 deployments, buried and bip9.deserialize_getblockchaininfo_with_softforks_from_core_v23decodes v23'ssoftforks.getdeploymentinfo_reports_buried_deployments_as_softforks_didchecks that each of the 15 buried deployments v23 reports insoftforks, v24 reports identically indeployments.deserialize_signalled_deployments_from_core_v24decodes a bip9 deployment while it is signalled. It coversstarted(bit,statistics,signalling) andlocked_in(activation_height), captured with-vbparams. One entry that fails to decode fails the whole answer.A manual run of
Clientagainst both live nodes showed v24 decodingmn_rr = {buried, active, 432}fromgetdeploymentinfo. Against v23 it returnedJsonRpc(Rpc(RpcError { code: -32601, message: "Method not found" })).cargo test -p dashcore-rpc-json -p dashcore-rpc, clippy-D warningsand fmt all pass.Platform v5.0 needs the fix commit on
integration/v5.0-core-v24, and it is there as acherry-pick -x(379f0574). The follow-up commit only adds a test.🤖 Generated with Claude Code
PR Hygiene ·
09d16a2/self-reviewedrpc-client/src/client.rs,rpc-json/src/lib.rs) — QuantumExplorer or ZocoLini 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.