Skip to content

refactor(genesis,puppeth): simplify wizard, update defaults, base configs on LocalnetChainConfig#2438

Open
wanwiset25 wants to merge 6 commits into
dev-upgradefrom
upgrade-puppeth
Open

refactor(genesis,puppeth): simplify wizard, update defaults, base configs on LocalnetChainConfig#2438
wanwiset25 wants to merge 6 commits into
dev-upgradefrom
upgrade-puppeth

Conversation

@wanwiset25

Copy link
Copy Markdown
Collaborator

Proposed changes

puppeth wizard (cmd/puppeth/wizard_genesis.go)

  • Clone LocalnetChainConfig for the genesis config — single source of truth.
  • Trim GenesisInput to the fields actually used; take addresses as hex strings.
  • Bump defaults: GasLimit 4.7M→50M, Difficulty 524288→1.
  • Set masternode/protector/observer rewards from yield, rounded to 3 decimals.
  • Fund the deploy backend properly and use NewKeyedTransactorWithChainID (was deprecated NewKeyedTransactor + 1e9 wei that failed silently).
  • Promote silent deploy failures to log.Crit with the error.
  • Drop TIPTRC21FeeBlock/Gas50xBlock prompts (now from config).

Defaults

  • ChainId: 5551 → 5151
  • GasLimit: 4.7M → 50M
  • Difficulty: 524288 → 1
  • CertThreshold: 0.666 → 0.667
  • V2 switch: SwitchEpoch 1 → 0, SwitchBlock 900 → 0
  • New LocalnetV2Configs params: MaxProtectorNodes 324, MaxObverserNodes 2000, MinimumMinerBlockPerEpoch 5, LimitPenaltyEpoch 5, MinimumSigningTx 30
  • Rewards: MasternodeReward 63.42, ProtectorReward 50.27, ObserverReward 25.13

Tests / chore

  • Add genesis_deploy_test.go: assert makeGenesis deploys all system contracts with real bytecode.
  • Update config_networks_test.go fork-block expectations.
  • Remove checked-in puppeth.exe.

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

#2329 enabled London/EIP-1559 from genesis on TestXDPoSMockChainConfig,
which puppeth's contract deployer uses. This broke genesis generation:
bind now builds type-2 txs the legacy signer can't sign, and the base
fee made the 1 Gwei deployer balance insufficient. Every deploy failed
silently, producing a genesis with balances but no contract code.

- use NewKeyedTransactorWithChainID so type-2 txs can be signed
- fund the deployer with enough balance to cover the base fee
- parse YAML address inputs as strings (common.Address has no YAML
  unmarshaler, so they silently decoded to 0x0)
- log.Crit on any failed deploy instead of swallowing the error
- update default configs
- clean some logic in interactive puppeth processing
@coderabbitai

coderabbitai Bot commented Jul 6, 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

Run ID: b62a7972-89d8-4fd5-b3f2-034fce2989ca

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 upgrade-puppeth

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.

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