feat: use same port for grpc-web and api server (#14652)
This commit is contained in:
parent
a4cf8e8c6f
commit
4f6f6c0002
@ -227,8 +227,13 @@ extension interfaces. `module.Manager.Modules` is now of type `map[string]interf
|
||||
* (baseapp) [#14050](https://github.com/cosmos/cosmos-sdk/pull/14050) refactor `ABCIListener` interface to accept go contexts
|
||||
* (store/streaming)[#14603](https://github.com/cosmos/cosmos-sdk/pull/14603) `StoreDecoderRegistry` moved from store to `types/simulations` this breaks the `AppModuleSimulation` interface.
|
||||
|
||||
### Client Breaking Changes
|
||||
|
||||
* (grpc-web) [#14652](https://github.com/cosmos/cosmos-sdk/pull/14652) Use same port for gRPC-Web and the API server.
|
||||
|
||||
### CLI Breaking Changes
|
||||
|
||||
* (grpc-web) [#14652](https://github.com/cosmos/cosmos-sdk/pull/14652) Remove `grpc-web.address` flag.
|
||||
* (client) [#14342](https://github.com/cosmos/cosmos-sdk/pull/14342) `simd config` command is now a sub-command. Use `simd config --help` to learn more.
|
||||
* (x/genutil) [#13535](https://github.com/cosmos/cosmos-sdk/pull/13535) Replace in `simd init`, the `--staking-bond-denom` flag with `--default-denom` which is used for all default denomination in the genesis, instead of only staking.
|
||||
* (tx) [#12659](https://github.com/cosmos/cosmos-sdk/pull/12659) Remove broadcast mode `block`.
|
||||
|
||||
44
UPGRADING.md
44
UPGRADING.md
@ -4,7 +4,23 @@ This guide provides instructions for upgrading to specific versions of Cosmos SD
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Database configuration
|
||||
### Configuration
|
||||
|
||||
A new tool have been created for migrating configuration of the SDK. Use the following command to migrate your configuration:
|
||||
|
||||
```bash
|
||||
simd config migrate v0.48
|
||||
```
|
||||
|
||||
More information about [confix](https://docs.cosmos.network/main/tooling/confix).
|
||||
|
||||
#### gRPC-Web
|
||||
|
||||
gRPC-Web is now listening to the same address as the gRPC Gateway API server (default: `localhost:1317`).
|
||||
The possibility to listen to a different address has been removed, as well as its settings.
|
||||
Use `confix` to clean-up your `app.toml`. A nginx (or alike) reverse-proxy can be set to keep the previous behavior.
|
||||
|
||||
#### Database
|
||||
|
||||
ClevelDB, BoltDB and BadgerDB are not supported anymore. To migrate from a unsupported database to a supported database please use the database migration tool.
|
||||
|
||||
@ -32,6 +48,21 @@ References to `types/store.go` which contained aliases for store types have been
|
||||
Previously, all modules were required to be set in `OrderBeginBlockers`, `OrderEndBlockers` and `OrderInitGenesis / OrderExportGenesis` in `app.go` / `app_config.go`.
|
||||
This is no longer the case, the assertion has been loosened to only require modules implementing, respectively, the `module.BeginBlockAppModule`, `module.EndBlockAppModule` and `module.HasGenesis` interfaces.
|
||||
|
||||
### Modules
|
||||
|
||||
#### `x/gov`
|
||||
|
||||
##### Cancelling Proposals
|
||||
|
||||
The `gov` module has been updated to support the ability to cancel governance proposals. When a proposal is canceled, all the deposits of the proposal are either burnt or sent to `ProposalCancelDest` address. The deposits burn rate will be determined by a new parameter called `ProposalCancelRatio` parameter.
|
||||
|
||||
```text
|
||||
1. deposits * proposal_cancel_ratio will be burned or sent to `ProposalCancelDest` address , if `ProposalCancelDest` is empty then deposits will be burned.
|
||||
2. deposits * (1 - proposal_cancel_ratio) will be sent to depositors.
|
||||
```
|
||||
|
||||
By default, the new `ProposalCancelRatio` parameter is set to 0.5 during migration and `ProposalCancelDest` is set to empty string (i.e. burnt).
|
||||
|
||||
## [v0.47.x](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.47.0)
|
||||
|
||||
### Simulation
|
||||
@ -201,17 +232,6 @@ func (app SimApp) RegisterUpgradeHandlers() {
|
||||
|
||||
```
|
||||
|
||||
##### New Feature: Cancelling Proposals
|
||||
|
||||
The `gov` module has been updated to support the ability to cancel governance proposals. When a proposal is canceled, all the deposits of the proposal are either burnt or sent to `ProposalCancelDest` address. The deposits burn rate will be determined by a new parameter called `ProposalCancelRatio` parameter.
|
||||
|
||||
```
|
||||
1. deposits * proposal_cancel_ratio will be burned or sent to `ProposalCancelDest` address , if `ProposalCancelDest` is empty then deposits will be burned.
|
||||
2. deposits * (1 - proposal_cancel_ratio) will be sent to depositors.
|
||||
```
|
||||
|
||||
By default, the new `ProposalCancelRatio` parameter is set to 0.5 during migration and `ProposalCancelDest` is set to empty string (i.e. burnt).
|
||||
|
||||
#### `x/consensus`
|
||||
|
||||
Introducing a new `x/consensus` module to handle managing Tendermint consensus
|
||||
|
||||
@ -81,7 +81,7 @@ Example:
|
||||
f.String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for")
|
||||
|
||||
// support old flags name for backwards compatibility
|
||||
cmd.PersistentFlags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||
f.SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||
if name == "algo" {
|
||||
name = flags.FlagKeyType
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ version: "3"
|
||||
services:
|
||||
cosmos:
|
||||
image: rosetta-ci:latest
|
||||
command: ["simd", "start", "--pruning", "nothing", "--grpc.enable", "true", "--grpc.address", "0.0.0.0:9090", "--grpc-web.enable", "true", "--grpc-web.address", "0.0.0.0:9091"]
|
||||
command: ["simd", "start", "--pruning", "nothing", "--grpc.enable", "true", "--grpc.address", "0.0.0.0:9090", "--grpc-web.enable", "true"]
|
||||
ports:
|
||||
- 9090:9090
|
||||
- 26657:26657
|
||||
|
||||
@ -12,8 +12,10 @@ import (
|
||||
"github.com/gorilla/handlers"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/improbable-eng/grpc-web/go/grpcweb"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmrpcserver "github.com/tendermint/tendermint/rpc/jsonrpc/server"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec/legacy"
|
||||
@ -28,6 +30,8 @@ type Server struct {
|
||||
GRPCGatewayRouter *runtime.ServeMux
|
||||
ClientCtx client.Context
|
||||
|
||||
GRPCSrv *grpc.Server
|
||||
|
||||
logger log.Logger
|
||||
metrics *telemetry.Metrics
|
||||
// Start() is blocking and generally called from a separate goroutine.
|
||||
@ -52,7 +56,7 @@ func CustomGRPCHeaderMatcher(key string) (string, bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func New(clientCtx client.Context, logger log.Logger) *Server {
|
||||
func New(clientCtx client.Context, logger log.Logger, grpcSrv *grpc.Server) *Server {
|
||||
// The default JSON marshaller used by the gRPC-Gateway is unable to marshal non-nullable non-scalar fields.
|
||||
// Using the gogo/gateway package with the gRPC-Gateway WithMarshaler option fixes the scalar field marshalling issue.
|
||||
marshalerOption := &gateway.JSONPb{
|
||||
@ -63,9 +67,9 @@ func New(clientCtx client.Context, logger log.Logger) *Server {
|
||||
}
|
||||
|
||||
return &Server{
|
||||
logger: logger,
|
||||
Router: mux.NewRouter(),
|
||||
ClientCtx: clientCtx,
|
||||
logger: logger,
|
||||
GRPCGatewayRouter: runtime.NewServeMux(
|
||||
// Custom marshaler option is required for gogo proto
|
||||
runtime.WithMarshalerOption(runtime.MIMEWildcard, marshalerOption),
|
||||
@ -78,6 +82,7 @@ func New(clientCtx client.Context, logger log.Logger) *Server {
|
||||
// GRPC metadata
|
||||
runtime.WithIncomingHeaderMatcher(CustomGRPCHeaderMatcher),
|
||||
),
|
||||
GRPCSrv: grpcSrv,
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,18 +105,41 @@ func (s *Server) Start(cfg config.Config) error {
|
||||
return err
|
||||
}
|
||||
|
||||
s.registerGRPCGatewayRoutes()
|
||||
s.listener = listener
|
||||
var h http.Handler = s.Router
|
||||
|
||||
s.mtx.Unlock()
|
||||
|
||||
if cfg.API.EnableUnsafeCORS {
|
||||
allowAllCORS := handlers.CORS(handlers.AllowedHeaders([]string{"Content-Type"}))
|
||||
return tmrpcserver.Serve(s.listener, allowAllCORS(h), s.logger, tmCfg)
|
||||
// configure grpc-web server
|
||||
if cfg.GRPC.Enable && cfg.GRPCWeb.Enable {
|
||||
var options []grpcweb.Option
|
||||
if cfg.API.EnableUnsafeCORS {
|
||||
options = append(options,
|
||||
grpcweb.WithOriginFunc(func(origin string) bool {
|
||||
return true
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
wrappedGrpc := grpcweb.WrapServer(s.GRPCSrv, options...)
|
||||
s.Router.PathPrefix("/").Handler(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
if wrappedGrpc.IsGrpcWebRequest(req) {
|
||||
wrappedGrpc.ServeHTTP(w, req)
|
||||
return
|
||||
}
|
||||
|
||||
// Fall back to grpc gateway server.
|
||||
s.GRPCGatewayRouter.ServeHTTP(w, req)
|
||||
}))
|
||||
}
|
||||
|
||||
// register grpc-gateway routes (after grpc-web server as the first match is used)
|
||||
s.Router.PathPrefix("/").Handler(s.GRPCGatewayRouter)
|
||||
|
||||
s.logger.Info("starting API server...")
|
||||
if cfg.API.EnableUnsafeCORS {
|
||||
allowAllCORS := handlers.CORS(handlers.AllowedHeaders([]string{"Content-Type"}))
|
||||
return tmrpcserver.Serve(s.listener, allowAllCORS(s.Router), s.logger, tmCfg)
|
||||
}
|
||||
|
||||
return tmrpcserver.Serve(s.listener, s.Router, s.logger, tmCfg)
|
||||
}
|
||||
|
||||
@ -122,10 +150,6 @@ func (s *Server) Close() error {
|
||||
return s.listener.Close()
|
||||
}
|
||||
|
||||
func (s *Server) registerGRPCGatewayRoutes() {
|
||||
s.Router.PathPrefix("/").Handler(s.GRPCGatewayRouter)
|
||||
}
|
||||
|
||||
func (s *Server) SetTelemetry(m *telemetry.Metrics) {
|
||||
s.mtx.Lock()
|
||||
s.metrics = m
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package grpc_test
|
||||
package api_test
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
@ -146,7 +146,7 @@ func (s *GRPCWebTestSuite) makeRequest(
|
||||
contentType = "application/grpc-web-text"
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("http://%s%s", val.AppConfig.GRPCWeb.Address, method)
|
||||
url := fmt.Sprintf("http://%s%s", strings.TrimPrefix(val.AppConfig.API.Address, "tcp://"), method)
|
||||
req, err := http.NewRequest(verb, url, body)
|
||||
s.Require().NoError(err, "failed creating a request")
|
||||
req.Header = headers
|
||||
@ -22,9 +22,6 @@ const (
|
||||
// DefaultGRPCAddress defines the default address to bind the gRPC server to.
|
||||
DefaultGRPCAddress = "localhost:9090"
|
||||
|
||||
// DefaultGRPCWebAddress defines the default address to bind the gRPC-web server to.
|
||||
DefaultGRPCWebAddress = "localhost:9091"
|
||||
|
||||
// DefaultGRPCMaxRecvMsgSize defines the default gRPC max message size in
|
||||
// bytes the server can receive.
|
||||
DefaultGRPCMaxRecvMsgSize = 1024 * 1024 * 10
|
||||
@ -147,12 +144,6 @@ type GRPCConfig struct {
|
||||
type GRPCWebConfig struct {
|
||||
// Enable defines if the gRPC-web should be enabled.
|
||||
Enable bool `mapstructure:"enable"`
|
||||
|
||||
// Address defines the gRPC-web server to listen on
|
||||
Address string `mapstructure:"address"`
|
||||
|
||||
// EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk)
|
||||
EnableUnsafeCORS bool `mapstructure:"enable-unsafe-cors"`
|
||||
}
|
||||
|
||||
// StateSyncConfig defines the state sync snapshot configuration.
|
||||
@ -283,8 +274,7 @@ func DefaultConfig() *Config {
|
||||
MaxSendMsgSize: DefaultGRPCMaxSendMsgSize,
|
||||
},
|
||||
GRPCWeb: GRPCWebConfig{
|
||||
Enable: true,
|
||||
Address: DefaultGRPCWebAddress,
|
||||
Enable: true,
|
||||
},
|
||||
StateSync: StateSyncConfig{
|
||||
SnapshotInterval: 0,
|
||||
|
||||
@ -176,14 +176,9 @@ max-send-msg-size = "{{ .GRPC.MaxSendMsgSize }}"
|
||||
|
||||
# GRPCWebEnable defines if the gRPC-web should be enabled.
|
||||
# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op.
|
||||
# NOTE: gRPC-Web uses the same address as the API server.
|
||||
enable = {{ .GRPCWeb.Enable }}
|
||||
|
||||
# Address defines the gRPC-web server address to bind to.
|
||||
address = "{{ .GRPCWeb.Address }}"
|
||||
|
||||
# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk).
|
||||
enable-unsafe-cors = {{ .GRPCWeb.EnableUnsafeCORS }}
|
||||
|
||||
###############################################################################
|
||||
### State Sync Configuration ###
|
||||
###############################################################################
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/improbable-eng/grpc-web/go/grpcweb"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/server/config"
|
||||
"github.com/cosmos/cosmos-sdk/server/types"
|
||||
)
|
||||
|
||||
// StartGRPCWeb starts a gRPC-Web server on the given address.
|
||||
func StartGRPCWeb(grpcSrv *grpc.Server, config config.Config) (*http.Server, error) {
|
||||
var options []grpcweb.Option
|
||||
if config.GRPCWeb.EnableUnsafeCORS {
|
||||
options = append(options,
|
||||
grpcweb.WithOriginFunc(func(origin string) bool {
|
||||
return true
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
wrappedServer := grpcweb.WrapServer(grpcSrv, options...)
|
||||
grpcWebSrv := &http.Server{
|
||||
Addr: config.GRPCWeb.Address,
|
||||
Handler: wrappedServer,
|
||||
ReadHeaderTimeout: 500 * time.Millisecond,
|
||||
}
|
||||
|
||||
errCh := make(chan error)
|
||||
go func() {
|
||||
if err := grpcWebSrv.ListenAndServe(); err != nil {
|
||||
errCh <- fmt.Errorf("[grpc] failed to serve: %w", err)
|
||||
}
|
||||
}()
|
||||
|
||||
select {
|
||||
case err := <-errCh:
|
||||
return nil, err
|
||||
case <-time.After(types.ServerStartTime): // assume server started successfully
|
||||
return grpcWebSrv, nil
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,6 @@ package server
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime/pprof"
|
||||
"time"
|
||||
@ -69,11 +68,10 @@ const (
|
||||
FlagAPIEnableUnsafeCORS = "api.enabled-unsafe-cors"
|
||||
|
||||
// gRPC-related flags
|
||||
flagGRPCOnly = "grpc-only"
|
||||
flagGRPCEnable = "grpc.enable"
|
||||
flagGRPCAddress = "grpc.address"
|
||||
flagGRPCWebEnable = "grpc-web.enable"
|
||||
flagGRPCWebAddress = "grpc-web.address"
|
||||
flagGRPCOnly = "grpc-only"
|
||||
flagGRPCEnable = "grpc.enable"
|
||||
flagGRPCAddress = "grpc.address"
|
||||
flagGRPCWebEnable = "grpc-web.enable"
|
||||
|
||||
// mempool flags
|
||||
FlagMempoolMaxTxs = "mempool.max-txs"
|
||||
@ -181,7 +179,6 @@ is performed. Note, when enabled, gRPC will also be automatically enabled.
|
||||
cmd.Flags().String(flagGRPCAddress, serverconfig.DefaultGRPCAddress, "the gRPC server address to listen on")
|
||||
|
||||
cmd.Flags().Bool(flagGRPCWebEnable, true, "Define if the gRPC-Web server should be enabled. (Note: gRPC must also be enabled)")
|
||||
cmd.Flags().String(flagGRPCWebAddress, serverconfig.DefaultGRPCWebAddress, "The gRPC-Web server address to listen on")
|
||||
|
||||
cmd.Flags().Uint64(FlagStateSyncSnapshotInterval, 0, "State sync snapshot interval")
|
||||
cmd.Flags().Uint32(FlagStateSyncSnapshotKeepRecent, 2, "State sync snapshot to keep")
|
||||
@ -364,7 +361,11 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App
|
||||
return err
|
||||
}
|
||||
|
||||
var apiSrv *api.Server
|
||||
var (
|
||||
apiSrv *api.Server
|
||||
grpcSrv *grpc.Server
|
||||
)
|
||||
|
||||
if config.API.Enable {
|
||||
genDoc, err := genDocProvider()
|
||||
if err != nil {
|
||||
@ -407,9 +408,17 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App
|
||||
|
||||
clientCtx = clientCtx.WithGRPCClient(grpcClient)
|
||||
ctx.Logger.Debug("grpc client assigned to client context", "target", grpcAddress)
|
||||
|
||||
// start grpc server
|
||||
grpcSrv, err = servergrpc.StartGRPCServer(clientCtx, app, config.GRPC)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer grpcSrv.Stop()
|
||||
}
|
||||
|
||||
apiSrv = api.New(clientCtx, ctx.Logger.With("module", "api-server"))
|
||||
// configure api server
|
||||
apiSrv = api.New(clientCtx, ctx.Logger.With("module", "api-server"), grpcSrv)
|
||||
app.RegisterAPIRoutes(apiSrv, config.API)
|
||||
if config.Telemetry.Enabled {
|
||||
apiSrv.SetTelemetry(metrics)
|
||||
@ -430,31 +439,6 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
grpcSrv *grpc.Server
|
||||
grpcWebSrv *http.Server
|
||||
)
|
||||
|
||||
if config.GRPC.Enable {
|
||||
grpcSrv, err = servergrpc.StartGRPCServer(clientCtx, app, config.GRPC)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer grpcSrv.Stop()
|
||||
if config.GRPCWeb.Enable {
|
||||
grpcWebSrv, err = servergrpc.StartGRPCWeb(grpcSrv, config)
|
||||
if err != nil {
|
||||
ctx.Logger.Error("failed to start grpc-web http server: ", err)
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
if err := grpcWebSrv.Close(); err != nil {
|
||||
ctx.Logger.Error("failed to close grpc-web http server: ", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
// At this point it is safe to block the process if we're in gRPC only mode as
|
||||
// we do not need to handle any Tendermint related processes.
|
||||
if gRPCOnly {
|
||||
|
||||
@ -382,7 +382,7 @@ func TestInterceptConfigsPreRunHandlerPrecedenceConfigDefault(t *testing.T) {
|
||||
t.Fatalf("function failed with [%T] %v", err, err)
|
||||
}
|
||||
|
||||
if "tcp://127.0.0.1:26657" != serverCtx.Config.RPC.ListenAddress { //nolint:stylecheck
|
||||
if serverCtx.Config.RPC.ListenAddress != "tcp://127.0.0.1:26657" {
|
||||
t.Error("RPCListenAddress is not using default")
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ func addTestnetFlagsToCmd(cmd *cobra.Command) {
|
||||
cmd.Flags().String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for")
|
||||
|
||||
// support old flags name for backwards compatibility
|
||||
cmd.PersistentFlags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||
cmd.Flags().SetNormalizeFunc(func(f *pflag.FlagSet, name string) pflag.NormalizedName {
|
||||
if name == "algo" {
|
||||
name = flags.FlagKeyType
|
||||
}
|
||||
|
||||
@ -375,12 +375,6 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
|
||||
appCfg.GRPC.Address = fmt.Sprintf("0.0.0.0:%s", grpcPort)
|
||||
}
|
||||
appCfg.GRPC.Enable = true
|
||||
|
||||
_, grpcWebPort, err := FreeTCPAddr()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
appCfg.GRPCWeb.Address = fmt.Sprintf("0.0.0.0:%s", grpcWebPort)
|
||||
appCfg.GRPCWeb.Enable = true
|
||||
}
|
||||
|
||||
|
||||
@ -76,8 +76,17 @@ func startInProcess(cfg Config, val *Validator) error {
|
||||
app.RegisterNodeService(val.ClientCtx)
|
||||
}
|
||||
|
||||
if val.AppConfig.GRPC.Enable {
|
||||
grpcSrv, err := servergrpc.StartGRPCServer(val.ClientCtx, app, val.AppConfig.GRPC)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
val.grpc = grpcSrv
|
||||
}
|
||||
|
||||
if val.APIAddress != "" {
|
||||
apiSrv := api.New(val.ClientCtx, logger.With("module", "api-server"))
|
||||
apiSrv := api.New(val.ClientCtx, logger.With("module", "api-server"), val.grpc)
|
||||
app.RegisterAPIRoutes(apiSrv, val.AppConfig.API)
|
||||
|
||||
errCh := make(chan error)
|
||||
@ -97,21 +106,6 @@ func startInProcess(cfg Config, val *Validator) error {
|
||||
val.api = apiSrv
|
||||
}
|
||||
|
||||
if val.AppConfig.GRPC.Enable {
|
||||
grpcSrv, err := servergrpc.StartGRPCServer(val.ClientCtx, app, val.AppConfig.GRPC)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
val.grpc = grpcSrv
|
||||
|
||||
if val.AppConfig.GRPCWeb.Enable {
|
||||
val.grpcWeb, err = servergrpc.StartGRPCWeb(grpcSrv, *val.AppConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
227
tools/confix/data/v0.48-app.toml
Normal file
227
tools/confix/data/v0.48-app.toml
Normal file
@ -0,0 +1,227 @@
|
||||
# This is a TOML config file.
|
||||
# For more information, see https://github.com/toml-lang/toml
|
||||
|
||||
###############################################################################
|
||||
### Base Configuration ###
|
||||
###############################################################################
|
||||
|
||||
# The minimum gas prices a validator is willing to accept for processing a
|
||||
# transaction. A transaction's fees must meet the minimum of any denomination
|
||||
# specified in this config (e.g. 0.25token1;0.0001token2).
|
||||
minimum-gas-prices = "0stake"
|
||||
|
||||
# default: the last 362880 states are kept, pruning at 10 block intervals
|
||||
# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node)
|
||||
# everything: 2 latest states will be kept; pruning at 10 block intervals.
|
||||
# custom: allow pruning options to be manually specified through 'pruning-keep-recent', and 'pruning-interval'
|
||||
pruning = "default"
|
||||
|
||||
# These are applied if and only if the pruning strategy is custom.
|
||||
pruning-keep-recent = "0"
|
||||
pruning-interval = "0"
|
||||
|
||||
# HaltHeight contains a non-zero block height at which a node will gracefully
|
||||
# halt and shutdown that can be used to assist upgrades and testing.
|
||||
#
|
||||
# Note: Commitment of state will be attempted on the corresponding block.
|
||||
halt-height = 0
|
||||
|
||||
# HaltTime contains a non-zero minimum block time (in Unix seconds) at which
|
||||
# a node will gracefully halt and shutdown that can be used to assist upgrades
|
||||
# and testing.
|
||||
#
|
||||
# Note: Commitment of state will be attempted on the corresponding block.
|
||||
halt-time = 0
|
||||
|
||||
# MinRetainBlocks defines the minimum block height offset from the current
|
||||
# block being committed, such that all blocks past this offset are pruned
|
||||
# from Tendermint. It is used as part of the process of determining the
|
||||
# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates
|
||||
# that no blocks should be pruned.
|
||||
#
|
||||
# This configuration value is only responsible for pruning Tendermint blocks.
|
||||
# It has no bearing on application state pruning which is determined by the
|
||||
# "pruning-*" configurations.
|
||||
#
|
||||
# Note: Tendermint block pruning is dependant on this parameter in conunction
|
||||
# with the unbonding (safety threshold) period, state pruning and state sync
|
||||
# snapshot parameters to determine the correct minimum value of
|
||||
# ResponseCommit.RetainHeight.
|
||||
min-retain-blocks = 0
|
||||
|
||||
# InterBlockCache enables inter-block caching.
|
||||
inter-block-cache = true
|
||||
|
||||
# IndexEvents defines the set of events in the form {eventType}.{attributeKey},
|
||||
# which informs Tendermint what to index. If empty, all events will be indexed.
|
||||
#
|
||||
# Example:
|
||||
# ["message.sender", "message.recipient"]
|
||||
index-events = []
|
||||
|
||||
# IavlCacheSize set the size of the iavl tree cache.
|
||||
# Default cache size is 50mb.
|
||||
iavl-cache-size = 781250
|
||||
|
||||
# IAVLDisableFastNode enables or disables the fast node feature of IAVL.
|
||||
# Default is false.
|
||||
iavl-disable-fastnode = false
|
||||
|
||||
# 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.
|
||||
# Second fallback (if the types.DBBackend also isn't set), is the db-backend value set in Tendermint's config.toml.
|
||||
app-db-backend = ""
|
||||
|
||||
###############################################################################
|
||||
### Telemetry Configuration ###
|
||||
###############################################################################
|
||||
|
||||
[telemetry]
|
||||
|
||||
# Prefixed with keys to separate services.
|
||||
service-name = ""
|
||||
|
||||
# Enabled enables the application telemetry functionality. When enabled,
|
||||
# an in-memory sink is also enabled by default. Operators may also enabled
|
||||
# other sinks such as Prometheus.
|
||||
enabled = false
|
||||
|
||||
# Enable prefixing gauge values with hostname.
|
||||
enable-hostname = false
|
||||
|
||||
# Enable adding hostname to labels.
|
||||
enable-hostname-label = false
|
||||
|
||||
# Enable adding service to labels.
|
||||
enable-service-label = false
|
||||
|
||||
# PrometheusRetentionTime, when positive, enables a Prometheus metrics sink.
|
||||
prometheus-retention-time = 0
|
||||
|
||||
# GlobalLabels defines a global set of name/value label tuples applied to all
|
||||
# metrics emitted using the wrapper functions defined in telemetry package.
|
||||
#
|
||||
# Example:
|
||||
# [["chain_id", "cosmoshub-1"]]
|
||||
global-labels = [
|
||||
]
|
||||
|
||||
###############################################################################
|
||||
### API Configuration ###
|
||||
###############################################################################
|
||||
|
||||
[api]
|
||||
|
||||
# Enable defines if the API server should be enabled.
|
||||
enable = false
|
||||
|
||||
# Swagger defines if swagger documentation should automatically be registered.
|
||||
swagger = false
|
||||
|
||||
# Address defines the API server to listen on.
|
||||
address = "tcp://localhost:1317"
|
||||
|
||||
# MaxOpenConnections defines the number of maximum open connections.
|
||||
max-open-connections = 1000
|
||||
|
||||
# RPCReadTimeout defines the Tendermint RPC read timeout (in seconds).
|
||||
rpc-read-timeout = 10
|
||||
|
||||
# RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds).
|
||||
rpc-write-timeout = 0
|
||||
|
||||
# RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes).
|
||||
rpc-max-body-bytes = 1000000
|
||||
|
||||
# EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk).
|
||||
enabled-unsafe-cors = false
|
||||
|
||||
###############################################################################
|
||||
### gRPC Configuration ###
|
||||
###############################################################################
|
||||
|
||||
[grpc]
|
||||
|
||||
# Enable defines if the gRPC server should be enabled.
|
||||
enable = true
|
||||
|
||||
# Address defines the gRPC server address to bind to.
|
||||
address = "localhost:9090"
|
||||
|
||||
# MaxRecvMsgSize defines the max message size in bytes the server can receive.
|
||||
# The default value is 10MB.
|
||||
max-recv-msg-size = "10485760"
|
||||
|
||||
# MaxSendMsgSize defines the max message size in bytes the server can send.
|
||||
# The default value is math.MaxInt32.
|
||||
max-send-msg-size = "2147483647"
|
||||
|
||||
###############################################################################
|
||||
### gRPC Web Configuration ###
|
||||
###############################################################################
|
||||
|
||||
[grpc-web]
|
||||
|
||||
# GRPCWebEnable defines if the gRPC-web should be enabled.
|
||||
# NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op.
|
||||
# NOTE: gRPC-Web uses the same address as the API server.
|
||||
enable = true
|
||||
|
||||
###############################################################################
|
||||
### State Sync Configuration ###
|
||||
###############################################################################
|
||||
|
||||
# State sync snapshots allow other nodes to rapidly join the network without replaying historical
|
||||
# blocks, instead downloading and applying a snapshot of the application state at a given height.
|
||||
[state-sync]
|
||||
|
||||
# snapshot-interval specifies the block interval at which local state sync snapshots are
|
||||
# taken (0 to disable).
|
||||
snapshot-interval = 0
|
||||
|
||||
# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all).
|
||||
snapshot-keep-recent = 2
|
||||
|
||||
###############################################################################
|
||||
### Store / State Streaming ###
|
||||
###############################################################################
|
||||
|
||||
[store]
|
||||
streamers = []
|
||||
|
||||
[streamers]
|
||||
[streamers.file]
|
||||
keys = ["*", ]
|
||||
write_dir = ""
|
||||
prefix = ""
|
||||
|
||||
# output-metadata specifies if output the metadata file which includes the abci request/responses
|
||||
# during processing the block.
|
||||
output-metadata = "true"
|
||||
|
||||
# stop-node-on-error specifies if propagate the file streamer errors to consensus state machine.
|
||||
stop-node-on-error = "true"
|
||||
|
||||
# fsync specifies if call fsync after writing the files.
|
||||
fsync = "false"
|
||||
|
||||
###############################################################################
|
||||
### Mempool ###
|
||||
###############################################################################
|
||||
|
||||
[mempool]
|
||||
# Setting max-txs to 0 will allow for a unbounded amount of transactions in the mempool.
|
||||
# Setting max_txs to negative 1 (-1) will disable transactions from being inserted into the mempool.
|
||||
# Setting max_txs to a positive number (> 0) will limit the number of transactions in the mempool, by the specified amount.
|
||||
#
|
||||
# Note, this configuration only applies to SDK built-in app-side mempool
|
||||
# implementations.
|
||||
max-txs = "5000"
|
||||
|
||||
[wasm]
|
||||
# This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries
|
||||
query_gas_limit = 300000
|
||||
# This is the number of wasm vm instances we keep cached in memory for speed-up
|
||||
# Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally
|
||||
lru_size = 0
|
||||
@ -24,8 +24,8 @@ var (
|
||||
"v0.45": NoPlan, // Confix supports only the current supported SDK version. So we do not support v0.44 -> v0.45.
|
||||
"v0.46": PlanBuilder,
|
||||
"v0.47": PlanBuilder,
|
||||
// "v0.47.x": PlanBuilder, // add specific migration in case of configuration changes in minor versions
|
||||
// "v0.48": PlanBuilder,
|
||||
"v0.48": PlanBuilder,
|
||||
// "v0.xx.x": PlanBuilder, // add specific migration in case of configuration changes in minor versions
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user