Skip to content

feat(genesis): update devnet configuration and parameters - #2502

Open
anunay-xin wants to merge 2 commits into
dev-upgradefrom
aj/devnetsetup
Open

feat(genesis): update devnet configuration and parameters#2502
anunay-xin wants to merge 2 commits into
dev-upgradefrom
aj/devnetsetup

Conversation

@anunay-xin

@anunay-xin anunay-xin commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator
  • Changed Devnet chain ID from 5551 to 551 across multiple files.
  • Updated maximum masternodes from 108 to 18(10 masternodes/3 protector/5 observer(max is 10 observer)) 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.

Proposed changes

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Changes that don't change source code or tests
  • docs: Documentation only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that neither fixes a bug nor adds a feature
  • revert: Revert something
  • style: Changes that do not affect the meaning of the code
  • test: Adding missing tests or correcting existing tests

Impacted Components

Which parts of the codebase does this PR touch?
Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Tested on a private network from the genesis block and monitored the chain operating correctly for multiple epochs.
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

- 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.
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2d4eff78-67ca-4c25-b368-90763bac5d0c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 puppeth genesis 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.

Comment thread cmd/puppeth/wizard_genesis.go Outdated
Comment thread cmd/puppeth/wizard_genesis.go
Comment thread params/config_networks.go
- 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 null can 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 {

Comment thread params/config_networks.go
Comment on lines 181 to +185
50000: {
SwitchRound: 50000,
MaxMasternodes: 108,
MaxProtectorNodes: 324,
MaxObserverNodes: 2000,
MaxMasternodes: 10,
MaxProtectorNodes: 3,
MaxObserverNodes: 10,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gzliudan I have confusion on this, even if we dont change anything the config with switch round 0 will be applied till round 50000, right?
So is there need to change according to this comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants