mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-24 14:22:16 +00:00
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:
parent
100ff08de9
commit
dc359bd3a5
@ -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…
x
Reference in New Issue
Block a user