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>
This commit is contained in:
Thane Thomson
2022-12-16 10:19:02 -05:00
committed by GitHub
parent 1a5d5ed63b
commit 6878b38812
13 changed files with 79 additions and 456 deletions
+1 -7
View File
@@ -7,7 +7,6 @@ import (
"github.com/BurntSushi/toml"
"github.com/tendermint/tendermint/test/e2e/app"
e2e "github.com/tendermint/tendermint/test/e2e/pkg"
)
// Config is the application configuration.
@@ -17,7 +16,6 @@ type Config struct {
Protocol string `toml:"protocol"`
Dir string `toml:"dir"`
Mode string `toml:"mode"`
SyncApp bool `toml:"sync_app"`
PersistInterval uint64 `toml:"persist_interval"`
SnapshotInterval uint64 `toml:"snapshot_interval"`
RetainBlocks uint64 `toml:"retain_blocks"`
@@ -62,12 +60,8 @@ func (cfg Config) Validate() error {
switch {
case cfg.ChainID == "":
return errors.New("chain_id parameter is required")
case cfg.Listen == "" && cfg.Protocol != "builtin":
case cfg.Listen == "" && cfg.Protocol != "builtin" && cfg.Protocol != "builtin_unsync":
return errors.New("listen parameter is required")
case cfg.SyncApp && cfg.Protocol != string(e2e.ProtocolBuiltin):
return errors.New("sync_app parameter is only relevant for builtin applications")
case cfg.SyncApp && cfg.Mode != string(e2e.ModeFull) && cfg.Mode != string(e2e.ModeValidator):
return errors.New("sync_app parameter is only relevant to full nodes and validators")
default:
return nil
}
+15 -19
View File
@@ -62,7 +62,7 @@ func run(configFile string) error {
if err = startSigner(cfg); err != nil {
return err
}
if cfg.Protocol == "builtin" {
if cfg.Protocol == "builtin" || cfg.Protocol == "builtin_unsync" {
time.Sleep(1 * time.Second)
}
}
@@ -71,7 +71,7 @@ func run(configFile string) error {
switch cfg.Protocol {
case "socket", "grpc":
err = startApp(cfg)
case "builtin":
case "builtin", "builtin_unsync":
if cfg.Mode == string(e2e.ModeLight) {
err = startLightClient(cfg)
} else {
@@ -113,22 +113,9 @@ func startApp(cfg *Config) error {
//
// FIXME There is no way to simply load the configuration from a file, so we need to pull in Viper.
func startNode(cfg *Config) error {
var cc proxy.ClientCreator
if cfg.SyncApp {
app, err := app.NewSyncApplication(cfg.App())
if err != nil {
return err
}
cc = proxy.NewUnsyncLocalClientCreator(app)
logger.Info("Using synchronized app with unsynchronized local client")
} else {
app, err := app.NewApplication(cfg.App())
if err != nil {
return err
}
cc = proxy.NewLocalClientCreator(app)
logger.Info("Using regular app with synchronized (regular) local client")
app, err := app.NewApplication(cfg.App())
if err != nil {
return err
}
tmcfg, nodeLogger, nodeKey, err := setupNode()
@@ -136,10 +123,19 @@ func startNode(cfg *Config) error {
return fmt.Errorf("failed to setup config: %w", err)
}
var clientCreator proxy.ClientCreator
if cfg.Protocol == string(e2e.ProtocolBuiltinUnsync) {
clientCreator = proxy.NewUnsyncLocalClientCreator(app)
nodeLogger.Info("Using unsynchronized local client creator")
} else {
clientCreator = proxy.NewLocalClientCreator(app)
nodeLogger.Info("Using default (synchronized) local client creator")
}
n, err := node.NewNode(tmcfg,
privval.LoadOrGenFilePV(tmcfg.PrivValidatorKeyFile(), tmcfg.PrivValidatorStateFile()),
nodeKey,
cc,
clientCreator,
node.DefaultGenesisDocProviderFunc(tmcfg),
config.DefaultDBProvider,
node.DefaultMetricsProvider(tmcfg.Instrumentation),