From b239eac303bf2ac9e86eea1154ffe91d73d8afe5 Mon Sep 17 00:00:00 2001 From: clearly <910372762@qq.com> Date: Tue, 26 Nov 2024 09:55:37 +0800 Subject: [PATCH 1/2] update for main net --- params/config.go | 2 ++ x/plugin/gov_plugin.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/params/config.go b/params/config.go index e614096b09..06e9498105 100644 --- a/params/config.go +++ b/params/config.go @@ -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 diff --git a/x/plugin/gov_plugin.go b/x/plugin/gov_plugin.go index b3539ebd4f..9f11bb54bf 100644 --- a/x/plugin/gov_plugin.go +++ b/x/plugin/gov_plugin.go @@ -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 } From 92b202614bf2c8f382966a67c86168f1aa89896c Mon Sep 17 00:00:00 2001 From: clearly <910372762@qq.com> Date: Fri, 20 Dec 2024 10:49:12 +0800 Subject: [PATCH 2/2] fix preNonces and validatorList cmp --- x/plugin/staking_plugin.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/x/plugin/staking_plugin.go b/x/plugin/staking_plugin.go index 655b5b695f..e4ec8aacbf 100644 --- a/x/plugin/staking_plugin.go +++ b/x/plugin/staking_plugin.go @@ -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):]