fix,refactor(puppeth,config): support privatechain generator v3 - #2526
fix,refactor(puppeth,config): support privatechain generator v3#2526wanwiset25 wants to merge 6 commits into
Conversation
|
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: Team 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 |
a2c2ee1 to
a9f0c1b
Compare
There was a problem hiding this comment.
Pull request overview
Supports private-chain generator v3 while updating local/test network protocol settings.
Changes:
- Activates newer forks and adjusts localnet node limits.
- Revises reward calculations and imports foundation wallet addresses.
- Exempts bootstrap timeout certificates from verification.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
params/config_networks.go |
Updates local and mock-chain protocol configuration. |
cmd/puppeth/wizard_genesis.go |
Revises rewards and foundation wallet handling. |
consensus/XDPoS/engines/engine_v2/timeout.go |
Identifies bootstrap timeout certificates. |
consensus/XDPoS/engines/engine_v2/engine.go |
Skips verification for bootstrap certificates. |
consensus/tests/engine_v2_tests/sync_info_test.go |
Tests bootstrap certificate behavior. |
Suppressed comments (2)
params/config_networks.go:742
TestXDPoSMockChainConfigDeclaresModernForksexplicitly requires Osaka to be non-nil and active from genesis (params/config_networks_test.go:81-82). Setting it to nil guarantees a test failure; either preserve block 0 or update the test contract if deactivation is intentional.
OsakaBlock: nil,
cmd/puppeth/wizard_genesis.go:292
- The new foundation-address import path has no regression assertion: the existing puppeth integration test omits this field and only checks deployed contract code. Add a custom address to its YAML and assert that the generated
FoundationWalletAddrmatches it so the original import bug cannot recur.
genesis.Config.XDPoS.FoundationWalletAddr = common.HexToAddress(input.FoundationWalletAddress)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
9970dfb to
909f4d8
Compare
- add reward calc for protector and observer nodes
3214e92 to
4652fcd
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Custom epochs currently generate incorrect rewards and contract configuration, and consensus-sensitive changes require human review.
Review details
Suppressed comments (2)
cmd/puppeth/wizard_genesis.go:98
- The existing
makeGenesisdoc comment now attaches to this new type and describes the wrong declaration. Replace it with a type-specific comment (or move themakeGenesiscomment back immediately above the function).
// masternodeRewards are the per-epoch reward figures derived from the staking
// threshold and the target yield, in whole coins.
core/genesis_setup_test.go:40
- These three fork values are now supplied to the normalization test, but neither
cfgnorstoredCfgis checked for them. A regression that dropsDynamicGasLimitBlock,TIPUpgradeRewardBlock, orTIPUpgradePenaltyBlockwould still pass; assert that all three remain at block 34 after setup and reload.
DynamicGasLimitBlock: big.NewInt(34),
TIPUpgradeRewardBlock: big.NewInt(34),
TIPUpgradePenaltyBlock: big.NewInt(34),
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Balanced
| genesis.Config.XDPoS.V2.CurrentConfig.ObserverReward = math.Round(float64(rewardPerEpochPerMN)*0.6*1000) / 1000 | ||
|
|
||
| } | ||
| if rewards, ok := calcMasternodeRewards(genesis.Config.XDPoS.Period, genesis.Config.XDPoS.Epoch, threshold, yield, len(signers)); ok { |
| if !common.IsHexAddress(input.FoundationWalletAddress) { | ||
| log.Crit("Invalid foundation wallet address", "address", input.FoundationWalletAddress) | ||
| } | ||
| genesis.Config.XDPoS.FoundationWalletAddr = common.HexToAddress(input.FoundationWalletAddress) |
| DynamicGasLimitBlock: nil, | ||
| TIPUpgradeRewardBlock: nil, | ||
| TIPUpgradePenaltyBlock: nil, | ||
| OsakaBlock: nil, |
There was a problem hiding this comment.
why mock chain we need to disable OsakaBlock?
Proposed changes
Changes to support privatechain generator v3
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