e2e: programmable ABCI method times (#8638)

* e2e: programmable ABCI method times

* fix linting error
This commit is contained in:
Callum Waters
2022-05-31 12:22:52 +02:00
committed by GitHub
parent 3dec4a4744
commit fefce8dc35
6 changed files with 131 additions and 61 deletions
+9 -1
View File
@@ -64,7 +64,7 @@ type Manifest struct {
QueueType string `toml:"queue_type"`
// Number of bytes per tx. Default is 1kb (1024)
TxSize int
TxSize int `toml:"tx_size"`
// VoteExtensionsEnableHeight configures the first height during which
// the chain will use and require vote extension data to be present
@@ -76,6 +76,14 @@ type Manifest struct {
// 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"`
// Add artificial delays to each of the main ABCI calls to mimic computation time
// of the application
PrepareProposalDelayMS uint64 `toml:"prepare_proposal_delay_ms"`
ProcessProposalDelayMS uint64 `toml:"process_proposal_delay_ms"`
CheckTxDelayMS uint64 `toml:"check_tx_delay_ms"`
VoteExtensionDelayMS uint64 `toml:"vote_extension_delay_ms"`
FinalizeBlockDelayMS uint64 `toml:"finalize_block_delay_ms"`
}
// ManifestNode represents a node in a testnet manifest.
+26 -29
View File
@@ -72,7 +72,12 @@ type Testnet struct {
VoteExtensionsEnableHeight int64
LogLevel string
TxSize int
ABCIProtocol string
ABCIProtocol Protocol
PrepareProposalDelayMS int
ProcessProposalDelayMS int
CheckTxDelayMS int
VoteExtensionDelayMS int
FinalizeBlockDelayMS int
}
// Node represents a Tendermint node in a testnet.
@@ -88,7 +93,6 @@ type Node struct {
Mempool string
StateSync string
Database string
ABCIProtocol Protocol
PrivvalProtocol Protocol
PersistInterval uint64
SnapshotInterval uint64
@@ -128,20 +132,25 @@ func LoadTestnet(file string) (*Testnet, error) {
proxyPortGen := newPortGenerator(proxyPortFirst)
testnet := &Testnet{
Name: filepath.Base(dir),
File: file,
Dir: dir,
IP: ipGen.Network(),
InitialHeight: 1,
InitialState: manifest.InitialState,
Validators: map[*Node]int64{},
ValidatorUpdates: map[int64]map[*Node]int64{},
Nodes: []*Node{},
Evidence: manifest.Evidence,
KeyType: "ed25519",
LogLevel: manifest.LogLevel,
TxSize: manifest.TxSize,
ABCIProtocol: manifest.ABCIProtocol,
Name: filepath.Base(dir),
File: file,
Dir: dir,
IP: ipGen.Network(),
InitialHeight: 1,
InitialState: manifest.InitialState,
Validators: map[*Node]int64{},
ValidatorUpdates: map[int64]map[*Node]int64{},
Nodes: []*Node{},
Evidence: manifest.Evidence,
KeyType: "ed25519",
LogLevel: manifest.LogLevel,
TxSize: manifest.TxSize,
ABCIProtocol: Protocol(manifest.ABCIProtocol),
PrepareProposalDelayMS: int(manifest.PrepareProposalDelayMS),
ProcessProposalDelayMS: int(manifest.ProcessProposalDelayMS),
CheckTxDelayMS: int(manifest.CheckTxDelayMS),
VoteExtensionDelayMS: int(manifest.VoteExtensionDelayMS),
FinalizeBlockDelayMS: int(manifest.FinalizeBlockDelayMS),
}
if len(manifest.KeyType) != 0 {
testnet.KeyType = manifest.KeyType
@@ -153,7 +162,7 @@ func LoadTestnet(file string) (*Testnet, error) {
testnet.InitialHeight = manifest.InitialHeight
}
if testnet.ABCIProtocol == "" {
testnet.ABCIProtocol = string(ProtocolBuiltin)
testnet.ABCIProtocol = ProtocolBuiltin
}
// Set up nodes, in alphabetical order (IPs and ports get same order).
@@ -174,7 +183,6 @@ func LoadTestnet(file string) (*Testnet, error) {
ProxyPort: proxyPortGen.Next(),
Mode: ModeValidator,
Database: "goleveldb",
ABCIProtocol: Protocol(testnet.ABCIProtocol),
PrivvalProtocol: ProtocolFile,
StartAt: nodeManifest.StartAt,
Mempool: nodeManifest.Mempool,
@@ -192,9 +200,6 @@ func LoadTestnet(file string) (*Testnet, error) {
if nodeManifest.Mode != "" {
node.Mode = Mode(nodeManifest.Mode)
}
if node.Mode == ModeLight {
node.ABCIProtocol = ProtocolBuiltin
}
if nodeManifest.Database != "" {
node.Database = nodeManifest.Database
}
@@ -354,14 +359,6 @@ func (n Node) Validate(testnet Testnet) error {
default:
return fmt.Errorf("invalid database setting %q", n.Database)
}
switch n.ABCIProtocol {
case ProtocolBuiltin, ProtocolUNIX, ProtocolTCP, ProtocolGRPC:
default:
return fmt.Errorf("invalid ABCI protocol setting %q", n.ABCIProtocol)
}
if n.Mode == ModeLight && n.ABCIProtocol != ProtocolBuiltin {
return errors.New("light client must use builtin protocol")
}
switch n.PrivvalProtocol {
case ProtocolFile, ProtocolTCP, ProtocolGRPC, ProtocolUNIX:
default: