config

package
v0.0.0-sei-fork Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FuzzModeDrop is a mode in which we randomly drop reads/writes, connections or sleep
	FuzzModeDrop = iota
	// FuzzModeDelay is a mode in which we randomly sleep
	FuzzModeDelay

	// DefaultLogLevel defines a default log level as INFO.
	DefaultLogLevel = "info"

	ModeFull      = "full"
	ModeValidator = "validator"
	ModeSeed      = "seed"
)

Variables

View Source
var (
	DefaultTendermintDir = ".tendermint"
)

NOTE: Most of the structs & relevant comments + the default configuration options were used to manually generate the config.toml. Please reflect any changes made here in the defaultConfigTemplate constant in config/toml.go NOTE: libs/cli must know to look in the config dir!

Functions

func DefaultDBProvider

func DefaultDBProvider(ctx *DBContext) (dbm.DB, error)

DefaultDBProvider returns a database using the DBBackend and DBDir specified in the Config.

func EnsureRoot

func EnsureRoot(rootDir string)

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

func WriteConfigFile

func WriteConfigFile(rootDir string, config *Config) error

WriteConfigFile renders config using the template and writes it to configFilePath. This function is called by cmd/tendermint/commands/init.go

Types

type BaseConfig

type BaseConfig struct {

	// The root directory for all data.
	// This should be set in viper so it can unmarshal into this struct
	RootDir string `mapstructure:"home"`

	// TCP or UNIX socket address of the ABCI application,
	// or the name of an ABCI application compiled in with the Tendermint binary
	ProxyApp string `mapstructure:"proxy-app"`

	// A custom human readable name for this node
	Moniker string `mapstructure:"moniker"`

	// Mode of Node: full | validator | seed
	// * validator
	//   - all reactors
	//   - with priv_validator_key.json, priv_validator_state.json
	// * full
	//   - all reactors
	//   - No priv_validator_key.json, priv_validator_state.json
	// * seed
	//   - only P2P, PEX Reactor
	//   - No priv_validator_key.json, priv_validator_state.json
	Mode string `mapstructure:"mode"`

	// Database backend: goleveldb | cleveldb | boltdb | rocksdb
	// * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
	//   - pure go
	//   - stable
	// * cleveldb (uses levigo wrapper)
	//   - fast
	//   - requires gcc
	//   - use cleveldb build tag (go build -tags cleveldb)
	// * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt)
	//   - EXPERIMENTAL
	//   - may be faster is some use-cases (random reads - indexer)
	//   - use boltdb build tag (go build -tags boltdb)
	// * rocksdb (uses github.com/tecbot/gorocksdb)
	//   - EXPERIMENTAL
	//   - requires gcc
	//   - use rocksdb build tag (go build -tags rocksdb)
	// * badgerdb (uses github.com/dgraph-io/badger)
	//   - EXPERIMENTAL
	//   - use badgerdb build tag (go build -tags badgerdb)
	DBBackend string `mapstructure:"db-backend"`

	// Database directory
	DBPath string `mapstructure:"db-dir"`

	// Output level for logging
	LogLevel string `mapstructure:"log-level"`

	// Output format: 'plain' (colored text) or 'json'
	LogFormat string `mapstructure:"log-format"`

	// Path to the JSON file containing the initial validator set and other meta data
	Genesis string `mapstructure:"genesis-file"`

	// A JSON file containing the private key to use for p2p authenticated encryption
	NodeKey string `mapstructure:"node-key-file"`

	// Mechanism to connect to the ABCI application: socket | grpc
	ABCI string `mapstructure:"abci"`

	// If true, query the ABCI app on connecting to a new peer
	// so the app can decide if we should keep the connection or not
	FilterPeers bool `mapstructure:"filter-peers"` // false

	Other map[string]interface{} `mapstructure:",remain"`
	// contains filtered or unexported fields
}

BaseConfig defines the base configuration for a Tendermint node

func DefaultBaseConfig

func DefaultBaseConfig() BaseConfig

DefaultBaseConfig returns a default base configuration for a Tendermint node

func TestBaseConfig

func TestBaseConfig() BaseConfig

TestBaseConfig returns a base configuration for testing a Tendermint node

func (BaseConfig) ChainID

func (cfg BaseConfig) ChainID() string

func (BaseConfig) DBDir

func (cfg BaseConfig) DBDir() string

DBDir returns the full path to the database directory

func (BaseConfig) GenesisFile

func (cfg BaseConfig) GenesisFile() string

GenesisFile returns the full path to the genesis.json file

func (BaseConfig) LoadNodeKeyID

func (cfg BaseConfig) LoadNodeKeyID() (types.NodeID, error)

LoadNodeKey loads NodeKey located in filePath.

func (BaseConfig) LoadOrGenNodeKeyID

func (cfg BaseConfig) LoadOrGenNodeKeyID() (types.NodeID, error)

LoadOrGenNodeKey attempts to load the NodeKey from the given filePath. If the file does not exist, it generates and saves a new NodeKey.

func (BaseConfig) NodeKeyFile

func (cfg BaseConfig) NodeKeyFile() string

NodeKeyFile returns the full path to the node_key.json file

func (BaseConfig) ValidateBasic

func (cfg BaseConfig) ValidateBasic() error

ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.

type Config

type Config struct {
	// Top level options use an anonymous struct
	BaseConfig `mapstructure:",squash"`

	// Options for services
	RPC             *RPCConfig             `mapstructure:"rpc"`
	P2P             *P2PConfig             `mapstructure:"p2p"`
	Mempool         *MempoolConfig         `mapstructure:"mempool"`
	StateSync       *StateSyncConfig       `mapstructure:"statesync"`
	Consensus       *ConsensusConfig       `mapstructure:"consensus"`
	TxIndex         *TxIndexConfig         `mapstructure:"tx-index"`
	Instrumentation *InstrumentationConfig `mapstructure:"instrumentation"`
	PrivValidator   *PrivValidatorConfig   `mapstructure:"priv-validator"`
	SelfRemediation *SelfRemediationConfig `mapstructure:"self-remediation"`
	DBSync          *DBSyncConfig          `mapstructure:"db-sync"`
}

Config defines the top level configuration for a Tendermint node

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration for a Tendermint node

func DefaultValidatorConfig

func DefaultValidatorConfig() *Config

DefaultValidatorConfig returns default config with mode as validator

func ResetTestRoot

func ResetTestRoot(dir, testName string) (*Config, error)

func ResetTestRootWithChainID

func ResetTestRootWithChainID(dir, testName string, chainID string) (*Config, error)

func TestConfig

func TestConfig() *Config

TestConfig returns a configuration that can be used for testing

func (*Config) DeprecatedFieldWarning

func (cfg *Config) DeprecatedFieldWarning() error

func (*Config) SetRoot

func (cfg *Config) SetRoot(root string) *Config

SetRoot sets the RootDir for all Config structs

func (*Config) ValidateBasic

func (cfg *Config) ValidateBasic() error

ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.

func (*Config) WriteToTemplate

func (cfg *Config) WriteToTemplate(path string) error

WriteToTemplate writes the config to the exact file specified by the path, in the default toml template and does not mangle the path or filename at all.

type ConsensusConfig

type ConsensusConfig struct {
	RootDir string `mapstructure:"home"`
	WalPath string `mapstructure:"wal-file"`

	// EmptyBlocks mode and possible interval between empty blocks
	CreateEmptyBlocks         bool          `mapstructure:"create-empty-blocks"`
	CreateEmptyBlocksInterval time.Duration `mapstructure:"create-empty-blocks-interval"`
	// Send transaction hash only
	GossipTransactionKeyOnly bool `mapstructure:"gossip-tx-key-only"`

	// Reactor sleep duration parameters
	PeerGossipSleepDuration     time.Duration `mapstructure:"peer-gossip-sleep-duration"`
	PeerQueryMaj23SleepDuration time.Duration `mapstructure:"peer-query-maj23-sleep-duration"`

	DoubleSignCheckHeight int64 `mapstructure:"double-sign-check-height"`

	// UnsafeProposeTimeoutOverride provides an unsafe override of the Propose
	// timeout consensus parameter. It configures how long the consensus engine
	// will wait to receive a proposal block before prevoting nil.
	UnsafeProposeTimeoutOverride time.Duration `mapstructure:"unsafe-propose-timeout-override"`
	// UnsafeProposeTimeoutDeltaOverride provides an unsafe override of the
	// ProposeDelta timeout consensus parameter. It configures how much the
	// propose timeout increases with each round.
	UnsafeProposeTimeoutDeltaOverride time.Duration `mapstructure:"unsafe-propose-timeout-delta-override"`
	// UnsafeVoteTimeoutOverride provides an unsafe override of the Vote timeout
	// consensus parameter. It configures how long the consensus engine will wait
	// to gather additional votes after receiving +2/3 votes in a round.
	UnsafeVoteTimeoutOverride time.Duration `mapstructure:"unsafe-vote-timeout-override"`
	// UnsafeVoteTimeoutDeltaOverride provides an unsafe override of the VoteDelta
	// timeout consensus parameter. It configures how much the vote timeout
	// increases with each round.
	UnsafeVoteTimeoutDeltaOverride time.Duration `mapstructure:"unsafe-vote-timeout-delta-override"`
	// UnsafeCommitTimeoutOverride provides an unsafe override of the Commit timeout
	// consensus parameter. It configures how long the consensus engine will wait
	// after receiving +2/3 precommits before beginning the next height.
	UnsafeCommitTimeoutOverride time.Duration `mapstructure:"unsafe-commit-timeout-override"`

	// UnsafeBypassCommitTimeoutOverride provides an unsafe override of the
	// BypassCommitTimeout consensus parameter. It configures if the consensus
	// engine will wait for the full Commit timeout before proceeding to the next height.
	// If it is set to true, the consensus engine will proceed to the next height
	// as soon as the node has gathered votes from all of the validators on the network.
	UnsafeBypassCommitTimeoutOverride *bool `mapstructure:"unsafe-bypass-commit-timeout-override"`

	// Deprecated timeout parameters. These parameters are present in this struct
	// so that they can be parsed so that validation can check if they have erroneously
	// been included and provide a helpful error message.
	// These fields should be completely removed in v0.37.
	// See: https://github.com/tendermint/tendermint/issues/8188
	DeprecatedTimeoutPropose        *interface{} `mapstructure:"timeout-propose"`
	DeprecatedTimeoutProposeDelta   *interface{} `mapstructure:"timeout-propose-delta"`
	DeprecatedTimeoutPrevote        *interface{} `mapstructure:"timeout-prevote"`
	DeprecatedTimeoutPrevoteDelta   *interface{} `mapstructure:"timeout-prevote-delta"`
	DeprecatedTimeoutPrecommit      *interface{} `mapstructure:"timeout-precommit"`
	DeprecatedTimeoutPrecommitDelta *interface{} `mapstructure:"timeout-precommit-delta"`
	DeprecatedTimeoutCommit         *interface{} `mapstructure:"timeout-commit"`
	DeprecatedSkipTimeoutCommit     *interface{} `mapstructure:"skip-timeout-commit"`
	// contains filtered or unexported fields
}

ConsensusConfig defines the configuration for the Tendermint consensus service, including timeouts and details about the WAL and the block structure.

func DefaultConsensusConfig

func DefaultConsensusConfig() *ConsensusConfig

DefaultConsensusConfig returns a default configuration for the consensus service

func TestConsensusConfig

func TestConsensusConfig() *ConsensusConfig

TestConsensusConfig returns a configuration for testing the consensus service

func (*ConsensusConfig) DeprecatedFieldWarning

func (cfg *ConsensusConfig) DeprecatedFieldWarning() error

func (*ConsensusConfig) SetWalFile

func (cfg *ConsensusConfig) SetWalFile(walFile string)

SetWalFile sets the path to the write-ahead log file

func (*ConsensusConfig) ValidateBasic

func (cfg *ConsensusConfig) ValidateBasic() error

ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.

func (*ConsensusConfig) WaitForTxs

func (cfg *ConsensusConfig) WaitForTxs() bool

WaitForTxs returns true if the consensus should wait for transactions before entering the propose step

func (*ConsensusConfig) WalFile

func (cfg *ConsensusConfig) WalFile() string

WalFile returns the full path to the write-ahead log file

type DBContext

type DBContext struct {
	ID     string
	Config *Config
}

DBContext specifies config information for loading a new DB.

type DBProvider

type DBProvider func(*DBContext) (dbm.DB, error)

DBProvider takes a DBContext and returns an instantiated DB.

type DBSyncConfig

type DBSyncConfig struct {
	// When true, the node will try to import DB files that overwrite its
	// application DB. Note that it will NOT automatically detect whether
	// the application DB is good-to-go or not upon start, and will always
	// perform the import, so if the import is complete, this flag should
	// be turned off the next time the chain restarts.
	Enable bool `mapstructure:"db-sync-enable"`
	// This is NOT currently used but reserved for future implementation
	// of snapshotting logics that don't require chain halts.
	SnapshotInterval        int           `mapstructure:"snapshot-interval"`
	SnapshotDirectory       string        `mapstructure:"snapshot-directory"`
	SnapshotWorkerCount     int           `mapstructure:"snapshot-worker-count"`
	TimeoutInSeconds        int           `mapstructure:"timeout-in-seconds"`
	NoFileSleepInSeconds    int           `mapstructure:"no-file-sleep-in-seconds"`
	FileWorkerCount         int           `mapstructure:"file-worker-count"`
	FileWorkerTimeout       int           `mapstructure:"file-worker-timeout"`
	TrustHeight             int64         `mapstructure:"trust-height"`
	TrustHash               string        `mapstructure:"trust-hash"`
	TrustPeriod             time.Duration `mapstructure:"trust-period"`
	VerifyLightBlockTimeout time.Duration `mapstructure:"verify-light-block-timeout"`
	BlacklistTTL            time.Duration `mapstructure:"blacklist-ttl"`
}

func DefaultDBSyncConfig

func DefaultDBSyncConfig() *DBSyncConfig

func (*DBSyncConfig) TrustHashBytes

func (cfg *DBSyncConfig) TrustHashBytes() []byte

type InstrumentationConfig

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"`

	// Maximum number of simultaneous connections.
	// If you want to accept a larger number than the default, make sure
	// you increase your OS limits.
	// 0 - unlimited.
	MaxOpenConnections int `mapstructure:"max-open-connections"`

	// Instrumentation namespace.
	Namespace string `mapstructure:"namespace"`
}

InstrumentationConfig defines the configuration for metrics reporting.

func DefaultInstrumentationConfig

func DefaultInstrumentationConfig() *InstrumentationConfig

DefaultInstrumentationConfig returns a default configuration for metrics reporting.

func TestInstrumentationConfig

func TestInstrumentationConfig() *InstrumentationConfig

TestInstrumentationConfig returns a default configuration for metrics reporting.

func (*InstrumentationConfig) ValidateBasic

func (cfg *InstrumentationConfig) ValidateBasic() error

ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.

type MempoolConfig

type MempoolConfig struct {
	RootDir string `mapstructure:"home"`

	// Whether to broadcast transactions to other nodes
	Broadcast bool `mapstructure:"broadcast"`

	// Maximum number of transactions in the mempool
	Size int `mapstructure:"size"`

	// Limit the total size of all txs in the mempool.
	// This only accounts for raw transactions (e.g. given 1MB transactions and
	// max-txs-bytes=5MB, mempool will only accept 5 transactions).
	MaxTxsBytes int64 `mapstructure:"max-txs-bytes"`

	// Size of the cache (used to filter transactions we saw earlier) in transactions
	CacheSize int `mapstructure:"cache-size"`

	// Do not remove invalid transactions from the cache (default: false)
	// Set to true if it's not possible for any invalid transaction to become
	// valid again in the future.
	KeepInvalidTxsInCache bool `mapstructure:"keep-invalid-txs-in-cache"`

	// Maximum size of a single transaction
	// NOTE: the max size of a tx transmitted over the network is {max-tx-bytes}.
	MaxTxBytes int `mapstructure:"max-tx-bytes"`

	// Maximum size of a batch of transactions to send to a peer
	// Including space needed by encoding (one varint per transaction).
	// XXX: Unused due to https://github.com/tendermint/tendermint/issues/5796
	MaxBatchBytes int `mapstructure:"max-batch-bytes"`

	// TTLDuration, if non-zero, defines the maximum amount of time a transaction
	// can exist for in the mempool.
	//
	// Note, if TTLNumBlocks is also defined, a transaction will be removed if it
	// has existed in the mempool at least TTLNumBlocks number of blocks or if it's
	// insertion time into the mempool is beyond TTLDuration.
	TTLDuration time.Duration `mapstructure:"ttl-duration"`

	// TTLNumBlocks, if non-zero, defines the maximum number of blocks a transaction
	// can exist for in the mempool.
	//
	// Note, if TTLDuration is also defined, a transaction will be removed if it
	// has existed in the mempool at least TTLNumBlocks number of blocks or if
	// it's insertion time into the mempool is beyond TTLDuration.
	TTLNumBlocks int64 `mapstructure:"ttl-num-blocks"`

	// TxNotifyThreshold, if non-zero, defines the minimum number of transactions
	// needed to trigger a notification in mempool's Tx notifier
	TxNotifyThreshold uint64 `mapstructure:"tx-notify-threshold"`

	// If a peer has sent more transactions failing CheckTx than this threshold,
	// blacklist the peer.
	CheckTxErrorBlacklistEnabled bool `mapstructure:"check-tx-error-blacklist-enabled"`
	CheckTxErrorThreshold        int  `mapstructure:"check-tx-error-threshold"`
}

MempoolConfig defines the configuration options for the Tendermint mempool.

func DefaultMempoolConfig

func DefaultMempoolConfig() *MempoolConfig

DefaultMempoolConfig returns a default configuration for the Tendermint mempool.

func TestMempoolConfig

func TestMempoolConfig() *MempoolConfig

TestMempoolConfig returns a configuration for testing the Tendermint mempool

func (*MempoolConfig) ValidateBasic

func (cfg *MempoolConfig) ValidateBasic() error

ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.

type P2PConfig

type P2PConfig struct {
	RootDir string `mapstructure:"home"`

	// Address to listen for incoming connections
	ListenAddress string `mapstructure:"laddr"`

	// Address to advertise to peers for them to dial
	ExternalAddress string `mapstructure:"external-address"`

	// Comma separated list of peers to be added to the peer store
	// on startup. Either BootstrapPeers or PersistentPeers are
	// needed for peer discovery
	BootstrapPeers string `mapstructure:"bootstrap-peers"`

	// Comma separated list of nodes to keep persistent connections to
	PersistentPeers string `mapstructure:"persistent-peers"`

	// UPNP port forwarding
	UPNP bool `mapstructure:"upnp"`

	// MaxConnections defines the maximum number of connected peers (inbound and
	// outbound).
	MaxConnections uint16 `mapstructure:"max-connections"`

	// MaxIncomingConnectionAttempts rate limits the number of incoming connection
	// attempts per IP address.
	MaxIncomingConnectionAttempts uint `mapstructure:"max-incoming-connection-attempts"`

	// Set true to enable the peer-exchange reactor
	PexReactor bool `mapstructure:"pex"`

	// Comma separated list of peer IDs to keep private (will not be gossiped to
	// other peers)
	PrivatePeerIDs string `mapstructure:"private-peer-ids"`

	// Toggle to disable guard against peers connecting from the same ip.
	AllowDuplicateIP bool `mapstructure:"allow-duplicate-ip"`

	// Time to wait before flushing messages out on the connection
	FlushThrottleTimeout time.Duration `mapstructure:"flush-throttle-timeout"`

	// Maximum size of a message packet payload, in bytes
	MaxPacketMsgPayloadSize int `mapstructure:"max-packet-msg-payload-size"`

	// Rate at which packets can be sent, in bytes/second
	SendRate int64 `mapstructure:"send-rate"`

	// Rate at which packets can be received, in bytes/second
	RecvRate int64 `mapstructure:"recv-rate"`

	// Peer connection configuration.
	HandshakeTimeout time.Duration `mapstructure:"handshake-timeout"`
	DialTimeout      time.Duration `mapstructure:"dial-timeout"`

	// Testing params.
	// Force dial to fail
	TestDialFail bool `mapstructure:"test-dial-fail"`

	// Makes it possible to configure which queue backend the p2p
	// layer uses. Options are: "fifo" and "priority",
	// with the default being "priority".
	QueueType string `mapstructure:"queue-type"`

	// List of node IDs, to which a connection will be (re)established ignoring any existing limits
	UnconditionalPeerIDs string `mapstructure:"unconditional-peer-ids"`
}

P2PConfig defines the configuration options for the Tendermint peer-to-peer networking layer

func DefaultP2PConfig

func DefaultP2PConfig() *P2PConfig

DefaultP2PConfig returns a default configuration for the peer-to-peer layer

func TestP2PConfig

func TestP2PConfig() *P2PConfig

TestP2PConfig returns a configuration for testing the peer-to-peer layer

func (*P2PConfig) ValidateBasic

func (cfg *P2PConfig) ValidateBasic() error

ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.

type PrivValidatorConfig

type PrivValidatorConfig struct {
	RootDir string `mapstructure:"home"`

	// Path to the JSON file containing the private key to use as a validator in the consensus protocol
	Key string `mapstructure:"key-file"`

	// Path to the JSON file containing the last sign state of a validator
	State string `mapstructure:"state-file"`

	// TCP or UNIX socket address for Tendermint to listen on for
	// connections from an external PrivValidator process
	ListenAddr string `mapstructure:"laddr"`

	// Client certificate generated while creating needed files for secure connection.
	// If a remote validator address is provided but no certificate, the connection will be insecure
	ClientCertificate string `mapstructure:"client-certificate-file"`

	// Client key generated while creating certificates for secure connection
	ClientKey string `mapstructure:"client-key-file"`

	// Path Root Certificate Authority used to sign both client and server certificates
	RootCA string `mapstructure:"root-ca-file"`
}

PrivValidatorConfig defines the configuration parameters for running a validator

func DefaultPrivValidatorConfig

func DefaultPrivValidatorConfig() *PrivValidatorConfig

DefaultBaseConfig returns a default private validator configuration for a Tendermint node.

func (*PrivValidatorConfig) AreSecurityOptionsPresent

func (cfg *PrivValidatorConfig) AreSecurityOptionsPresent() bool

func (*PrivValidatorConfig) ClientCertificateFile

func (cfg *PrivValidatorConfig) ClientCertificateFile() string

ClientCertificateFile returns the full path to the priv_validator_key.json file

func (*PrivValidatorConfig) ClientKeyFile

func (cfg *PrivValidatorConfig) ClientKeyFile() string

ClientKeyFile returns the full path to the priv_validator_key.json file

func (*PrivValidatorConfig) KeyFile

func (cfg *PrivValidatorConfig) KeyFile() string

KeyFile returns the full path to the priv_validator_key.json file

func (*PrivValidatorConfig) RootCAFile

func (cfg *PrivValidatorConfig) RootCAFile() string

CertificateAuthorityFile returns the full path to the priv_validator_key.json file

func (*PrivValidatorConfig) StateFile

func (cfg *PrivValidatorConfig) StateFile() string

StateFile returns the full path to the priv_validator_state.json file

type RPCConfig

type RPCConfig struct {
	RootDir string `mapstructure:"home"`

	// TCP or UNIX socket address for the RPC server to listen on
	ListenAddress string `mapstructure:"laddr"`

	// A list of origins a cross-domain request can be executed from.
	// If the special '*' value is present in the list, all origins will be allowed.
	// An origin may contain a wildcard (*) to replace 0 or more characters (i.e.: http://*.domain.com).
	// Only one wildcard can be used per origin.
	CORSAllowedOrigins []string `mapstructure:"cors-allowed-origins"`

	// A list of methods the client is allowed to use with cross-domain requests.
	CORSAllowedMethods []string `mapstructure:"cors-allowed-methods"`

	// A list of non simple headers the client is allowed to use with cross-domain requests.
	CORSAllowedHeaders []string `mapstructure:"cors-allowed-headers"`

	// Activate unsafe RPC commands like /dial-persistent-peers and /unsafe-flush-mempool
	Unsafe bool `mapstructure:"unsafe"`

	// Maximum number of simultaneous connections (including WebSocket).
	// 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 `mapstructure:"max-open-connections"`

	// Maximum number of unique clientIDs that can /subscribe
	// If you're using /broadcast_tx_commit, set to the estimated maximum number
	// of broadcast_tx_commit calls per block.
	MaxSubscriptionClients int `mapstructure:"max-subscription-clients"`

	// Maximum number of unique queries a given client can /subscribe to
	// If you're using a Local RPC client and /broadcast_tx_commit, set this
	// to the estimated maximum number of broadcast_tx_commit calls per block.
	MaxSubscriptionsPerClient int `mapstructure:"max-subscriptions-per-client"`

	// If true, disable the websocket interface to the RPC service.  This has
	// the effect of disabling the /subscribe, /unsubscribe, and /unsubscribe_all
	// methods for event subscription.
	//
	// EXPERIMENTAL: This setting will be removed in Tendermint v0.37.
	ExperimentalDisableWebsocket bool `mapstructure:"experimental-disable-websocket"`

	// The time window size for the event log. All events up to this long before
	// the latest (up to EventLogMaxItems) will be available for subscribers to
	// fetch via the /events method.  If 0 (the default) the event log and the
	// /events RPC method are disabled.
	EventLogWindowSize time.Duration `mapstructure:"event-log-window-size"`

	// The maxiumum number of events that may be retained by the event log.  If
	// this value is 0, no upper limit is set. Otherwise, items in excess of
	// this number will be discarded from the event log.
	//
	// Warning: This setting is a safety valve. Setting it too low may cause
	// subscribers to miss events.  Try to choose a value higher than the
	// maximum worst-case expected event load within the chosen window size in
	// ordinary operation.
	//
	// For example, if the window size is 10 minutes and the node typically
	// averages 1000 events per ten minutes, but with occasional known spikes of
	// up to 2000, choose a value > 2000.
	EventLogMaxItems int `mapstructure:"event-log-max-items"`

	// How long to wait for a tx to be committed during /broadcast_tx_commit
	// WARNING: Using a value larger than 10s will result in increasing the
	// global HTTP write timeout, which applies to all connections and endpoints.
	// See https://github.com/tendermint/tendermint/issues/3435
	TimeoutBroadcastTxCommit time.Duration `mapstructure:"timeout-broadcast-tx-commit"`

	// Maximum size of request body, in bytes
	MaxBodyBytes int64 `mapstructure:"max-body-bytes"`

	// Maximum size of request header, in bytes
	MaxHeaderBytes int `mapstructure:"max-header-bytes"`

	// 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"`

	// pprof listen address (https://golang.org/pkg/net/http/pprof)
	PprofListenAddress string `mapstructure:"pprof-laddr"`

	// Lag threshold determines the threshold for whether the /lag_status endpoint returns OK or not
	LagThreshold int64 `mapstructure:"lag-threshold"`
}

RPCConfig defines the configuration options for the Tendermint RPC server

func DefaultRPCConfig

func DefaultRPCConfig() *RPCConfig

DefaultRPCConfig returns a default configuration for the RPC server

func TestRPCConfig

func TestRPCConfig() *RPCConfig

TestRPCConfig returns a configuration for testing the RPC server

func (RPCConfig) CertFile

func (cfg RPCConfig) CertFile() string

func (*RPCConfig) IsCorsEnabled

func (cfg *RPCConfig) IsCorsEnabled() bool

IsCorsEnabled returns true if cross-origin resource sharing is enabled.

func (RPCConfig) IsTLSEnabled

func (cfg RPCConfig) IsTLSEnabled() bool

func (RPCConfig) KeyFile

func (cfg RPCConfig) KeyFile() string

func (*RPCConfig) ValidateBasic

func (cfg *RPCConfig) ValidateBasic() error

ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.

type SelfRemediationConfig

type SelfRemediationConfig struct {
	// If the node has no p2p peers available then trigger a restart
	// Set to 0 to disable
	P2pNoPeersRestarWindowSeconds uint64 `mapstructure:"p2p-no-peers-available-window-seconds"`

	// If node has no peers for statesync after a period of time then restart
	// Set to 0 to disable
	StatesyncNoPeersRestartWindowSeconds uint64 `mapstructure:"statesync-no-peers-available-window-seconds"`

	// Threshold for how far back the node can be behind the current block height before triggering a restart
	// Set to 0 to disable
	BlocksBehindThreshold uint64 `mapstructure:"blocks-behind-threshold"`

	// How often to check if node is behind in seconds
	BlocksBehindCheckIntervalSeconds uint64 `mapstructure:"blocks-behind-check-interval-seconds"`

	// Cooldown between each restart
	RestartCooldownSeconds uint64 `mapstructure:"restart-cooldown-seconds"`
}

SelfRemediationConfig defines the behaviors of self-remediation.

func DefaultSelfRemediationConfig

func DefaultSelfRemediationConfig() *SelfRemediationConfig

DefaultInstrumentationConfig returns a default configuration for metrics reporting.

func TestSelfRemediationConfig

func TestSelfRemediationConfig() *SelfRemediationConfig

func (*SelfRemediationConfig) ValidateBasic

func (cfg *SelfRemediationConfig) ValidateBasic() error

ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.

type ServiceProvider

type ServiceProvider func(context.Context, *Config, log.Logger, chan struct{}) (service.Service, error)

ServiceProvider takes a config and a logger and returns a ready to go Node.

type StateSyncConfig

type StateSyncConfig struct {
	// State sync rapidly bootstraps a new node by discovering, fetching, and restoring a
	// state machine snapshot from peers instead of fetching and replaying historical
	// blocks. Requires some peers in the network to take and serve state machine
	// snapshots. State sync is not attempted if the node has any local state
	// (LastBlockHeight > 0). The node will have a truncated block history, starting from
	// the height of the snapshot.
	Enable bool `mapstructure:"enable"`

	// State sync uses light client verification to verify state. This can be done either
	// through the P2P layer or the RPC layer. Set this to true to use the P2P layer. If
	// false (default), the RPC layer will be used.
	UseP2P bool `mapstructure:"use-p2p"`

	// If using RPC, at least two addresses need to be provided. They should be compatible
	// with net.Dial, for example: "host.example.com:2125".
	RPCServers []string `mapstructure:"rpc-servers"`

	// The hash and height of a trusted block. Must be within the trust-period.
	TrustHeight int64  `mapstructure:"trust-height"`
	TrustHash   string `mapstructure:"trust-hash"`

	// The trust period should be set so that Tendermint can detect and gossip
	// misbehavior before it is considered expired. For chains based on the Cosmos SDK,
	// one day less than the unbonding period should suffice.
	TrustPeriod time.Duration `mapstructure:"trust-period"`

	// Backfill sequentially fetches, verifies and stores light blocks in reverse order.
	// It does not stop verifying blocks until reaching a height
	// that is less or equal to the latestBlock - backfill-blocks and latest block time - backfill-duration.
	// Default: no backfill
	BackfillBlocks   int64         `mapstructure:"backfill-blocks"`
	BackfillDuration time.Duration `mapstructure:"backfill-duration"`

	// Time to spend discovering snapshots before initiating a restore.
	DiscoveryTime time.Duration `mapstructure:"discovery-time"`

	// Temporary directory for state sync snapshot chunks, defaults to os.TempDir().
	// The synchronizer will create a new, randomly named directory within this directory
	// and remove it when the sync is complete.
	TempDir string `mapstructure:"temp-dir"`

	// The timeout duration before re-requesting a chunk, possibly from a different
	// peer (default: 15 seconds).
	ChunkRequestTimeout time.Duration `mapstructure:"chunk-request-timeout"`

	// The number of concurrent chunk and block fetchers to run (default: 4).
	Fetchers int32 `mapstructure:"fetchers"`

	// Timeout before considering light block verification failed
	VerifyLightBlockTimeout time.Duration `mapstructure:"verify-light-block-timeout"`

	// Time before which a blacklisted witness can not be added back as a provider
	BlacklistTTL time.Duration `mapstructure:"blacklist-ttl"`
}

StateSyncConfig defines the configuration for the Tendermint state sync service

func DefaultStateSyncConfig

func DefaultStateSyncConfig() *StateSyncConfig

DefaultStateSyncConfig returns a default configuration for the state sync service

func TestStateSyncConfig

func TestStateSyncConfig() *StateSyncConfig

TestStateSyncConfig returns a default configuration for the state sync service

func (*StateSyncConfig) TrustHashBytes

func (cfg *StateSyncConfig) TrustHashBytes() []byte

func (*StateSyncConfig) ValidateBasic

func (cfg *StateSyncConfig) ValidateBasic() error

ValidateBasic performs basic validation.

type TxIndexConfig

type TxIndexConfig struct {
	// The backend database list to back the indexer.
	// If list contains `null`, meaning no indexer service will be used.
	//
	// Options:
	//   1) "null" (default) - no indexer services.
	//   2) "kv" - a simple indexer backed by key-value storage (see DBBackend)
	//   3) "psql" - the indexer services backed by PostgreSQL.
	Indexer []string `mapstructure:"indexer"`

	// The PostgreSQL connection configuration, the connection format:
	// postgresql://<user>:<password>@<host>:<port>/<db>?<opts>
	PsqlConn string `mapstructure:"psql-conn"`
}

----------------------------------------------------------------------------- TxIndexConfig Remember that Event has the following structure: type: [

key: value,
...

]

CompositeKeys are constructed by `type.key` TxIndexConfig defines the configuration for the transaction indexer, including composite keys to index.

func DefaultTxIndexConfig

func DefaultTxIndexConfig() *TxIndexConfig

DefaultTxIndexConfig returns a default configuration for the transaction indexer.

func TestTxIndexConfig

func TestTxIndexConfig() *TxIndexConfig

TestTxIndexConfig returns a default configuration for the transaction indexer.

Jump to

Keyboard shortcuts

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