Browse Source

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
pull/3409/head
Anca Zamfir 5 years ago
committed by Anton Kaliaev
parent
commit
dc359bd3a5
1 changed files with 0 additions and 28 deletions
  1. +0
    -28
      types/validator_set_test.go

+ 0
- 28
types/validator_set_test.go 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:]
}
}
//---------------------


Loading…
Cancel
Save