mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-03 06:37:14 +00:00
abci: Add unsynchronized local client (#9660)
* Remove extra interface cast Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove irrelevant comment Signed-off-by: Thane Thomson <connect@thanethomson.com> * abci: Add unsynchronized local client Signed-off-by: Thane Thomson <connect@thanethomson.com> * proxy: Add unsync local client creator Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Add sync app for use with unsync local client Signed-off-by: Thane Thomson <connect@thanethomson.com> * abci: Elaborate on mutex param in unsync local client Signed-off-by: Thane Thomson <connect@thanethomson.com> * proxy: Remove unnecessary comment Signed-off-by: Thane Thomson <connect@thanethomson.com> * abcicli: Remove unnecessary mutex param from unsync client Signed-off-by: Thane Thomson <connect@thanethomson.com> * ci/e2e: Explicitly use sync app for validator04 Signed-off-by: Thane Thomson <connect@thanethomson.com> * e2e: Ensure app is definitely the E2E app Signed-off-by: Thane Thomson <connect@thanethomson.com> Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
+10
-4
@@ -7,15 +7,17 @@ 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.
|
||||
type Config struct {
|
||||
ChainID string `toml:"chain_id"`
|
||||
Listen string
|
||||
Protocol string
|
||||
Dir string
|
||||
ChainID string `toml:"chain_id"`
|
||||
Listen string `toml:"listen"`
|
||||
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,6 +64,10 @@ func (cfg Config) Validate() error {
|
||||
return errors.New("chain_id parameter is required")
|
||||
case cfg.Listen == "" && cfg.Protocol != "builtin":
|
||||
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
|
||||
}
|
||||
|
||||
+17
-4
@@ -113,9 +113,22 @@ 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 {
|
||||
app, err := app.NewApplication(cfg.App())
|
||||
if err != nil {
|
||||
return err
|
||||
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")
|
||||
}
|
||||
|
||||
tmcfg, nodeLogger, nodeKey, err := setupNode()
|
||||
@@ -126,7 +139,7 @@ func startNode(cfg *Config) error {
|
||||
n, err := node.NewNode(tmcfg,
|
||||
privval.LoadOrGenFilePV(tmcfg.PrivValidatorKeyFile(), tmcfg.PrivValidatorStateFile()),
|
||||
nodeKey,
|
||||
proxy.NewLocalClientCreator(app),
|
||||
cc,
|
||||
node.DefaultGenesisDocProviderFunc(tmcfg),
|
||||
node.DefaultDBProvider,
|
||||
node.DefaultMetricsProvider(tmcfg.Instrumentation),
|
||||
|
||||
Reference in New Issue
Block a user