config

package
v0.5.0-rc6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 15

Documentation

Index

Constants

View Source
const (
	// DefaultDymintDir is the default directory for dymint
	DefaultDymintDir      = ".dymint"
	DefaultConfigDirName  = "config"
	DefaultConfigFileName = "dymint.toml"
)
View Source
const (
	// DefaultListenAddress is a default listen address for P2P client.
	DefaultListenAddress = "/ip4/0.0.0.0/tcp/7676"
	// Version is a default dymint version for P2P client.
	Version = "0.2.2"

	DefaultHomeDir = "sequencer_keys"
	DefaultChainID = "dymint-testnet"
)
View Source
const DefaultDirPerm = 0o700

DefaultDirPerm is the default permissions used when creating directories.

Variables

View Source
var DefaultNodeConfig = *DefaultConfig("", "")

DefaultNodeConfig keeps default values of NodeConfig

Functions

func AddNodeFlags added in v1.1.0

func AddNodeFlags(cmd *cobra.Command)

AddFlags adds Dymint specific configuration options to cobra Command.

This function is called in cosmos-sdk.

func BindDymintFlags added in v1.1.0

func BindDymintFlags(cmd *cobra.Command, v *viper.Viper) error

func EnsureRoot added in v1.1.0

func EnsureRoot(rootDir string, defaultConfig *NodeConfig)

EnsureRoot creates the root, config, and data directories if they don't exist, and panics if it fails.

func WriteConfigFile added in v1.1.0

func WriteConfigFile(configFilePath string, config *NodeConfig)

WriteConfigFile renders config using the template and writes it to configFilePath.

Types

type BlockManagerConfig

type BlockManagerConfig struct {
	// BlockTime defines how often new blocks are produced
	BlockTime time.Duration `mapstructure:"block_time"`
	// EmptyBlocksMaxTime defines how long should block manager wait for new transactions before producing empty block
	EmptyBlocksMaxTime time.Duration `mapstructure:"empty_blocks_max_time"`
	// BatchSubmitMaxTime defines how long should block manager wait for before submitting batch
	BatchSubmitMaxTime time.Duration `mapstructure:"batch_submit_max_time"`
	NamespaceID        string        `mapstructure:"namespace_id"`
	// The size of the batch in blocks. Every batch we'll write to the DA and the settlement layer.
	BlockBatchSize uint64 `mapstructure:"block_batch_size"`
	// The size of the batch in Bytes. Every batch we'll write to the DA and the settlement layer.
	BlockBatchMaxSizeBytes uint64 `mapstructure:"block_batch_max_size_bytes"`
}

BlockManagerConfig consists of all parameters required by BlockManagerConfig

func (BlockManagerConfig) Validate added in v1.1.0

func (c BlockManagerConfig) Validate() error

validate BlockManagerConfig

type InstrumentationConfig added in v1.1.0

type InstrumentationConfig struct {
	// When true, Prometheus metrics are served under /metrics on
	// PrometheusListenAddr.
	// Check out the documentation for the list of available metrics.
	Prometheus bool `mapstructure:"prometheus"`

	// Address to listen for Prometheus collector(s) connections.
	PrometheusListenAddr string `mapstructure:"prometheus_listen_addr"`
}

InstrumentationConfig defines the configuration for metrics reporting.

type NodeConfig

type NodeConfig struct {
	// parameters below are translated from existing config
	RootDir string
	DBPath  string
	P2P     P2PConfig
	RPC     RPCConfig
	// parameters below are dymint specific and read from config
	Aggregator         bool `mapstructure:"aggregator"`
	BlockManagerConfig `mapstructure:",squash"`
	DALayer            string                 `mapstructure:"da_layer"`
	DAConfig           string                 `mapstructure:"da_config"`
	SettlementLayer    string                 `mapstructure:"settlement_layer"`
	SettlementConfig   settlement.Config      `mapstructure:",squash"`
	Instrumentation    *InstrumentationConfig `mapstructure:"instrumentation"`
}

NodeConfig stores Dymint node configuration.

func DefaultConfig added in v1.1.0

func DefaultConfig(home, chainId string) *NodeConfig

DefaultConfig returns a default configuration for dymint node.

func (*NodeConfig) GetViperConfig

func (nc *NodeConfig) GetViperConfig(cmd *cobra.Command, homeDir string) error

GetViperConfig reads configuration parameters from Viper instance.

func (NodeConfig) Validate added in v1.1.0

func (c NodeConfig) Validate() error

type P2PConfig

type P2PConfig struct {
	ListenAddress string // Address to listen for incoming connections
	Seeds         string // Comma separated list of seed nodes to connect to
}

P2PConfig stores configuration related to peer-to-peer networking.

type RPCConfig

type RPCConfig struct {
	ListenAddress string

	// Cross Origin Resource Sharing settings
	CORSAllowedOrigins []string
	CORSAllowedMethods []string
	CORSAllowedHeaders []string

	// Maximum number of simultaneous connections (including WebSocket).
	// Does not include gRPC connections. See grpc-max-open-connections
	// If you want to accept a larger number than the default, make sure
	// you increase your OS limits.
	// 0 - unlimited.
	// Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files}
	// 1024 - 40 - 10 - 50 = 924 = ~900
	MaxOpenConnections int

	// The path to a file containing certificate that is used to create the HTTPS server.
	// Might be either absolute path or path related to Tendermint's config directory.
	//
	// If the certificate is signed by a certificate authority,
	// the certFile should be the concatenation of the server's certificate, any intermediates,
	// and the CA's certificate.
	//
	// NOTE: both tls-cert-file and tls-key-file must be present for Tendermint to create HTTPS server.
	// Otherwise, HTTP server is run.
	TLSCertFile string `mapstructure:"tls-cert-file"`

	// The path to a file containing matching private key that is used to create the HTTPS server.
	// Might be either absolute path or path related to tendermint's config directory.
	//
	// NOTE: both tls-cert-file and tls-key-file must be present for Tendermint to create HTTPS server.
	// Otherwise, HTTP server is run.
	TLSKeyFile string `mapstructure:"tls-key-file"`
}

RPCConfig holds RPC configuration params.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL