Documentation
¶
Index ¶
Constants ¶
const ( // DefaultGRPCAddress defines the default address to bind the gRPC server to. DefaultGRPCAddress = "0.0.0.0:9090" // DefaultGRPCWebAddress defines the default address to bind the gRPC-web server to. DefaultGRPCWebAddress = "0.0.0.0:9091" // DefaultConcurrencyWorkers defines the default workers to use for concurrent transactions DefaultConcurrencyWorkers = 20 // DefaultOccEanbled defines whether to use OCC for tx processing DefaultOccEnabled = false )
const DefaultConfigTemplate = `# 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 = "{{ .BaseConfig.MinGasPrices }}" # Pruning Strategies: # - default: Keep the recent 362880 blocks and prune is triggered every 10 blocks # - nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) # - everything: all saved states will be deleted, storing only the recent 2 blocks; pruning at every block # - custom: allow pruning options to be manually specified through 'pruning-keep-recent' and 'pruning-interval' # Pruning strategy is completely ignored when panodb is enabled pruning = "{{ .BaseConfig.Pruning }}" # These are applied if and only if the pruning strategy is custom, and panodb is not enabled pruning-keep-recent = "{{ .BaseConfig.PruningKeepRecent }}" pruning-keep-every = "{{ .BaseConfig.PruningKeepEvery }}" pruning-interval = "{{ .BaseConfig.PruningInterval }}" # 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 = {{ .BaseConfig.HaltHeight }} # 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 = {{ .BaseConfig.HaltTime }} # 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 = {{ .BaseConfig.MinRetainBlocks }} # InterBlockCache enables inter-block caching. inter-block-cache = {{ .BaseConfig.InterBlockCache }} # 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 = {{ .BaseConfig.IndexEvents }} # IavlCacheSize set the size of the iavl tree cache. # Default cache size is 50mb. iavl-cache-size = {{ .BaseConfig.IAVLCacheSize }} # IAVLDisableFastNode enables or disables the fast node feature of IAVL. # Default is true. iavl-disable-fastnode = {{ .BaseConfig.IAVLDisableFastNode }} # CompactionInterval sets (in seconds) the interval between forced levelDB # compaction. A value of 0 means no forced levelDB. # Default is 0. compaction-interval = {{ .BaseConfig.CompactionInterval }} # deprecated no-versioning = {{ .BaseConfig.NoVersioning }} # Whether to store orphan data (to-be-deleted data pointers) outside the main # application LevelDB separate-orphan-storage = {{ .BaseConfig.SeparateOrphanStorage }} # if separate-orphan-storage is true, how many versions of orphan data to keep separate-orphan-versions-to-keep = {{ .BaseConfig.SeparateOrphanVersionsToKeep }} # if separate-orphan-storage is true, how many orphans to store in each file num-orphan-per-file = {{ .BaseConfig.NumOrphanPerFile }} # if separate-orphan-storage is true, where to store orphan data orphan-dir = "{{ .BaseConfig.OrphanDirectory }}" # concurrency-workers defines how many workers to run for concurrent transaction execution # concurrency-workers = {{ .BaseConfig.ConcurrencyWorkers }} # occ-enabled defines whether OCC is enabled or not for transaction execution occ-enabled = {{ .BaseConfig.OccEnabled }} ############################################################################### ### Telemetry Configuration ### ############################################################################### [telemetry] # Prefixed with keys to separate services. service-name = "{{ .Telemetry.ServiceName }}" # 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 = {{ .Telemetry.Enabled }} # Enable prefixing gauge values with hostname. enable-hostname = {{ .Telemetry.EnableHostname }} # Enable adding hostname to labels. enable-hostname-label = {{ .Telemetry.EnableHostnameLabel }} # Enable adding service to labels. enable-service-label = {{ .Telemetry.EnableServiceLabel }} # PrometheusRetentionTime, when positive, enables a Prometheus metrics sink. prometheus-retention-time = {{ .Telemetry.PrometheusRetentionTime }} # 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 = [{{ range $k, $v := .Telemetry.GlobalLabels }} ["{{index $v 0 }}", "{{ index $v 1}}"],{{ end }} ] ############################################################################### ### API Configuration ### ############################################################################### [api] # Enable defines if the API server should be enabled. enable = {{ .API.Enable }} # Swagger defines if swagger documentation should automatically be registered. swagger = {{ .API.Swagger }} # Address defines the API server to listen on. address = "{{ .API.Address }}" # MaxOpenConnections defines the number of maximum open connections. max-open-connections = {{ .API.MaxOpenConnections }} # RPCReadTimeout defines the Tendermint RPC read timeout (in seconds). rpc-read-timeout = {{ .API.RPCReadTimeout }} # RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds). rpc-write-timeout = {{ .API.RPCWriteTimeout }} # RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes). rpc-max-body-bytes = {{ .API.RPCMaxBodyBytes }} # EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). enabled-unsafe-cors = {{ .API.EnableUnsafeCORS }} ############################################################################### ### Rosetta Configuration ### ############################################################################### [rosetta] # Enable defines if the Rosetta API server should be enabled. enable = {{ .Rosetta.Enable }} # Address defines the Rosetta API server to listen on. address = "{{ .Rosetta.Address }}" # Network defines the name of the blockchain that will be returned by Rosetta. blockchain = "{{ .Rosetta.Blockchain }}" # Network defines the name of the network that will be returned by Rosetta. network = "{{ .Rosetta.Network }}" # Retries defines the number of retries when connecting to the node before failing. retries = {{ .Rosetta.Retries }} # Offline defines if Rosetta server should run in offline mode. offline = {{ .Rosetta.Offline }} ############################################################################### ### gRPC Configuration ### ############################################################################### [grpc] # Enable defines if the gRPC server should be enabled. enable = {{ .GRPC.Enable }} # Address defines the gRPC server address to bind to. address = "{{ .GRPC.Address }}" ############################################################################### ### 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. 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 ### ############################################################################### # 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). Must be a multiple of pruning-keep-every. snapshot-interval = {{ .StateSync.SnapshotInterval }} # snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all). snapshot-keep-recent = {{ .StateSync.SnapshotKeepRecent }} # snapshot-directory sets the directory for where state sync snapshots are persisted. # default is emtpy which will then store under the app home directory same as before. snapshot-directory = "{{ .StateSync.SnapshotDirectory }}" ############################################################################### ### Genesis Configuration ### ############################################################################### # Genesis config allows configuring whether to stream from an genesis json file in streamed form [genesis] # stream-import specifies whether to the stream the import from the genesis json file. The genesis # file must be in stream form and exported in a streaming fashion. stream-import = {{ .Genesis.StreamImport }} # genesis-stream-file specifies the path of the genesis json file to stream from. genesis-stream-file = "{{ .Genesis.GenesisStreamFile }}" ` + config.DefaultConfigTemplate
Variables ¶
This section is empty.
Functions ¶
func SetConfigTemplate ¶
func SetConfigTemplate(customTemplate string)
SetConfigTemplate sets the custom app config template for the application
func WriteConfigFile ¶
func WriteConfigFile(configFilePath string, config interface{})
WriteConfigFile renders config using the template and writes it to configFilePath.
Types ¶
type APIConfig ¶
type APIConfig struct {
// Enable defines if the API server should be enabled.
Enable bool `mapstructure:"enable"`
// Swagger defines if swagger documentation should automatically be registered.
Swagger bool `mapstructure:"swagger"`
// EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk)
EnableUnsafeCORS bool `mapstructure:"enabled-unsafe-cors"`
// Address defines the API server to listen on
Address string `mapstructure:"address"`
// MaxOpenConnections defines the number of maximum open connections
MaxOpenConnections uint `mapstructure:"max-open-connections"`
// RPCReadTimeout defines the Tendermint RPC read timeout (in seconds)
RPCReadTimeout uint `mapstructure:"rpc-read-timeout"`
// RPCWriteTimeout defines the Tendermint RPC write timeout (in seconds)
RPCWriteTimeout uint `mapstructure:"rpc-write-timeout"`
// RPCMaxBodyBytes defines the Tendermint maximum response body (in bytes)
RPCMaxBodyBytes uint `mapstructure:"rpc-max-body-bytes"`
}
APIConfig defines the API listener configuration.
type BaseConfig ¶
type BaseConfig struct {
// 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).
MinGasPrices string `mapstructure:"minimum-gas-prices"`
Pruning string `mapstructure:"pruning"`
PruningKeepRecent string `mapstructure:"pruning-keep-recent"`
PruningKeepEvery string `mapstructure:"pruning-keep-every"`
PruningInterval string `mapstructure:"pruning-interval"`
// 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.
HaltHeight uint64 `mapstructure:"halt-height"`
// 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.
HaltTime uint64 `mapstructure:"halt-time"`
// MinRetainBlocks defines the minimum block height offset from the current
// block being committed, such that blocks past this offset may be 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.
MinRetainBlocks uint64 `mapstructure:"min-retain-blocks"`
// InterBlockCache enables inter-block caching.
InterBlockCache bool `mapstructure:"inter-block-cache"`
// IndexEvents defines the set of events in the form {eventType}.{attributeKey},
// which informs Tendermint what to index. If empty, all events will be indexed.
IndexEvents []string `mapstructure:"index-events"`
// IavlCacheSize set the size of the iavl tree cache.
IAVLCacheSize uint64 `mapstructure:"iavl-cache-size"`
// IAVLDisableFastNode enables or disables the fast sync node.
IAVLDisableFastNode bool `mapstructure:"iavl-disable-fastnode"`
// CompactionInterval sets (in seconds) the interval between forced levelDB
// compaction. A value of 0 means no forced levelDB
CompactionInterval uint64 `mapstructure:"compaction-interval"`
// deprecated
NoVersioning bool `mapstructure:"no-versioning"`
SeparateOrphanStorage bool `mapstructure:"separate-orphan-storage"`
SeparateOrphanVersionsToKeep int64 `mapstructure:"separate-orphan-versions-to-keep"`
NumOrphanPerFile int `mapstructure:"num-orphan-per-file"`
OrphanDirectory string `mapstructure:"orphan-dir"`
// ConcurrencyWorkers defines the number of workers to use for concurrent
// transaction execution. A value of -1 means unlimited workers. Default value is 10.
ConcurrencyWorkers int `mapstructure:"concurrency-workers"`
// Whether to enable optimistic concurrency control for tx execution, default is true
OccEnabled bool `mapstructure:"occ-enabled"`
}
BaseConfig defines the server's basic configuration
type Config ¶
type Config struct {
BaseConfig `mapstructure:",squash"`
// Telemetry defines the application telemetry configuration
Telemetry telemetry.Config `mapstructure:"telemetry"`
API APIConfig `mapstructure:"api"`
GRPC GRPCConfig `mapstructure:"grpc"`
Rosetta RosettaConfig `mapstructure:"rosetta"`
GRPCWeb GRPCWebConfig `mapstructure:"grpc-web"`
StateSync StateSyncConfig `mapstructure:"state-sync"`
StateCommit config.StateCommitConfig `mapstructure:"state-commit"`
StateStore config.StateStoreConfig `mapstructure:"state-store"`
Genesis GenesisConfig `mapstructure:genesis`
}
Config defines the server's top level configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns server's default configuration.
func ParseConfig ¶
ParseConfig retrieves the default environment configuration for the application.
func (*Config) GetMinGasPrices ¶
GetMinGasPrices returns the validator's minimum gas prices based on the set configuration.
func (*Config) SetMinGasPrices ¶
SetMinGasPrices sets the validator's minimum gas prices.
type GRPCConfig ¶
type GRPCConfig struct {
// Enable defines if the gRPC server should be enabled.
Enable bool `mapstructure:"enable"`
// Address defines the API server to listen on
Address string `mapstructure:"address"`
}
GRPCConfig defines configuration for the gRPC server.
type GRPCWebConfig ¶
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"`
}
GRPCWebConfig defines configuration for the gRPC-web server.
type GenesisConfig ¶
type GenesisConfig struct {
// StreamImport defines if the genesis.json is in stream form or not.
StreamImport bool `mapstructure:"stream-import"`
// GenesisStreamFile sets the genesis json file from which to stream from
GenesisStreamFile string `mapstructure:"genesis-stream-file"`
}
GenesisConfig defines the genesis export, validation, and import configuration
type RosettaConfig ¶
type RosettaConfig struct {
// Address defines the API server to listen on
Address string `mapstructure:"address"`
// Blockchain defines the blockchain name
// defaults to DefaultBlockchain
Blockchain string `mapstructure:"blockchain"`
// Network defines the network name
Network string `mapstructure:"network"`
// Retries defines the maximum number of retries
// rosetta will do before quitting
Retries int `mapstructure:"retries"`
// Enable defines if the API server should be enabled.
Enable bool `mapstructure:"enable"`
// Offline defines if the server must be run in offline mode
Offline bool `mapstructure:"offline"`
}
RosettaConfig defines the Rosetta API listener configuration.
type StateSyncConfig ¶
type StateSyncConfig struct {
// SnapshotInterval sets the interval at which state sync snapshots are taken.
// 0 disables snapshots. Must be a multiple of PruningKeepEvery.
SnapshotInterval uint64 `mapstructure:"snapshot-interval"`
// SnapshotKeepRecent sets the number of recent state sync snapshots to keep.
// 0 keeps all snapshots.
SnapshotKeepRecent uint32 `mapstructure:"snapshot-keep-recent"`
// SnapshotDirectory sets the parent directory for where state sync snapshots are persisted.
// Default is emtpy which will then store under the app home directory.
SnapshotDirectory string `mapstructure:"snapshot-directory"`
}
StateSyncConfig defines the state sync snapshot configuration.