mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 22:44:24 +00:00
Merge branch 'main' into wb/e2e-do-disconnected
This commit is contained in:
@@ -28,7 +28,7 @@ func (p *Provider) Setup() error {
|
||||
}
|
||||
//nolint: gosec
|
||||
// G306: Expect WriteFile permissions to be 0600 or less
|
||||
err = os.WriteFile(filepath.Join(p.Testnet.Dir, "docker-compose.yml"), compose, 0644)
|
||||
err = os.WriteFile(filepath.Join(p.Testnet.Dir, "docker-compose.yml"), compose, 0o644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -78,9 +78,12 @@ services:
|
||||
labels:
|
||||
e2e: true
|
||||
container_name: {{ .Name }}
|
||||
image: tendermint/e2e-node
|
||||
image: tendermint/e2e-node:{{ .Version }}
|
||||
{{- if eq .ABCIProtocol "builtin" }}
|
||||
entrypoint: /usr/bin/entrypoint-builtin
|
||||
{{- else }}{{ if eq .ABCIProtocol "builtin_unsync" }}
|
||||
entrypoint: /usr/bin/entrypoint-builtin
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
init: true
|
||||
ports:
|
||||
|
||||
+24
-11
@@ -57,9 +57,15 @@ type Manifest struct {
|
||||
Evidence int `toml:"evidence"`
|
||||
|
||||
// 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.
|
||||
// application: "unix", "tcp", "grpc", "builtin" or "builtin_unsync".
|
||||
//
|
||||
// Defaults to "builtin". "builtin" will build a complete Tendermint node
|
||||
// into the application and launch it instead of launching a separate
|
||||
// Tendermint process.
|
||||
//
|
||||
// "builtin_unsync" is basically the same as "builtin", except that it uses
|
||||
// an "unsynchronized" local client creator, which attempts to replicate the
|
||||
// same concurrency model locally as the socket client.
|
||||
ABCIProtocol string `toml:"abci_protocol"`
|
||||
|
||||
// Add artificial delays to each of the main ABCI calls to mimic computation time
|
||||
@@ -68,6 +74,10 @@ type Manifest struct {
|
||||
ProcessProposalDelay time.Duration `toml:"process_proposal_delay"`
|
||||
CheckTxDelay time.Duration `toml:"check_tx_delay"`
|
||||
// TODO: add vote extension and finalize block delay (@cmwaters)
|
||||
|
||||
LoadTxSizeBytes int `toml:"load_tx_size_bytes"`
|
||||
LoadTxBatchSize int `toml:"load_tx_batch_size"`
|
||||
LoadTxConnections int `toml:"load_tx_connections"`
|
||||
}
|
||||
|
||||
// ManifestNode represents a node in a testnet manifest.
|
||||
@@ -77,14 +87,12 @@ type ManifestNode struct {
|
||||
// is generated), and seed nodes run in seed mode with the PEX reactor enabled.
|
||||
Mode string `toml:"mode"`
|
||||
|
||||
// SyncApp specifies whether this node should use a synchronized application
|
||||
// with an unsynchronized local client. By default this is `false`, meaning
|
||||
// that the node will run an unsynchronized application with a synchronized
|
||||
// local client.
|
||||
//
|
||||
// Only applies to validators and full nodes where their ABCI protocol is
|
||||
// "builtin".
|
||||
SyncApp bool `toml:"sync_app"`
|
||||
// Version specifies which version of Tendermint this node is. Specifying different
|
||||
// versions for different nodes allows for testing the interaction of different
|
||||
// node's compatibility. Note that in order to use a node at a particular version,
|
||||
// there must be a docker image of the test app tagged with this version present
|
||||
// on the machine where the test is being run.
|
||||
Version string `toml:"version"`
|
||||
|
||||
// Seeds is the list of node names to use as P2P seed nodes. Defaults to none.
|
||||
Seeds []string `toml:"seeds"`
|
||||
@@ -145,6 +153,11 @@ type ManifestNode struct {
|
||||
// pause: temporarily pauses (freezes) the node
|
||||
// restart: restarts the node, shutting it down with SIGTERM
|
||||
Perturb []string `toml:"perturb"`
|
||||
|
||||
// SendNoLoad determines if the e2e test should send load to this node.
|
||||
// It defaults to false so unless the configured, the node will
|
||||
// receive load.
|
||||
SendNoLoad bool `toml:"send_no_load"`
|
||||
}
|
||||
|
||||
// Save saves the testnet manifest to a file.
|
||||
|
||||
+37
-9
@@ -22,6 +22,10 @@ import (
|
||||
const (
|
||||
randomSeed int64 = 2308084734268
|
||||
proxyPortFirst uint32 = 5701
|
||||
|
||||
defaultBatchSize = 2
|
||||
defaultConnections = 1
|
||||
defaultTxSizeBytes = 1024
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -36,11 +40,12 @@ const (
|
||||
ModeLight Mode = "light"
|
||||
ModeSeed Mode = "seed"
|
||||
|
||||
ProtocolBuiltin Protocol = "builtin"
|
||||
ProtocolFile Protocol = "file"
|
||||
ProtocolGRPC Protocol = "grpc"
|
||||
ProtocolTCP Protocol = "tcp"
|
||||
ProtocolUNIX Protocol = "unix"
|
||||
ProtocolBuiltin Protocol = "builtin"
|
||||
ProtocolBuiltinUnsync Protocol = "builtin_unsync"
|
||||
ProtocolFile Protocol = "file"
|
||||
ProtocolGRPC Protocol = "grpc"
|
||||
ProtocolTCP Protocol = "tcp"
|
||||
ProtocolUNIX Protocol = "unix"
|
||||
|
||||
PerturbationDisconnect Perturbation = "disconnect"
|
||||
PerturbationKill Perturbation = "kill"
|
||||
@@ -64,6 +69,9 @@ type Testnet struct {
|
||||
Nodes []*Node
|
||||
KeyType string
|
||||
Evidence int
|
||||
LoadTxSizeBytes int
|
||||
LoadTxBatchSize int
|
||||
LoadTxConnections int
|
||||
ABCIProtocol string
|
||||
PrepareProposalDelay time.Duration
|
||||
ProcessProposalDelay time.Duration
|
||||
@@ -73,9 +81,9 @@ type Testnet struct {
|
||||
// Node represents a Tendermint node in a testnet.
|
||||
type Node struct {
|
||||
Name string
|
||||
Version string
|
||||
Testnet *Testnet
|
||||
Mode Mode
|
||||
SyncApp bool // Should we use a synchronized app with an unsynchronized local client?
|
||||
PrivvalKey crypto.PrivKey
|
||||
NodeKey crypto.PrivKey
|
||||
IP net.IP
|
||||
@@ -93,6 +101,9 @@ type Node struct {
|
||||
Seeds []*Node
|
||||
PersistentPeers []*Node
|
||||
Perturbations []Perturbation
|
||||
|
||||
// SendNoLoad determines if the e2e test should send load to this node.
|
||||
SendNoLoad bool
|
||||
}
|
||||
|
||||
// LoadTestnet loads a testnet from a manifest file, using the filename to
|
||||
@@ -119,6 +130,9 @@ func LoadTestnet(manifest Manifest, fname string, ifd InfrastructureData) (*Test
|
||||
ValidatorUpdates: map[int64]map[*Node]int64{},
|
||||
Nodes: []*Node{},
|
||||
Evidence: manifest.Evidence,
|
||||
LoadTxSizeBytes: manifest.LoadTxSizeBytes,
|
||||
LoadTxBatchSize: manifest.LoadTxBatchSize,
|
||||
LoadTxConnections: manifest.LoadTxConnections,
|
||||
ABCIProtocol: manifest.ABCIProtocol,
|
||||
PrepareProposalDelay: manifest.PrepareProposalDelay,
|
||||
ProcessProposalDelay: manifest.ProcessProposalDelay,
|
||||
@@ -133,6 +147,15 @@ func LoadTestnet(manifest Manifest, fname string, ifd InfrastructureData) (*Test
|
||||
if testnet.ABCIProtocol == "" {
|
||||
testnet.ABCIProtocol = string(ProtocolBuiltin)
|
||||
}
|
||||
if testnet.LoadTxConnections == 0 {
|
||||
testnet.LoadTxConnections = defaultConnections
|
||||
}
|
||||
if testnet.LoadTxBatchSize == 0 {
|
||||
testnet.LoadTxBatchSize = defaultBatchSize
|
||||
}
|
||||
if testnet.LoadTxSizeBytes == 0 {
|
||||
testnet.LoadTxSizeBytes = defaultTxSizeBytes
|
||||
}
|
||||
|
||||
// Set up nodes, in alphabetical order (IPs and ports get same order).
|
||||
nodeNames := []string{}
|
||||
@@ -147,15 +170,19 @@ func LoadTestnet(manifest Manifest, fname string, ifd InfrastructureData) (*Test
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("information for node '%s' missing from infrastucture data", name)
|
||||
}
|
||||
v := nodeManifest.Version
|
||||
if v == "" {
|
||||
v = "local-version"
|
||||
}
|
||||
node := &Node{
|
||||
Name: name,
|
||||
Version: v,
|
||||
Testnet: testnet,
|
||||
PrivvalKey: keyGen.Generate(manifest.KeyType),
|
||||
NodeKey: keyGen.Generate("ed25519"),
|
||||
IP: ind.IPAddress,
|
||||
ProxyPort: ind.Port,
|
||||
Mode: ModeValidator,
|
||||
SyncApp: nodeManifest.SyncApp,
|
||||
Database: "goleveldb",
|
||||
ABCIProtocol: Protocol(testnet.ABCIProtocol),
|
||||
PrivvalProtocol: ProtocolFile,
|
||||
@@ -167,6 +194,7 @@ func LoadTestnet(manifest Manifest, fname string, ifd InfrastructureData) (*Test
|
||||
SnapshotInterval: nodeManifest.SnapshotInterval,
|
||||
RetainBlocks: nodeManifest.RetainBlocks,
|
||||
Perturbations: []Perturbation{},
|
||||
SendNoLoad: nodeManifest.SendNoLoad,
|
||||
}
|
||||
if node.StartAt == testnet.InitialHeight {
|
||||
node.StartAt = 0 // normalize to 0 for initial nodes, since code expects this
|
||||
@@ -318,11 +346,11 @@ func (n Node) Validate(testnet Testnet) error {
|
||||
return fmt.Errorf("invalid database setting %q", n.Database)
|
||||
}
|
||||
switch n.ABCIProtocol {
|
||||
case ProtocolBuiltin, ProtocolUNIX, ProtocolTCP, ProtocolGRPC:
|
||||
case ProtocolBuiltin, ProtocolBuiltinUnsync, ProtocolUNIX, ProtocolTCP, ProtocolGRPC:
|
||||
default:
|
||||
return fmt.Errorf("invalid ABCI protocol setting %q", n.ABCIProtocol)
|
||||
}
|
||||
if n.Mode == ModeLight && n.ABCIProtocol != ProtocolBuiltin {
|
||||
if n.Mode == ModeLight && n.ABCIProtocol != ProtocolBuiltin && n.ABCIProtocol != ProtocolBuiltinUnsync {
|
||||
return errors.New("light client must use builtin protocol")
|
||||
}
|
||||
switch n.PrivvalProtocol {
|
||||
|
||||
Reference in New Issue
Block a user