types: remove check for priority order of existing validators (#3407)

When scaling and averaging is invoked, it is possible to have validators
with close priorities ending up with same priority. With the current code,
this  makes it impossible to verify the priority orders before and after updates.

Fixes #3383
This commit is contained in:
Anca Zamfir 2019-03-11 16:17:25 +02:00 committed by Anton Kaliaev
parent 100ff08de9
commit dc359bd3a5

View File

@ -1113,15 +1113,6 @@ func applyChangesToValSet(t *testing.T, valSet *ValidatorSet, valsLists ...[]tes
assert.NoError(t, err)
}
func isAddressInList(address []byte, valsList []testVal) bool {
for _, val := range valsList {
if bytes.Equal([]byte(val.name), address) {
return true
}
}
return false
}
func TestValSetUpdatePriorityOrderTests(t *testing.T) {
const nMaxElections = 5000
@ -1206,25 +1197,6 @@ func verifyValSetUpdatePriorityOrder(t *testing.T, valSet *ValidatorSet, cfg tes
assert.Equal(t, expectedPri, val.ProposerPriority)
}
}
// check that the priority order for validators that remained is the same
// as in the original set
remainingValsPriSlice := updatedValsPriSorted[len(cfg.addedVals):]
for len(remainingValsPriSlice) > 0 {
addressInChanged := remainingValsPriSlice[0].Address
addressInOld := origValsPriSorted[0].Address
// skip validators in original list that have been removed
if isAddressInList(addressInOld, cfg.deletedVals) {
origValsPriSorted = origValsPriSorted[1:]
continue
}
assert.Equal(t, addressInOld, addressInChanged, "wrong priority order")
remainingValsPriSlice = remainingValsPriSlice[1:]
origValsPriSorted = origValsPriSorted[1:]
}
}
//---------------------