Skip to content

fix(devnet): update chain ID and genesis parameters for Devnet #2307

Open
anunay-xin wants to merge 2 commits intodev-upgradefrom
update-devnet-genesis
Open

fix(devnet): update chain ID and genesis parameters for Devnet #2307
anunay-xin wants to merge 2 commits intodev-upgradefrom
update-devnet-genesis

Conversation

@anunay-xin
Copy link
Copy Markdown
Collaborator

@anunay-xin anunay-xin commented Apr 15, 2026

  • Changed chain ID from 551 to 5551 in multiple files including genesis.json and flags.go.
  • Updated TIPV2SwitchBlock to 2700 and dynamicGasLimitBlock to 5000000 in constants.devnet.go.
  • Adjusted rewards and wallet addresses in the devnet configuration.
  • Modified genesis block timestamp and extra data for consistency with new parameters.
  • Ensured all related configurations reflect the new chain ID and settings for improved network stability.
  • Added dynamic gas limit block at 5 million block

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

…uration

- Changed chain ID from 551 to 5551 in multiple files including genesis.json and flags.go.
- Updated TIPV2SwitchBlock to 2700 and dynamicGasLimitBlock to 5000000 in constants.devnet.go.
- Adjusted rewards and wallet addresses in the devnet configuration.
- Modified genesis block timestamp and extra data for consistency with new parameters.
- Ensured all related configurations reflect the new chain ID and settings for improved network stability.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

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

Run ID: 7d906a2f-ae9c-47f6-b390-53ed4d397071

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-devnet-genesis

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 and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates Devnet network parameters to align a new Devnet identity and consensus/runtime settings (new genesis hash, network ID, fork switch blocks, and reward/address configuration) for a reset/stabilized Devnet.

Changes:

  • Bumps Devnet network ID to 5551 and updates Devnet genesis hash + genesis block fields.
  • Adjusts Devnet constants (TIPV2 switch at block 2700, dynamic gas limit activation at block 5,000,000).
  • Simplifies Devnet V2 config and updates Devnet reward + foundation wallet address.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.

File Description
params/config.go Updates Devnet genesis hash and modifies Devnet V2 / reward configuration.
core/genesis.go Updates Devnet genesis ExtraData and Timestamp.
common/constants.devnet.go Changes Devnet fork switch constants (TIPV2 + dynamic gas limit).
cmd/utils/flags.go Updates Devnet default NetworkId and network-id-to-flag mapping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread params/config.go
MasternodeReward: 63.42, // 57.078 goes to node, 6.34 goes to foundation
ProtectorReward: 50.27, // 45.243 goes to node, 5.02 goes to foundation
ObserverReward: 25.13, // 22.671 goes to node, 2.51 goes to foundation
ExpTimeoutConfig: ExpTimeoutConfig{Base: 0, MaxExponent: 0},
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

Setting ExpTimeoutConfig.Base to 0 is very likely to break exponential timeout logic (e.g., producing 0-duration timeouts or triggering divisions/log computations that assume a positive base). If the goal is to disable exponential backoff, prefer making that explicit (e.g., a dedicated flag) or use a safe neutral configuration (such as Base=1.0 with MaxExponent=0), or keep the previous non-zero base.

Suggested change
ExpTimeoutConfig: ExpTimeoutConfig{Base: 0, MaxExponent: 0},
ExpTimeoutConfig: ExpTimeoutConfig{Base: 1.0, MaxExponent: 0},

Copilot uses AI. Check for mistakes.
Comment thread params/config.go
Comment on lines 134 to 142
Default: {
SwitchRound: 0,
CertThreshold: 0.667,
TimeoutSyncThreshold: 3,
TimeoutPeriod: 5,
MinePeriod: 2,
ExpTimeoutConfig: ExpTimeoutConfig{Base: 2.0, MaxExponent: 5},
MaxMasternodes: 108,
MaxProtectorNodes: 100,
MaxObverserNodes: 1000,
MasternodeReward: 5000,
ProtectorReward: 4000,
ObserverReward: 1000,
},
252000: {
SwitchRound: 250000,
CertThreshold: 0.667,
TimeoutSyncThreshold: 3,
TimeoutPeriod: 5,
MinePeriod: 2,
ExpTimeoutConfig: ExpTimeoutConfig{Base: 2.0, MaxExponent: 5},
MaxMasternodes: 10,
MaxProtectorNodes: 3,
MaxObverserNodes: 1,
MasternodeReward: 57.06,
ProtectorReward: 45.25,
ObserverReward: 22.62,
},
261000: {
SwitchRound: 261000,
CertThreshold: 0.667,
TimeoutSyncThreshold: 3,
TimeoutPeriod: 5,
MinePeriod: 2,
ExpTimeoutConfig: ExpTimeoutConfig{Base: 2.0, MaxExponent: 5},
MaxMasternodes: 12,
MaxProtectorNodes: 0,
MaxObverserNodes: 1000,
MasternodeReward: 63.42, // 57.078 goes to node, 6.34 goes to foundation
ProtectorReward: 50.27, // 45.243 goes to node, 5.02 goes to foundation
ObserverReward: 25.13, // 22.671 goes to node, 2.51 goes to foundation
},
300000: {
SwitchRound: 300000,
CertThreshold: 0.667,
TimeoutSyncThreshold: 3,
TimeoutPeriod: 5,
TimeoutPeriod: 10,
MinePeriod: 2,
ExpTimeoutConfig: ExpTimeoutConfig{Base: 2.0, MaxExponent: 5},
MaxMasternodes: 12,
MaxProtectorNodes: 2,
MaxObverserNodes: 2,
MasternodeReward: 63.42, // 57.078 goes to node, 6.34 goes to foundation
ProtectorReward: 50.27, // 45.243 goes to node, 5.02 goes to foundation
ObserverReward: 25.13, // 22.671 goes to node, 2.51 goes to foundation
ExpTimeoutConfig: ExpTimeoutConfig{Base: 0, MaxExponent: 0},
},
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

This update removes previously explicit Devnet V2 fields (e.g., MaxProtectorNodes/MaxObserverNodes and the various *Reward fields). That means the chain rule now implicitly depends on Go zero-values for these fields, which makes it hard to audit the intended Devnet parameters and increases the chance of accidental behavior changes later. Consider either explicitly setting the intended values (even if 0) or adding an inline comment explaining which omitted fields are intentionally relying on defaults.

Copilot uses AI. Check for mistakes.
Comment thread cmd/utils/flags.go
case ctx.Bool(DevnetFlag.Name):
if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 551
cfg.NetworkId = 5551
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The PR description repeatedly says 'chain ID' is updated, but this change updates cfg.NetworkId (the devp2p network ID), not the EIP-155 chain ID (which typically lives in the chain config/genesis). It would help to either adjust the PR description to say 'network ID' here, or (if chain ID updates are also intended) ensure they’re clearly called out where ChainID is actually changed.

Copilot uses AI. Check for mistakes.
Comment thread core/genesis.go
Difficulty: big.NewInt(1),
Alloc: DecodeAllocJson(DevnetAllocData),
Timestamp: 1735513074,
Timestamp: 1765137783,
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

This raw Unix timestamp is hard to review/verify later. Consider adding a short comment with the human-readable UTC date/time (or generating it via a clearly documented constant) so reviewers/operators can quickly validate the intended genesis time.

Copilot uses AI. Check for mistakes.
…d tipUpgradePenalty to 5000000 in constants.devnet.go
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