Skip to content

Commit

Permalink
Merge pull request #2277 from cheng762/develop
Browse files Browse the repository at this point in the history
update max Validators only for main net
  • Loading branch information
benbaley authored Feb 28, 2025
2 parents 9d3ec22 + 92b2026 commit 8642dfc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ var (
AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), PrivatePIP7ChainID, "lat", "", big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), &CbftConfig{Period: 3}, FORKVERSION_1_5_0, sync.RWMutex{}}

PrivatePIP7ChainID = new(big.Int).SetUint64(2203181)

MainPIP7ChainID = new(big.Int).SetUint64(210425)
)

// TrustedCheckpoint represents a set of post-processed trie roots (CHT and
Expand Down
2 changes: 1 addition & 1 deletion x/plugin/gov_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (govPlugin *GovPlugin) BeginBlock(blockHash common.Hash, header *types.Head
}
log.Info("Successfully upgraded the new version 1.3.0", "blockNumber", blockNumber, "blockHash", blockHash, "preActiveProposalID", preActiveVersionProposalID)
}
if versionProposal.NewVersion == params.FORKVERSION_1_5_0 {
if versionProposal.NewVersion == params.FORKVERSION_1_5_0 && govPlugin.chainConfig.PIP7ChainID.Cmp(params.MainPIP7ChainID) == 0 {
if err := gov.UpdateGovernParamValue(gov.ModuleStaking, gov.KeyMaxValidators, fmt.Sprint(xcom.MaxValidatorsForVersion150), blockNumber+1, blockHash); err != nil {
return err
}
Expand Down
7 changes: 4 additions & 3 deletions x/plugin/staking_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3166,9 +3166,10 @@ func vrfElection(validatorList staking.ValidatorQueue, shiftLen int, nonce []byt
return nil, err
}
if len(preNonces) < len(validatorList) {
log.Error("Failed to vrfElection on Election", "blockNumber", blockNumber, "validatorListSize", len(validatorList),
"nonceSize", len(nonce), "preNoncesSize", len(preNonces), "parentHash", hex.EncodeToString(parentHash.Bytes()))
return nil, staking.ErrWrongFuncParams
validatorList = validatorList[:len(preNonces)]
//log.Error("Failed to vrfElection on Election", "blockNumber", blockNumber, "validatorListSize", len(validatorList),
// "nonceSize", len(nonce), "preNoncesSize", len(preNonces), "parentHash", hex.EncodeToString(parentHash.Bytes()))
//return nil, staking.ErrWrongFuncParams
}
if len(preNonces) > len(validatorList) {
preNonces = preNonces[len(preNonces)-len(validatorList):]
Expand Down

0 comments on commit 8642dfc

Please sign in to comment.