Skip to content

Commit

Permalink
Merge c68c30f into e6410fc
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusmihaic committed Feb 6, 2023
2 parents e6410fc + c68c30f commit f240a85
Show file tree
Hide file tree
Showing 22 changed files with 428 additions and 227 deletions.
2 changes: 1 addition & 1 deletion epochStart/metachain/auctionListSelector.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func markAuctionNodesAsSelected(
) error {
for _, node := range selectedNodes {
newNode := node.ShallowClone()
newNode.SetList(string(common.SelectedFromAuctionList))
newNode.SetList(string(common.SelectedFromAuctionList), true)

err := validatorsInfoMap.Replace(node, newNode)
if err != nil {
Expand Down
24 changes: 12 additions & 12 deletions epochStart/metachain/auctionListSelector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func TestAuctionListSelector_SelectNodesFromAuction(t *testing.T) {
owner1StakedKeys := [][]byte{[]byte("pubKey0")}

validatorsInfo := state.NewShardValidatorsInfoMap()
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[0], common.EligibleList, owner1, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[0], common.EligibleList, "", 0, owner1))

args, argsSystemSC := createFullAuctionListSelectorArgs([]config.MaxNodesChangeConfig{{MaxNumNodes: 2}})
stakingcommon.RegisterValidatorKeys(argsSystemSC.UserAccountsDB, owner1, owner1, owner1StakedKeys, big.NewInt(1000), argsSystemSC.Marshalizer)
Expand All @@ -247,7 +247,7 @@ func TestAuctionListSelector_SelectNodesFromAuction(t *testing.T) {
require.Nil(t, err)
expectedValidatorsInfo := map[uint32][]state.ValidatorInfoHandler{
0: {
createValidatorInfo(owner1StakedKeys[0], common.EligibleList, owner1, 0),
createValidatorInfo(owner1StakedKeys[0], common.EligibleList, "", 0, owner1),
},
}
require.Equal(t, expectedValidatorsInfo, validatorsInfo.GetShardValidatorsInfoMap())
Expand All @@ -262,8 +262,8 @@ func TestAuctionListSelector_SelectNodesFromAuction(t *testing.T) {
owner2StakedKeys := [][]byte{[]byte("pubKey1")}

validatorsInfo := state.NewShardValidatorsInfoMap()
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[0], common.EligibleList, owner1, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner2StakedKeys[0], common.AuctionList, owner2, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[0], common.EligibleList, "", 0, owner1))
_ = validatorsInfo.Add(createValidatorInfo(owner2StakedKeys[0], common.AuctionList, "", 0, owner2))

args, argsSystemSC := createFullAuctionListSelectorArgs([]config.MaxNodesChangeConfig{{MaxNumNodes: 1}})
stakingcommon.RegisterValidatorKeys(argsSystemSC.UserAccountsDB, owner1, owner1, owner1StakedKeys, big.NewInt(1000), argsSystemSC.Marshalizer)
Expand All @@ -275,8 +275,8 @@ func TestAuctionListSelector_SelectNodesFromAuction(t *testing.T) {
require.Nil(t, err)
expectedValidatorsInfo := map[uint32][]state.ValidatorInfoHandler{
0: {
createValidatorInfo(owner1StakedKeys[0], common.EligibleList, owner1, 0),
createValidatorInfo(owner2StakedKeys[0], common.AuctionList, owner2, 0),
createValidatorInfo(owner1StakedKeys[0], common.EligibleList, "", 0, owner1),
createValidatorInfo(owner2StakedKeys[0], common.AuctionList, "", 0, owner2),
},
}
require.Equal(t, expectedValidatorsInfo, validatorsInfo.GetShardValidatorsInfoMap())
Expand All @@ -291,8 +291,8 @@ func TestAuctionListSelector_SelectNodesFromAuction(t *testing.T) {
owner2StakedKeys := [][]byte{[]byte("pubKey1")}

validatorsInfo := state.NewShardValidatorsInfoMap()
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[0], common.EligibleList, owner1, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner2StakedKeys[0], common.AuctionList, owner2, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[0], common.EligibleList, "", 0, owner1))
_ = validatorsInfo.Add(createValidatorInfo(owner2StakedKeys[0], common.AuctionList, "", 0, owner2))

args, argsSystemSC := createFullAuctionListSelectorArgs([]config.MaxNodesChangeConfig{{MaxNumNodes: 1, NodesToShufflePerShard: 1}})
stakingcommon.RegisterValidatorKeys(argsSystemSC.UserAccountsDB, owner1, owner1, owner1StakedKeys, big.NewInt(1000), argsSystemSC.Marshalizer)
Expand All @@ -304,8 +304,8 @@ func TestAuctionListSelector_SelectNodesFromAuction(t *testing.T) {
require.Nil(t, err)
expectedValidatorsInfo := map[uint32][]state.ValidatorInfoHandler{
0: {
createValidatorInfo(owner1StakedKeys[0], common.EligibleList, owner1, 0),
createValidatorInfo(owner2StakedKeys[0], common.SelectedFromAuctionList, owner2, 0),
createValidatorInfo(owner1StakedKeys[0], common.EligibleList, "", 0, owner1),
createValidatorInfo(owner2StakedKeys[0], common.SelectedFromAuctionList, common.AuctionList, 0, owner2),
},
}
require.Equal(t, expectedValidatorsInfo, validatorsInfo.GetShardValidatorsInfoMap())
Expand All @@ -317,7 +317,7 @@ func TestAuctionListSelector_SelectNodesFromAuction(t *testing.T) {
owner1 := []byte("owner1")
owner1StakedKeys := [][]byte{[]byte("pubKey0")}
validatorsInfo := state.NewShardValidatorsInfoMap()
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[0], common.AuctionList, owner1, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[0], common.AuctionList, "", 0, owner1))

args, argsSystemSC := createFullAuctionListSelectorArgs([]config.MaxNodesChangeConfig{{MaxNumNodes: 2}})
stakingcommon.RegisterValidatorKeys(argsSystemSC.UserAccountsDB, owner1, owner1, owner1StakedKeys, big.NewInt(1000), argsSystemSC.Marshalizer)
Expand All @@ -328,7 +328,7 @@ func TestAuctionListSelector_SelectNodesFromAuction(t *testing.T) {
require.Nil(t, err)
expectedValidatorsInfo := map[uint32][]state.ValidatorInfoHandler{
0: {
createValidatorInfo(owner1StakedKeys[0], common.SelectedFromAuctionList, owner1, 0),
createValidatorInfo(owner1StakedKeys[0], common.SelectedFromAuctionList, common.AuctionList, 0, owner1),
},
}
require.Equal(t, expectedValidatorsInfo, validatorsInfo.GetShardValidatorsInfoMap())
Expand Down
10 changes: 5 additions & 5 deletions epochStart/metachain/legacySystemSCs.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func (s *legacySystemSCProcessor) unStakeNodesWithNotEnoughFunds(
}

validatorLeaving := validatorInfo.ShallowClone()
validatorLeaving.SetList(string(common.LeavingList))
validatorLeaving.SetList(string(common.LeavingList), s.enableEpochsHandler.IsStakingV4Started())
err = validatorsInfoMap.Replace(validatorInfo, validatorLeaving)
if err != nil {
return 0, err
Expand Down Expand Up @@ -344,7 +344,7 @@ func (s *legacySystemSCProcessor) unStakeOneNode(blsKey []byte, epoch uint32) er
return epochStart.ErrWrongTypeAssertion
}

peerAccount.SetListAndIndex(peerAccount.GetShardId(), string(common.LeavingList), peerAccount.GetIndexInList())
peerAccount.SetListAndIndex(peerAccount.GetShardId(), string(common.LeavingList), peerAccount.GetIndexInList(), s.enableEpochsHandler.IsStakingV4Started())
peerAccount.SetUnStakedEpoch(epoch)
err = s.peerAccountsDB.SaveAccount(peerAccount)
if err != nil {
Expand Down Expand Up @@ -733,7 +733,7 @@ func (s *legacySystemSCProcessor) stakingToValidatorStatistics(
}
}

account.SetListAndIndex(jailedValidator.GetShardId(), string(common.NewList), uint32(stakingData.StakedNonce))
account.SetListAndIndex(jailedValidator.GetShardId(), string(common.NewList), uint32(stakingData.StakedNonce), s.enableEpochsHandler.IsStakingV4Started())
account.SetTempRating(s.startRating)
account.SetUnStakedEpoch(common.DefaultUnstakedEpoch)

Expand All @@ -747,7 +747,7 @@ func (s *legacySystemSCProcessor) stakingToValidatorStatistics(
return nil, err
}

jailedAccount.SetListAndIndex(jailedValidator.GetShardId(), string(common.JailedList), jailedValidator.GetIndex())
jailedAccount.SetListAndIndex(jailedValidator.GetShardId(), string(common.JailedList), jailedValidator.GetIndex(), s.enableEpochsHandler.IsStakingV4Started())
jailedAccount.ResetAtNewEpoch()
err = s.peerAccountsDB.SaveAccount(jailedAccount)
if err != nil {
Expand Down Expand Up @@ -1223,7 +1223,7 @@ func (s *legacySystemSCProcessor) addNewlyStakedNodesToValidatorTrie(
return err
}

peerAcc.SetListAndIndex(peerAcc.GetShardId(), string(list), uint32(nonce))
peerAcc.SetListAndIndex(peerAcc.GetShardId(), string(list), uint32(nonce), s.enableEpochsHandler.IsStakingV4Started())
peerAcc.SetTempRating(s.startRating)
peerAcc.SetUnStakedEpoch(common.DefaultUnstakedEpoch)

Expand Down
2 changes: 1 addition & 1 deletion epochStart/metachain/rewardsV2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,7 @@ func TestNewRewardsCreatorV2_computeValidatorInfoPerRewardAddressWithLeavingVali
valInfo := createDefaultValidatorInfo(nbEligiblePerShard, args.ShardCoordinator, args.NodesConfigProvider, proposerFee, defaultBlocksPerShard)
for _, valList := range valInfo.GetShardValidatorsInfoMap() {
for i := 0; i < int(nbLeavingPerShard); i++ {
valList[i].SetList(string(common.LeavingList))
valList[i].SetList(string(common.LeavingList), false)
}
}

Expand Down
2 changes: 1 addition & 1 deletion epochStart/metachain/systemSCs.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (s *systemSCProcessor) unStakeNodesWithNotEnoughFundsWithStakingV4(
}

validatorLeaving := validatorInfo.ShallowClone()
validatorLeaving.SetList(string(common.LeavingList))
validatorLeaving.SetList(string(common.LeavingList), true)
err = validatorsInfoMap.Replace(validatorInfo, validatorLeaving)
if err != nil {
return err
Expand Down
103 changes: 52 additions & 51 deletions epochStart/metachain/systemSCs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1768,29 +1768,29 @@ func TestSystemSCProcessor_ProcessSystemSmartContractStakingV4Init(t *testing.T)
stakingcommon.RegisterValidatorKeys(args.UserAccountsDB, owner3, owner3, owner3ListPubKeysWaiting, big.NewInt(2000), args.Marshalizer)

validatorsInfo := state.NewShardValidatorsInfoMap()
_ = validatorsInfo.Add(createValidatorInfo(owner1ListPubKeysStaked[0], common.EligibleList, owner1, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner1ListPubKeysStaked[1], common.WaitingList, owner1, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner2ListPubKeysStaked[0], common.EligibleList, owner2, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner1ListPubKeysStaked[0], common.EligibleList, "", 0, owner1))
_ = validatorsInfo.Add(createValidatorInfo(owner1ListPubKeysStaked[1], common.WaitingList, "", 0, owner1))
_ = validatorsInfo.Add(createValidatorInfo(owner2ListPubKeysStaked[0], common.EligibleList, "", 1, owner2))

args.EpochNotifier.CheckEpoch(&block.Header{Epoch: stakingV4InitEnableEpoch})
err := s.ProcessSystemSmartContract(validatorsInfo, &block.Header{})
require.Nil(t, err)

expectedValidatorsInfo := map[uint32][]state.ValidatorInfoHandler{
0: {
createValidatorInfo(owner1ListPubKeysStaked[0], common.EligibleList, owner1, 0),
createValidatorInfo(owner1ListPubKeysStaked[1], common.WaitingList, owner1, 0),
createValidatorInfo(owner1ListPubKeysWaiting[0], common.AuctionList, owner1, 0),
createValidatorInfo(owner1ListPubKeysWaiting[1], common.AuctionList, owner1, 0),
createValidatorInfo(owner1ListPubKeysWaiting[2], common.AuctionList, owner1, 0),
createValidatorInfo(owner1ListPubKeysStaked[0], common.EligibleList, "", 0, owner1),
createValidatorInfo(owner1ListPubKeysStaked[1], common.WaitingList, "", 0, owner1),
createValidatorInfo(owner1ListPubKeysWaiting[0], common.AuctionList, "", 0, owner1),
createValidatorInfo(owner1ListPubKeysWaiting[1], common.AuctionList, "", 0, owner1),
createValidatorInfo(owner1ListPubKeysWaiting[2], common.AuctionList, "", 0, owner1),

createValidatorInfo(owner2ListPubKeysWaiting[0], common.AuctionList, owner2, 0),
createValidatorInfo(owner2ListPubKeysWaiting[0], common.AuctionList, "", 0, owner2),

createValidatorInfo(owner3ListPubKeysWaiting[0], common.AuctionList, owner3, 0),
createValidatorInfo(owner3ListPubKeysWaiting[1], common.AuctionList, owner3, 0),
createValidatorInfo(owner3ListPubKeysWaiting[0], common.AuctionList, "", 0, owner3),
createValidatorInfo(owner3ListPubKeysWaiting[1], common.AuctionList, "", 0, owner3),
},
1: {
createValidatorInfo(owner2ListPubKeysStaked[0], common.EligibleList, owner2, 1),
createValidatorInfo(owner2ListPubKeysStaked[0], common.EligibleList, "", 1, owner2),
},
}

Expand All @@ -1814,8 +1814,8 @@ func TestSystemSCProcessor_ProcessSystemSmartContractStakingV4EnabledCannotPrepa
stakingcommon.RegisterValidatorKeys(args.UserAccountsDB, owner, owner, ownerStakedKeys, big.NewInt(2000), args.Marshalizer)

validatorsInfo := state.NewShardValidatorsInfoMap()
_ = validatorsInfo.Add(createValidatorInfo(ownerStakedKeys[0], common.AuctionList, owner, 0))
_ = validatorsInfo.Add(createValidatorInfo(ownerStakedKeys[1], common.AuctionList, owner, 0))
_ = validatorsInfo.Add(createValidatorInfo(ownerStakedKeys[0], common.AuctionList, "", 0, owner))
_ = validatorsInfo.Add(createValidatorInfo(ownerStakedKeys[1], common.AuctionList, "", 0, owner))

s, _ := NewSystemSCProcessor(args)
s.EpochConfirmed(stakingV4EnableEpoch, 0)
Expand Down Expand Up @@ -1867,30 +1867,30 @@ func TestSystemSCProcessor_ProcessSystemSmartContractStakingV4Enabled(t *testing
stakingcommon.RegisterValidatorKeys(args.UserAccountsDB, owner7, owner7, owner7StakedKeys, big.NewInt(1500), args.Marshalizer)

validatorsInfo := state.NewShardValidatorsInfoMap()
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[0], common.EligibleList, owner1, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[1], common.WaitingList, owner1, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[2], common.AuctionList, owner1, 0))
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[0], common.EligibleList, "", 0, owner1))
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[1], common.WaitingList, "", 0, owner1))
_ = validatorsInfo.Add(createValidatorInfo(owner1StakedKeys[2], common.AuctionList, "", 0, owner1))

_ = validatorsInfo.Add(createValidatorInfo(owner2StakedKeys[0], common.EligibleList, owner2, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner2StakedKeys[1], common.AuctionList, owner2, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner2StakedKeys[2], common.AuctionList, owner2, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner2StakedKeys[0], common.EligibleList, "", 1, owner2))
_ = validatorsInfo.Add(createValidatorInfo(owner2StakedKeys[1], common.AuctionList, "", 1, owner2))
_ = validatorsInfo.Add(createValidatorInfo(owner2StakedKeys[2], common.AuctionList, "", 1, owner2))

_ = validatorsInfo.Add(createValidatorInfo(owner3StakedKeys[0], common.LeavingList, owner3, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner3StakedKeys[1], common.AuctionList, owner3, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner3StakedKeys[0], common.LeavingList, "", 1, owner3))
_ = validatorsInfo.Add(createValidatorInfo(owner3StakedKeys[1], common.AuctionList, "", 1, owner3))

_ = validatorsInfo.Add(createValidatorInfo(owner4StakedKeys[0], common.JailedList, owner4, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner4StakedKeys[1], common.AuctionList, owner4, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner4StakedKeys[2], common.AuctionList, owner4, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner4StakedKeys[3], common.AuctionList, owner4, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner4StakedKeys[0], common.JailedList, "", 1, owner4))
_ = validatorsInfo.Add(createValidatorInfo(owner4StakedKeys[1], common.AuctionList, "", 1, owner4))
_ = validatorsInfo.Add(createValidatorInfo(owner4StakedKeys[2], common.AuctionList, "", 1, owner4))
_ = validatorsInfo.Add(createValidatorInfo(owner4StakedKeys[3], common.AuctionList, "", 1, owner4))

_ = validatorsInfo.Add(createValidatorInfo(owner5StakedKeys[0], common.EligibleList, owner5, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner5StakedKeys[1], common.AuctionList, owner5, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner5StakedKeys[0], common.EligibleList, "", 1, owner5))
_ = validatorsInfo.Add(createValidatorInfo(owner5StakedKeys[1], common.AuctionList, "", 1, owner5))

_ = validatorsInfo.Add(createValidatorInfo(owner6StakedKeys[0], common.AuctionList, owner6, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner6StakedKeys[1], common.AuctionList, owner6, 1))
_ = validatorsInfo.Add(createValidatorInfo(owner6StakedKeys[0], common.AuctionList, "", 1, owner6))
_ = validatorsInfo.Add(createValidatorInfo(owner6StakedKeys[1], common.AuctionList, "", 1, owner6))

_ = validatorsInfo.Add(createValidatorInfo(owner7StakedKeys[0], common.EligibleList, owner7, 2))
_ = validatorsInfo.Add(createValidatorInfo(owner7StakedKeys[1], common.EligibleList, owner7, 2))
_ = validatorsInfo.Add(createValidatorInfo(owner7StakedKeys[0], common.EligibleList, "", 2, owner7))
_ = validatorsInfo.Add(createValidatorInfo(owner7StakedKeys[1], common.EligibleList, "", 2, owner7))

s, _ := NewSystemSCProcessor(args)
args.EpochNotifier.CheckEpoch(&block.Header{Epoch: stakingV4EnableEpoch})
Expand Down Expand Up @@ -1955,32 +1955,32 @@ func TestSystemSCProcessor_ProcessSystemSmartContractStakingV4Enabled(t *testing

expectedValidatorsInfo := map[uint32][]state.ValidatorInfoHandler{
0: {
createValidatorInfo(owner1StakedKeys[0], common.EligibleList, owner1, 0),
createValidatorInfo(owner1StakedKeys[1], common.WaitingList, owner1, 0),
createValidatorInfo(owner1StakedKeys[2], common.SelectedFromAuctionList, owner1, 0),
createValidatorInfo(owner1StakedKeys[0], common.EligibleList, "", 0, owner1),
createValidatorInfo(owner1StakedKeys[1], common.WaitingList, "", 0, owner1),
createValidatorInfo(owner1StakedKeys[2], common.SelectedFromAuctionList, common.AuctionList, 0, owner1),
},
1: {
createValidatorInfo(owner2StakedKeys[0], common.EligibleList, owner2, 1),
createValidatorInfo(owner2StakedKeys[1], common.AuctionList, owner2, 1),
createValidatorInfo(owner2StakedKeys[2], common.SelectedFromAuctionList, owner2, 1),
createValidatorInfo(owner2StakedKeys[0], common.EligibleList, "", 1, owner2),
createValidatorInfo(owner2StakedKeys[1], common.AuctionList, "", 1, owner2),
createValidatorInfo(owner2StakedKeys[2], common.SelectedFromAuctionList, common.AuctionList, 1, owner2),

createValidatorInfo(owner3StakedKeys[0], common.LeavingList, owner3, 1),
createValidatorInfo(owner3StakedKeys[1], common.AuctionList, owner3, 1),
createValidatorInfo(owner3StakedKeys[0], common.LeavingList, "", 1, owner3),
createValidatorInfo(owner3StakedKeys[1], common.AuctionList, "", 1, owner3),

createValidatorInfo(owner4StakedKeys[0], common.JailedList, owner4, 1),
createValidatorInfo(owner4StakedKeys[1], common.SelectedFromAuctionList, owner4, 1),
createValidatorInfo(owner4StakedKeys[2], common.AuctionList, owner4, 1),
createValidatorInfo(owner4StakedKeys[3], common.AuctionList, owner4, 1),
createValidatorInfo(owner4StakedKeys[0], common.JailedList, "", 1, owner4),
createValidatorInfo(owner4StakedKeys[1], common.SelectedFromAuctionList, common.AuctionList, 1, owner4),
createValidatorInfo(owner4StakedKeys[2], common.AuctionList, "", 1, owner4),
createValidatorInfo(owner4StakedKeys[3], common.AuctionList, "", 1, owner4),

createValidatorInfo(owner5StakedKeys[0], common.EligibleList, owner5, 1),
createValidatorInfo(owner5StakedKeys[1], common.LeavingList, owner5, 1),
createValidatorInfo(owner5StakedKeys[0], common.EligibleList, "", 1, owner5),
createValidatorInfo(owner5StakedKeys[1], common.LeavingList, common.AuctionList, 1, owner5),

createValidatorInfo(owner6StakedKeys[0], common.LeavingList, owner6, 1),
createValidatorInfo(owner6StakedKeys[1], common.AuctionList, owner6, 1),
createValidatorInfo(owner6StakedKeys[0], common.LeavingList, common.AuctionList, 1, owner6),
createValidatorInfo(owner6StakedKeys[1], common.AuctionList, "", 1, owner6),
},
2: {
createValidatorInfo(owner7StakedKeys[0], common.LeavingList, owner7, 2),
createValidatorInfo(owner7StakedKeys[1], common.EligibleList, owner7, 2),
createValidatorInfo(owner7StakedKeys[0], common.LeavingList, common.EligibleList, 2, owner7),
createValidatorInfo(owner7StakedKeys[1], common.EligibleList, "", 2, owner7),
},
}

Expand Down Expand Up @@ -2114,12 +2114,13 @@ func requireTopUpPerNodes(t *testing.T, s epochStart.StakingDataProvider, staked
}

// This func sets rating and temp rating with the start rating value used in createFullArgumentsForSystemSCProcessing
func createValidatorInfo(pubKey []byte, list common.PeerType, owner []byte, shardID uint32) *state.ValidatorInfo {
func createValidatorInfo(pubKey []byte, list common.PeerType, previousList common.PeerType, shardID uint32, owner []byte) *state.ValidatorInfo {
rating := uint32(5)

return &state.ValidatorInfo{
PublicKey: pubKey,
List: string(list),
PreviousList: string(previousList),
ShardId: shardID,
RewardAddress: owner,
AccumulatedFees: zero,
Expand Down

0 comments on commit f240a85

Please sign in to comment.