Files
tendermint/test/e2e/node/config.go
Thane Thomson 6878b38812 abci: Adapt unsynchronized local client to replicate remote client concurrency (#9830)
* Revert "abci: Add unsynchronized local client (#9660)"

This reverts commit 45071d1f23.

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* proxy: Add unsync local client creator

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* e2e: Extend tests

Extend the E2E tests to randomly choose between the sync (default) and
unsync (new) local client creator.

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* abci: Remove redundant interface constraint

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* abci: Remove irrelevant doc comment

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* proxy: Remove backticks in doc comments

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* e2e: Remove unnecessary gap between doc comment and struct

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* Add pending changelog entry

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* e2e: Expand on BuiltinProxyMode param docstring

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* Remove builtin proxy mode config option from CI test

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* e2e: Make builtin proxy mode option testnet-wide

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* e2e: Embed sync/unsync notion in node protocol

The approach of randomly generating the proxy mode across testnets
resulted in a totally uneven ratio of sync to unsync modes for all
testnets that happened to have a protocol of "builtin".

This commit adapts the E2E tests to have a new ABCI protocol option:
"builtin_unsync". This results in a better spread of sync/unsync choices
for generated testnets.

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* e2e: Remove unused type

Signed-off-by: Thane Thomson <connect@thanethomson.com>

Signed-off-by: Thane Thomson <connect@thanethomson.com>
2022-12-16 10:19:02 -05:00

69 lines
2.2 KiB
Go

package main
import (
"errors"
"fmt"
"github.com/BurntSushi/toml"
"github.com/tendermint/tendermint/test/e2e/app"
)
// Config is the application configuration.
type Config struct {
ChainID string `toml:"chain_id"`
Listen string `toml:"listen"`
Protocol string `toml:"protocol"`
Dir string `toml:"dir"`
Mode string `toml:"mode"`
PersistInterval uint64 `toml:"persist_interval"`
SnapshotInterval uint64 `toml:"snapshot_interval"`
RetainBlocks uint64 `toml:"retain_blocks"`
ValidatorUpdates map[string]map[string]uint8 `toml:"validator_update"`
PrivValServer string `toml:"privval_server"`
PrivValKey string `toml:"privval_key"`
PrivValState string `toml:"privval_state"`
KeyType string `toml:"key_type"`
}
// App extracts out the application specific configuration parameters
func (cfg *Config) App() *app.Config {
return &app.Config{
Dir: cfg.Dir,
SnapshotInterval: cfg.SnapshotInterval,
RetainBlocks: cfg.RetainBlocks,
KeyType: cfg.KeyType,
ValidatorUpdates: cfg.ValidatorUpdates,
PersistInterval: cfg.PersistInterval,
}
}
// LoadConfig loads the configuration from disk.
func LoadConfig(file string) (*Config, error) {
cfg := &Config{
Listen: "unix:///var/run/app.sock",
Protocol: "socket",
PersistInterval: 1,
}
_, err := toml.DecodeFile(file, &cfg)
if err != nil {
return nil, fmt.Errorf("failed to load config from %q: %w", file, err)
}
return cfg, cfg.Validate()
}
// Validate validates the configuration. We don't do exhaustive config
// validation here, instead relying on Testnet.Validate() to handle it.
//
//nolint:goconst
func (cfg Config) Validate() error {
switch {
case cfg.ChainID == "":
return errors.New("chain_id parameter is required")
case cfg.Listen == "" && cfg.Protocol != "builtin" && cfg.Protocol != "builtin_unsync":
return errors.New("listen parameter is required")
default:
return nil
}
}