mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 15:04:22 +00:00
e2e: remove maverick (#9148)
This commit is contained in:
committed by
Sam Ricotta
parent
2ff667ff8e
commit
d015f5e5ff
@@ -4,7 +4,6 @@ import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
|
||||
@@ -42,13 +41,6 @@ var (
|
||||
"kill": 0.1,
|
||||
"restart": 0.1,
|
||||
}
|
||||
nodeMisbehaviors = weightedChoice{
|
||||
// FIXME: evidence disabled due to node panicing when not
|
||||
// having sufficient block history to process evidence.
|
||||
// https://github.com/tendermint/tendermint/issues/5617
|
||||
// misbehaviorOption{"double-prevote"}: 1,
|
||||
misbehaviorOption{}: 9,
|
||||
}
|
||||
)
|
||||
|
||||
// Generate generates random testnets using the given RNG.
|
||||
@@ -226,17 +218,6 @@ func generateNode(
|
||||
node.SnapshotInterval = 3
|
||||
}
|
||||
|
||||
if node.Mode == string(e2e.ModeValidator) {
|
||||
misbehaveAt := startAt + 5 + int64(r.Intn(10))
|
||||
if startAt == 0 {
|
||||
misbehaveAt += initialHeight - 1
|
||||
}
|
||||
node.Misbehaviors = nodeMisbehaviors.Choose(r).(misbehaviorOption).atHeight(misbehaveAt)
|
||||
if len(node.Misbehaviors) != 0 {
|
||||
node.PrivvalProtocol = "file"
|
||||
}
|
||||
}
|
||||
|
||||
// If a node which does not persist state also does not retain blocks, randomly
|
||||
// choose to either persist state or retain all blocks.
|
||||
if node.PersistInterval != nil && *node.PersistInterval == 0 && node.RetainBlocks > 0 {
|
||||
@@ -274,16 +255,3 @@ func generateLightNode(r *rand.Rand, startAt int64, providers []string) *e2e.Man
|
||||
func ptrUint64(i uint64) *uint64 {
|
||||
return &i
|
||||
}
|
||||
|
||||
type misbehaviorOption struct {
|
||||
misbehavior string
|
||||
}
|
||||
|
||||
func (m misbehaviorOption) atHeight(height int64) map[string]string {
|
||||
misbehaviorMap := make(map[string]string)
|
||||
if m.misbehavior == "" {
|
||||
return misbehaviorMap
|
||||
}
|
||||
misbehaviorMap[strconv.Itoa(int(height))] = m.misbehavior
|
||||
return misbehaviorMap
|
||||
}
|
||||
|
||||
@@ -56,28 +56,6 @@ func (uc uniformChoice) Choose(r *rand.Rand) interface{} {
|
||||
return uc[r.Intn(len(uc))]
|
||||
}
|
||||
|
||||
// weightedChoice chooses a single random key from a map of keys and weights.
|
||||
type weightedChoice map[interface{}]uint
|
||||
|
||||
func (wc weightedChoice) Choose(r *rand.Rand) interface{} {
|
||||
total := 0
|
||||
choices := make([]interface{}, 0, len(wc))
|
||||
for choice, weight := range wc {
|
||||
total += int(weight)
|
||||
choices = append(choices, choice)
|
||||
}
|
||||
|
||||
rem := r.Intn(total)
|
||||
for _, choice := range choices {
|
||||
rem -= int(wc[choice])
|
||||
if rem <= 0 {
|
||||
return choice
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// probSetChoice picks a set of strings based on each string's probability (0-1).
|
||||
type probSetChoice map[string]float64
|
||||
|
||||
|
||||
Reference in New Issue
Block a user