Merge branch 'master' into wb/fuzz-testdata-cases

This commit is contained in:
William Banfield
2021-07-26 12:31:17 -04:00
committed by GitHub
46 changed files with 1196 additions and 489 deletions
+2
View File
@@ -31,6 +31,7 @@ var (
nodePrivvalProtocols = uniformChoice{"file", "unix", "tcp", "grpc"}
// FIXME: v2 disabled due to flake
nodeFastSyncs = uniformChoice{"v0"} // "v2"
nodeMempools = uniformChoice{"v0", "v1"}
nodeStateSyncs = uniformChoice{false, true}
nodePersistIntervals = uniformChoice{0, 1, 5}
nodeSnapshotIntervals = uniformChoice{0, 3}
@@ -273,6 +274,7 @@ func generateNode(
ABCIProtocol: nodeABCIProtocols.Choose(r).(string),
PrivvalProtocol: nodePrivvalProtocols.Choose(r).(string),
FastSync: nodeFastSyncs.Choose(r).(string),
Mempool: nodeMempools.Choose(r).(string),
StateSync: nodeStateSyncs.Choose(r).(bool) && startAt > 0,
PersistInterval: ptrUint64(uint64(nodePersistIntervals.Choose(r).(int))),
SnapshotInterval: uint64(nodeSnapshotIntervals.Choose(r).(int)),
+3
View File
@@ -110,6 +110,9 @@ type ManifestNode struct {
// Defaults to disabled.
FastSync string `toml:"fast_sync"`
// Mempool specifies which version of mempool to use. Either "v0" or "v1"
Mempool string `toml:"mempool_version"`
// StateSync enables state sync. The runner automatically configures trusted
// block hashes and RPC servers. At least one node in the network must have
// SnapshotInterval set to non-zero, and the state syncing node must have
+7
View File
@@ -80,6 +80,7 @@ type Node struct {
ProxyPort uint32
StartAt int64
FastSync string
Mempool string
StateSync bool
Database string
ABCIProtocol Protocol
@@ -168,6 +169,7 @@ func LoadTestnet(file string) (*Testnet, error) {
PrivvalProtocol: ProtocolFile,
StartAt: nodeManifest.StartAt,
FastSync: nodeManifest.FastSync,
Mempool: nodeManifest.Mempool,
StateSync: nodeManifest.StateSync,
PersistInterval: 1,
SnapshotInterval: nodeManifest.SnapshotInterval,
@@ -331,6 +333,11 @@ func (n Node) Validate(testnet Testnet) error {
default:
return fmt.Errorf("invalid fast sync setting %q", n.FastSync)
}
switch n.Mempool {
case "", "v0", "v1":
default:
return fmt.Errorf("invalid mempool version %q", n.Mempool)
}
switch n.QueueType {
case "", "priority", "wdrr", "fifo":
default:
+13 -1
View File
@@ -91,6 +91,13 @@ func InjectEvidence(testnet *e2e.Testnet, amount int) error {
}
}
// wait for the node to reach the height above the forged height so that
// it is able to validate the evidence
_, err = waitForNode(targetNode, blockRes.Block.Height+2, 10*time.Second)
if err != nil {
return err
}
logger.Info(fmt.Sprintf("Finished sending evidence (height %d)", blockRes.Block.Height+2))
return nil
@@ -186,7 +193,12 @@ func generateDuplicateVoteEvidence(
if err != nil {
return nil, err
}
return types.NewDuplicateVoteEvidence(voteA, voteB, time, vals), nil
ev := types.NewDuplicateVoteEvidence(voteA, voteB, time, vals)
if ev == nil {
return nil, fmt.Errorf("could not generate evidence a=%v b=%v vals=%v", voteA, voteB, vals)
}
return ev, nil
}
func readPrivKey(keyFilePath string) (crypto.PrivKey, error) {
+1 -1
View File
@@ -85,7 +85,7 @@ func NewCLI() *CLI {
if err := InjectEvidence(cli.testnet, cli.testnet.Evidence); err != nil {
return err
}
if err := Wait(cli.testnet, 1); err != nil { // ensure chain progress
if err := Wait(cli.testnet, 5); err != nil { // ensure chain progress
return err
}
}
+3 -3
View File
@@ -16,7 +16,7 @@ func Perturb(testnet *e2e.Testnet) error {
if err != nil {
return err
}
time.Sleep(15 * time.Second) // give network some time to recover between each
time.Sleep(20 * time.Second) // give network some time to recover between each
}
}
return nil
@@ -42,7 +42,7 @@ func PerturbNode(node *e2e.Node, perturbation e2e.Perturbation) (*rpctypes.Resul
if err := execCompose(testnet.Dir, "kill", "-s", "SIGKILL", node.Name); err != nil {
return nil, err
}
time.Sleep(2 * time.Second)
time.Sleep(10 * time.Second)
if err := execCompose(testnet.Dir, "start", node.Name); err != nil {
return nil, err
}
@@ -73,7 +73,7 @@ func PerturbNode(node *e2e.Node, perturbation e2e.Perturbation) (*rpctypes.Resul
return nil, nil
}
status, err := waitForNode(node, 0, 2*time.Minute)
status, err := waitForNode(node, 0, 3*time.Minute)
if err != nil {
return nil, err
}
+4
View File
@@ -292,6 +292,10 @@ func MakeConfig(node *e2e.Node) (*config.Config, error) {
return nil, fmt.Errorf("unexpected mode %q", node.Mode)
}
if node.Mempool != "" {
cfg.Mempool.Version = node.Mempool
}
if node.FastSync == "" {
cfg.FastSyncMode = false
} else {
+1 -1
View File
@@ -75,7 +75,7 @@ func Start(testnet *e2e.Testnet) error {
if err := execCompose(testnet.Dir, "up", "-d", node.Name); err != nil {
return err
}
status, err := waitForNode(node, node.StartAt, 5*time.Minute)
status, err := waitForNode(node, node.StartAt, 8*time.Minute)
if err != nil {
return err
}
+1 -1
View File
@@ -30,5 +30,5 @@ func WaitUntil(testnet *e2e.Testnet, height int64) error {
// waitingTime estimates how long it should take for a node to reach the height.
// More nodes in a network implies we may expect a slower network and may have to wait longer.
func waitingTime(nodes int) time.Duration {
return time.Minute + (time.Duration(nodes) * (15 * time.Second))
return time.Minute + (time.Duration(nodes) * (30 * time.Second))
}
@@ -0,0 +1 @@
[0]