Skip to content

Commit

Permalink
e2e: abci protocol should be consistent across networks (#7078)
Browse files Browse the repository at this point in the history
It seems weird in retrospect that we allow networks to contain
applications that use different ABCI protocols.

(cherry picked from commit f2a8f5e)

# Conflicts:
#	test/e2e/generator/generate.go
#	test/e2e/pkg/manifest.go
#	test/e2e/pkg/testnet.go
  • Loading branch information
tychoish authored and mergify-bot committed Oct 8, 2021
1 parent 16ba782 commit 5718acd
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 10 deletions.
12 changes: 12 additions & 0 deletions test/e2e/generator/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func Generate(r *rand.Rand) ([]e2e.Manifest, error) {
func generateTestnet(r *rand.Rand, opt map[string]interface{}) (e2e.Manifest, error) {
manifest := e2e.Manifest{
IPv6: ipv6.Choose(r).(bool),
ABCIProtocol: nodeABCIProtocols.Choose(r),
InitialHeight: int64(opt["initialHeight"].(int)),
InitialState: opt["initialState"].(map[string]string),
Validators: &map[string]int64{},
Expand Down Expand Up @@ -206,11 +207,18 @@ func generateNode(
node := e2e.ManifestNode{
Mode: string(mode),
StartAt: startAt,
<<<<<<< HEAD
Database: nodeDatabases.Choose(r).(string),
ABCIProtocol: nodeABCIProtocols.Choose(r).(string),
PrivvalProtocol: nodePrivvalProtocols.Choose(r).(string),
FastSync: nodeFastSyncs.Choose(r).(string),
StateSync: nodeStateSyncs.Choose(r).(bool) && startAt > 0,
=======
Database: nodeDatabases.Choose(r),
PrivvalProtocol: nodePrivvalProtocols.Choose(r),
Mempool: nodeMempools.Choose(r),
StateSync: e2e.StateSyncDisabled,
>>>>>>> f2a8f5e05 (e2e: abci protocol should be consistent across networks (#7078))
PersistInterval: ptrUint64(uint64(nodePersistIntervals.Choose(r).(int))),
SnapshotInterval: uint64(nodeSnapshotIntervals.Choose(r).(int)),
RetainBlocks: uint64(nodeRetainBlocks.Choose(r).(int)),
Expand Down Expand Up @@ -263,8 +271,12 @@ func generateLightNode(r *rand.Rand, startAt int64, providers []string) *e2e.Man
return &e2e.ManifestNode{
Mode: string(e2e.ModeLight),
StartAt: startAt,
<<<<<<< HEAD
Database: nodeDatabases.Choose(r).(string),
ABCIProtocol: "builtin",
=======
Database: nodeDatabases.Choose(r),
>>>>>>> f2a8f5e05 (e2e: abci protocol should be consistent across networks (#7078))
PersistInterval: ptrUint64(0),
PersistentPeers: providers,
}
Expand Down
29 changes: 23 additions & 6 deletions test/e2e/pkg/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,29 @@ type Manifest struct {
// KeyType sets the curve that will be used by validators.
// Options are ed25519 & secp256k1
KeyType string `toml:"key_type"`
<<<<<<< HEAD
=======

// Evidence indicates the amount of evidence that will be injected into the
// testnet via the RPC endpoint of a random node. Default is 0
Evidence int `toml:"evidence"`

// LogLevel sets the log level of the entire testnet. This can be overridden
// by individual nodes.
LogLevel string `toml:"log_level"`

// QueueType describes the type of queue that the system uses internally
QueueType string `toml:"queue_type"`

// Number of bytes per tx. Default is 1kb (1024)
TxSize int64

// ABCIProtocol specifies the protocol used to communicate with the ABCI
// application: "unix", "tcp", "grpc", or "builtin". Defaults to builtin.
// builtin will build a complete Tendermint node into the application and
// launch it instead of launching a separate Tendermint process.
ABCIProtocol string `toml:"abci_protocol"`
>>>>>>> f2a8f5e05 (e2e: abci protocol should be consistent across networks (#7078))
}

// ManifestNode represents a node in a testnet manifest.
Expand All @@ -72,12 +95,6 @@ type ManifestNode struct {
// "rocksdb", "boltdb", or "badgerdb". Defaults to goleveldb.
Database string `toml:"database"`

// ABCIProtocol specifies the protocol used to communicate with the ABCI
// application: "unix", "tcp", "grpc", or "builtin". Defaults to unix.
// builtin will build a complete Tendermint node into the application and
// launch it instead of launching a separate Tendermint process.
ABCIProtocol string `toml:"abci_protocol"`

// PrivvalProtocol specifies the protocol used to sign consensus messages:
// "file", "unix", or "tcp". Defaults to "file". For unix and tcp, the ABCI
// application will launch a remote signer client in a separate goroutine.
Expand Down
29 changes: 25 additions & 4 deletions test/e2e/pkg/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ type Testnet struct {
ValidatorUpdates map[int64]map[*Node]int64
Nodes []*Node
KeyType string
<<<<<<< HEAD
=======
Evidence int
LogLevel string
TxSize int64
ABCIProtocol string
>>>>>>> f2a8f5e05 (e2e: abci protocol should be consistent across networks (#7078))
}

// Node represents a Tendermint node in a testnet.
Expand Down Expand Up @@ -122,10 +129,27 @@ func LoadTestnet(file string) (*Testnet, error) {
Validators: map[*Node]int64{},
ValidatorUpdates: map[int64]map[*Node]int64{},
Nodes: []*Node{},
<<<<<<< HEAD
=======
Evidence: manifest.Evidence,
KeyType: "ed25519",
LogLevel: manifest.LogLevel,
TxSize: manifest.TxSize,
ABCIProtocol: manifest.ABCIProtocol,
}
if len(manifest.KeyType) != 0 {
testnet.KeyType = manifest.KeyType
}
if testnet.TxSize <= 0 {
testnet.TxSize = 1024
>>>>>>> f2a8f5e05 (e2e: abci protocol should be consistent across networks (#7078))
}
if manifest.InitialHeight > 0 {
testnet.InitialHeight = manifest.InitialHeight
}
if testnet.ABCIProtocol == "" {
testnet.ABCIProtocol = string(ProtocolBuiltin)
}

// Set up nodes, in alphabetical order (IPs and ports get same order).
nodeNames := []string{}
Expand All @@ -145,7 +169,7 @@ func LoadTestnet(file string) (*Testnet, error) {
ProxyPort: proxyPortGen.Next(),
Mode: ModeValidator,
Database: "goleveldb",
ABCIProtocol: ProtocolBuiltin,
ABCIProtocol: Protocol(testnet.ABCIProtocol),
PrivvalProtocol: ProtocolFile,
StartAt: nodeManifest.StartAt,
FastSync: nodeManifest.FastSync,
Expand All @@ -165,9 +189,6 @@ func LoadTestnet(file string) (*Testnet, error) {
if nodeManifest.Database != "" {
node.Database = nodeManifest.Database
}
if nodeManifest.ABCIProtocol != "" {
node.ABCIProtocol = Protocol(nodeManifest.ABCIProtocol)
}
if nodeManifest.PrivvalProtocol != "" {
node.PrivvalProtocol = Protocol(nodeManifest.PrivvalProtocol)
}
Expand Down

0 comments on commit 5718acd

Please sign in to comment.