feat(genesis): update devnet configuration and parameters - #2502
Conversation
- Changed Devnet chain ID from 5551 to 551 across multiple files. - Updated maximum masternodes from 108 to 18 in genesis and related configurations. - Adjusted foundation wallet address and reward parameters in devnet.json. - Enhanced genesis input structure to include max nodes for masternodes, protectors, and observers. - Fixed network selection documentation to reflect the new chain ID for devnet.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
There was a problem hiding this comment.
Pull request overview
This PR updates the built-in devnet chain configuration/genesis parameters (including a new chain ID and updated XDPoS v2 limits/reward settings) and extends the puppeth genesis wizard input to optionally supply v2 seat limits. It also refreshes tests and operator docs so the built-in network selection behavior matches the new devnet identity.
Changes:
- Update devnet identity/config: chain ID
5551 -> 551, new genesis hash, updated XDPoS reward/foundation address, and updated v2 config seat limits. - Refresh backfill tests and upgrade documentation to reference the new devnet chain ID.
- Extend
puppethgenesis input to include v2 max seats (masternodes/protectors/observers).
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| params/config_networks.go | Updates built-in devnet genesis hash, chain ID, and devnet XDPoS/v2 parameter schedules (including seat limits). |
| params/config_backfill_test.go | Adjusts backfill tests to use the new devnet chain ID value. |
| docs/upgrade.md | Updates operator docs to reflect devnet chain ID 551 in network selection and migration guidance. |
| core/genesis.go | Updates the built-in devnet genesis block fields (extraData/timestamp) to match the new devnet config. |
| cmd/utils/flags.go | Ensures --devnet default NetworkId reflects the new chain ID and mapping comments are updated. |
| cmd/puppeth/wizard_genesis.go | Adds genesis input fields for v2 seat limits and applies them during non-interactive genesis generation. |
- Implemented `validateGenesisInput` function to ensure non-negative limits for max masternodes, protector nodes, and observer nodes. - Added unit tests to verify validation logic for various negative input scenarios in `genesis_input_test.go`. - Updated `loadGenesisInput` method to include validation checks and log warnings for invalid inputs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
core/genesis.go:934
- Devnet genesis contents and the enforced params.DevnetGenesisHash are both updated in this PR, but there’s no test asserting DefaultDevnetGenesisBlock().ToBlock().Hash() matches params.DevnetGenesisHash (unlike mainnet/testnet coverage). A mismatch here would silently break built-in devnet detection and config enforcement.
// DefaultDevnetGenesisBlock returns the XDC devnet genesis block.
func DefaultDevnetGenesisBlock() *Genesis {
return &Genesis{
Config: params.DevnetChainConfig,
Nonce: 0,
ExtraData: hexutil.MustDecode("0x000000000000000000000000000000000000000000000000000000000000000014a6f54c572a8b97735fa0332e5b4d9423a2ef2f18c6785a9db320c39ce72ef66f395cf87897bda82ab752f85637818e619447a34f112953cbc47e382f1e1ea681f95f9c0191f780714730d752c42c6e54df9aa5dd09e4010e3f8bbc2c89394adf70493e64e580d02446d4052d8bfd826fbd84274dc6635b83b8893d85b7f5a3ed47c38142ca96640a3490de959ecd9c04e87dc5002e90990fa182dc6c72708b9e5c011c619464eba3db4bdd23cbf2dcce66ad7eb8e36187c560bd9c26272c2fcd9a603fe56d5514c9f8f51c5c0406f810327879d5ec3bddfcbc705bd59dcf8bef5b97d967635712011dcaf717e75161d9a01e03710401c4aa75d02455ebb518e01cf342df118e11a82352fb4b3202a0071806f9b80af685e41e28fa809723aa60e63cfca6dc0f701d4abb57f28f3dd1879199e6452d557419f6d77c05ee343df7ef570e349533f7673cd41eea411f5ab4679a97fda1ee970dd71690fac008b2db45965beb60cf620000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
GasLimit: 4700000,
Difficulty: big.NewInt(1),
Alloc: DecodeAllocJson(DevnetAllocData),
Timestamp: 1785709299,
}
cmd/puppeth/wizard_genesis.go:86
- validateGenesisInput dereferences input without a nil guard. Because the YAML decoder is decoding into a **GenesisInput (decoder.Decode(&input)), a YAML file containing
nullcan set input to nil, which would panic during validation.
func validateGenesisInput(input *GenesisInput) error {
if input.MaxMasternodes < 0 {
return fmt.Errorf("maxMasternodes must be non-negative, got %d", input.MaxMasternodes)
}
if input.MaxProtectorNodes < 0 {
e613a91 to
065ee2a
Compare
Proposed changes
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which parts of the codebase does this PR touch?
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that