diff --git a/server/config/config.go b/server/config/config.go index 40087b149603..9706ae65e1d4 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -94,6 +94,9 @@ type BaseConfig struct { // IAVLLazyLoading enable/disable the lazy loading of iavl store. IAVLLazyLoading bool `mapstructure:"iavl-lazy-loading"` + // ABCIClientType selects the type of ABCI client. + ABCIClientType string `mapstructure:"abci-client-type"` + // AppDBBackend defines the type of Database to use for the application and snapshots databases. // An empty string indicates that the Tendermint config's DBBackend value should be used. AppDBBackend string `mapstructure:"app-db-backend"` @@ -289,6 +292,7 @@ func DefaultConfig() *Config { IAVLCacheSize: 781250, // 50 MB IAVLDisableFastNode: false, IAVLLazyLoading: false, + ABCIClientType: "committing", // [AGORIC] AppDBBackend: "", }, Telemetry: telemetry.Config{ diff --git a/server/config/toml.go b/server/config/toml.go index 920201b330e4..a53633cc7e3c 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -82,6 +82,10 @@ iavl-disable-fastnode = {{ .BaseConfig.IAVLDisableFastNode }} # Default is false. iavl-lazy-loading = {{ .BaseConfig.IAVLLazyLoading }} +# ABCIClientType selects the type of ABCI client. +# Default is "committing". +abci-client-type = "{{ .BaseConfig.ABCIClientType }}" + # AppDBBackend defines the database backend type to use for the application and snapshots DBs. # An empty string indicates that a fallback will be used. # First fallback is the deprecated compile-time types.DBBackend value. diff --git a/server/start.go b/server/start.go index b60cbaa9cf55..03e8fc4509a5 100644 --- a/server/start.go +++ b/server/start.go @@ -84,6 +84,7 @@ const ( flagGRPCWebAddress = "grpc-web.address" ) +// [AGORIC] Valid values for FlagAbciClientType const ( abciClientTypeCommitting = "committing" abciClientTypeLocal = "local" @@ -149,18 +150,9 @@ is performed. Note, when enabled, gRPC will also be automatically enabled. }) } - abciClientType, err := cmd.Flags().GetString(FlagAbciClientType) - if err != nil { - return err - } - clientCreator, err := getAbciClientCreator(abciClientType) - if err != nil { - return err - } - // amino is needed here for backwards compatibility of REST routes err = wrapCPUProfile(serverCtx, func() error { - return startInProcess(serverCtx, clientCtx, appCreator, clientCreator) + return startInProcess(serverCtx, clientCtx, appCreator) }) errCode, ok := err.(ErrorCode) if !ok { @@ -273,7 +265,7 @@ func startStandAlone(ctx *Context, appCreator types.AppCreator) error { type abciClientCreator func(abcitypes.Application) proxy.ClientCreator -func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.AppCreator, clientCreator abciClientCreator) error { +func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.AppCreator) error { cfg := ctx.Config home := cfg.RootDir @@ -306,6 +298,14 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App genDocProvider := node.DefaultGenesisDocProviderFunc(cfg) + // [AGORIC] allow the ABCI client type to be configurable. + abciClientType := config.ABCIClientType + ctx.Logger.Info(fmt.Sprintf("ABCI client type: %s", abciClientType)) + clientCreator, err := getAbciClientCreator(abciClientType) + if err != nil { + return err + } + var ( tmNode *node.Node gRPCOnly = ctx.Viper.GetBool(flagGRPCOnly) @@ -520,6 +520,8 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App return WaitForQuitSignals() } +// getAbciClientCreator dispatches the client type to the right cometbft constructor. +// [AGORIC] Allows us to disable committingClient. func getAbciClientCreator(abciClientType string) (abciClientCreator, error) { switch abciClientType { case abciClientTypeCommitting: