Repository navigation
accept XDPoS RPC responses from both XDPoSChain and Nethermind - #52
Merged
wanwiset25 merged 2 commits intoOct 27, 2026
Merged
Conversation
XDPoSChain returns PascalCase keys ("EncodedRLP") and JSON numbers, while
Nethermind returns camelCase keys ("encodedRLP") and hex strings. The deploy
scripts read EpochBlockNumber, Masternodes, Committed and EncodedRLP by their
PascalCase names, so against a Nethermind subnet the gap block came out as
NaN and FullCheckpointDeploy failed with "Cannot read properties of
undefined (reading 'Committed')". Read those fields case-insensitively and
parse numbers from either format, as the relayer does since 4b4be45.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wanwiset25
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
docker run xinfinorg/csc:v0.3.0 fullfails against a subnet whoseSUBNET_URLnode runs Nethermind:XDPoSChain returns PascalCase keys and JSON numbers; Nethermind returns camelCase keys and hex strings (
epochBlockNumber: "0x510fd87",encodedRLP,masternodes,committed). The values are the same, only the keys differ. The deploy scripts read the PascalCase names:getGapSubnet/getEpochParentnet(cicd/util.js) readresult.EpochBlockNumber. With Nethermind it isundefined, so the start subnet block becomesNaN.FullCheckpointDeploy.jsthen asks forXDPoS_getV2BlockByNumber("0xNaN"). The node correctly rejects that, so there is noresult, and readingresult.Committedthrows.xdcnet.jsreadsCommitted,EncodedRLPandMasternodesby their PascalCase names.The relayer already handles both shapes (XDC-Relayer 4b4be45, in
xdc-relayer:feature-v0.5.0). This PR does the same for the CSC deploy scripts.Change
scripts/utils/rpcResultFields.js:getField(case-insensitive key lookup) andgetNumberField(also parses"0x"hex), modelled on the relayer'ssrc/service/xdpos.ts.cicd/util.js: readEpochBlockNumberthroughgetNumberField(both call sites).scripts/utils/xdcnet.js: readMasternodes,CommittedandEncodedRLPthroughgetField. A failed RPC call now reaches the existing "is not committed" / "no validators" messages instead of throwing aTypeError.test/RpcResultFields.js: unit test for both response shapes, a hex number, and missing fields or a failed call.Responses from XDPoSChain are read exactly as before.
Testing
npx hardhat test test/RpcResultFields.jspasses (3 tests), run insidexinfinorg/csc:v0.3.0.generator-v3.1.0wizard: 4 Nethermind subnet nodes (nethermindeth/nethermind:master-55f34a3) with Apothem as parentnet.fulldeploy withxinfinorg/csc:v0.3.0plus these three files fails as above without the change. With it, it deploys and initialisesFullCheckpointat0xfC803E731b970ce4098e94D32Ea91F3688831E6bon Apothem.xdc-relayer:feature-v0.5.0then checkpoints the subnet into it with no errors.getLatestBlocks()on the contract reports committed block #424 with the same hash the Nethermind node returns for #424.The
mastercopies ofcicd/util.jsandscripts/utils/xdcnet.jsare byte-identical to those in thev0.3.0image, so a rebuilt image only adds these changes.🤖 AI agent (Claude Code / Opus 5.5) on behalf of @ak88
🤖 Generated with Claude Code