p2p: minor cleanup + update router options (#6353)

This commit is contained in:
Aleksandr Bezobchuk
2021-04-14 09:35:43 -04:00
committed by GitHub
parent ca7dbea05b
commit 47b28fd6aa
10 changed files with 140 additions and 83 deletions
+11 -8
View File
@@ -78,9 +78,9 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
switch p2pInfo := opt["useNewP2P"].(type) {
case bool:
manifest.UseNewP2P = p2pInfo
manifest.DisableLegacyP2P = p2pInfo
case int:
manifest.UseNewP2P = false
manifest.DisableLegacyP2P = false
p2pNodeFactor = p2pInfo
}
@@ -104,11 +104,13 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
for i := 1; i <= numSeeds; i++ {
node := generateNode(r, e2e.ModeSeed, 0, manifest.InitialHeight, false)
node.QueueType = manifest.QueueType
if p2pNodeFactor == 0 {
node.UseNewP2P = manifest.UseNewP2P
node.DisableLegacyP2P = manifest.DisableLegacyP2P
} else if p2pNodeFactor%i == 0 {
node.UseNewP2P = !manifest.UseNewP2P
node.DisableLegacyP2P = !manifest.DisableLegacyP2P
}
manifest.Nodes[fmt.Sprintf("seed%02d", i)] = node
}
@@ -129,10 +131,11 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
node.QueueType = manifest.QueueType
if p2pNodeFactor == 0 {
node.UseNewP2P = manifest.UseNewP2P
node.DisableLegacyP2P = manifest.DisableLegacyP2P
} else if p2pNodeFactor%i == 0 {
node.UseNewP2P = !manifest.UseNewP2P
node.DisableLegacyP2P = !manifest.DisableLegacyP2P
}
manifest.Nodes[name] = node
if startAt == 0 {
@@ -164,9 +167,9 @@ func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, er
node := generateNode(r, e2e.ModeFull, startAt, manifest.InitialHeight, false)
node.QueueType = manifest.QueueType
if p2pNodeFactor == 0 {
node.UseNewP2P = manifest.UseNewP2P
node.DisableLegacyP2P = manifest.DisableLegacyP2P
} else if p2pNodeFactor%i == 0 {
node.UseNewP2P = !manifest.UseNewP2P
node.DisableLegacyP2P = !manifest.DisableLegacyP2P
}
manifest.Nodes[fmt.Sprintf("full%02d", i)] = node
}
+25 -25
View File
@@ -1,10 +1,10 @@
# This testnet is run by CI, and attempts to cover a broad range of
# functionality with a single network.
initial_height = 1000
disable_legacy_p2p = false
evidence = 0
initial_state = { initial01 = "a", initial02 = "b", initial03 = "c" }
use_new_p2p = false
initial_height = 1000
initial_state = {initial01 = "a", initial02 = "b", initial03 = "c"}
queue_type = "priority"
[validators]
@@ -29,71 +29,71 @@ validator05 = 50
[node.seed01]
mode = "seed"
seeds = ["seed02"]
perturb = ["restart"]
seeds = ["seed02"]
[node.seed02]
mode = "seed"
seeds = ["seed01"]
[node.validator01]
perturb = ["disconnect"]
seeds = ["seed01"]
snapshot_interval = 5
perturb = ["disconnect"]
[node.validator02]
seeds = ["seed02"]
database = "boltdb"
abci_protocol = "tcp"
privval_protocol = "tcp"
database = "boltdb"
persist_interval = 0
perturb = ["restart"]
privval_protocol = "tcp"
seeds = ["seed02"]
[node.validator03]
seeds = ["seed01"]
database = "badgerdb"
seeds = ["seed01"]
# FIXME: should be grpc, disabled due to https://github.com/tendermint/tendermint/issues/5439
#abci_protocol = "grpc"
privval_protocol = "grpc"
persist_interval = 3
retain_blocks = 3
perturb = ["kill"]
privval_protocol = "grpc"
retain_blocks = 3
[node.validator04]
persistent_peers = ["validator01"]
database = "rocksdb"
abci_protocol = "builtin"
database = "rocksdb"
persistent_peers = ["validator01"]
perturb = ["pause"]
[node.validator05]
database = "cleveldb"
fast_sync = "v0"
seeds = ["seed02"]
start_at = 1005 # Becomes part of the validator set at 1010
seeds = ["seed02"]
database = "cleveldb"
fast_sync = "v0"
# FIXME: should be grpc, disabled due to https://github.com/tendermint/tendermint/issues/5439
#abci_protocol = "grpc"
privval_protocol = "tcp"
perturb = ["kill", "pause", "disconnect", "restart"]
privval_protocol = "tcp"
[node.full01]
start_at = 1010
mode = "full"
start_at = 1010
# FIXME: should be v2, disabled due to flake
fast_sync = "v0"
persistent_peers = ["validator01", "validator02", "validator03", "validator04", "validator05"]
retain_blocks = 3
perturb = ["restart"]
retain_blocks = 3
[node.full02]
start_at = 1015
mode = "full"
start_at = 1015
# FIXME: should be v2, disabled due to flake
fast_sync = "v0"
state_sync = true
seeds = ["seed01"]
perturb = ["restart"]
seeds = ["seed01"]
state_sync = true
[node.light01]
mode= "light"
start_at= 1010
persistent_peers = ["validator01", "validator02", "validator03"]
mode = "light"
persistent_peers = ["validator01", "validator02", "validator03"]
start_at = 1010
+3 -4
View File
@@ -59,9 +59,8 @@ type Manifest struct {
// by individual nodes.
LogLevel string `toml:"log_level"`
// UseNewP2P enables use of the new p2p layer for all nodes in
// a test.
UseNewP2P bool `toml:"use_new_p2p"`
// DisableLegacyP2P enables use of the new p2p layer for all nodes in a test.
DisableLegacyP2P bool `toml:"disable_legacy_p2p"`
// QueueType describes the type of queue that the system uses internally
QueueType string `toml:"queue_type"`
@@ -143,7 +142,7 @@ type ManifestNode struct {
LogLevel string `toml:"log_level"`
// UseNewP2P enables use of the new p2p layer for this node.
UseNewP2P bool `toml:"use_new_p2p"`
DisableLegacyP2P bool `toml:"disable_legacy_p2p"`
// QueueType describes the type of queue that the p2p layer
// uses internally.
+3 -2
View File
@@ -90,7 +90,7 @@ type Node struct {
PersistentPeers []*Node
Perturbations []Perturbation
LogLevel string
UseNewP2P bool
DisableLegacyP2P bool
QueueType string
}
@@ -169,9 +169,10 @@ func LoadTestnet(file string) (*Testnet, error) {
RetainBlocks: nodeManifest.RetainBlocks,
Perturbations: []Perturbation{},
LogLevel: manifest.LogLevel,
UseNewP2P: manifest.UseNewP2P,
DisableLegacyP2P: manifest.DisableLegacyP2P,
QueueType: manifest.QueueType,
}
if node.StartAt == testnet.InitialHeight {
node.StartAt = 0 // normalize to 0 for initial nodes, since code expects this
}
+1 -1
View File
@@ -239,7 +239,7 @@ func MakeConfig(node *e2e.Node) (*config.Config, error) {
cfg.RPC.PprofListenAddress = ":6060"
cfg.P2P.ExternalAddress = fmt.Sprintf("tcp://%v", node.AddressP2P(false))
cfg.P2P.AddrBookStrict = false
cfg.P2P.UseNewP2P = node.UseNewP2P
cfg.P2P.DisableLegacy = node.DisableLegacyP2P
cfg.P2P.QueueType = node.QueueType
cfg.DBBackend = node.Database
cfg.StateSync.DiscoveryTime = 5 * time.Second