Documentation ¶
Overview ¶
Package config contains go-spacemesh node configuration definitions
Index ¶
- Constants
- func LoadConfig(fileLocation string, vip *viper.Viper) (err error)
- type BaseConfig
- type Config
- type GenesisConfig
- func (g *GenesisConfig) Diff(other *GenesisConfig) string
- func (g *GenesisConfig) GenesisID() types.Hash20
- func (g *GenesisConfig) LoadFromFile(filename string) error
- func (g *GenesisConfig) ToAccounts() []types.Account
- func (g *GenesisConfig) Validate() error
- func (g *GenesisConfig) WriteToFile(filename string) error
- type LogEncoder
- type LoggerConfig
- type SmeshingConfig
Constants ¶
const Account1Private = "" /* 130-byte string literal not displayed */
Account1Private is the private key for test account.
const Account2Private = "" /* 130-byte string literal not displayed */
Account2Private is the private key for second test account.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseConfig ¶
type BaseConfig struct { DataDirParent string `mapstructure:"data-folder"` ConfigFile string `mapstructure:"config"` CollectMetrics bool `mapstructure:"metrics"` MetricsPort int `mapstructure:"metrics-port"` MetricsPush string `mapstructure:"metrics-push"` MetricsPushPeriod int `mapstructure:"metrics-push-period"` ProfilerName string `mapstructure:"profiler-name"` ProfilerURL string `mapstructure:"profiler-url"` OracleServer string `mapstructure:"oracle_server"` OracleServerWorldID int `mapstructure:"oracle_server_worldid"` LayerDuration time.Duration `mapstructure:"layer-duration"` LayerAvgSize uint32 `mapstructure:"layer-average-size"` LayersPerEpoch uint32 `mapstructure:"layers-per-epoch"` PoETServers []string `mapstructure:"poet-server"` PprofHTTPServer bool `mapstructure:"pprof-server"` SyncRequestTimeout int `mapstructure:"sync-request-timeout"` // ms the timeout for direct request in the sync SyncInterval int `mapstructure:"sync-interval"` // sync interval in seconds PublishEventsURL string `mapstructure:"events-url"` TxsPerProposal int `mapstructure:"txs-per-proposal"` BlockGasLimit uint64 `mapstructure:"block-gas-limit"` // if the number of proposals with the same mesh state crosses this threshold (in percentage), // then we optimistically filter out infeasible transactions before constructing the block. OptFilterThreshold int `mapstructure:"optimistic-filtering-threshold"` TickSize uint64 `mapstructure:"tick-size"` }
BaseConfig defines the default configuration options for spacemesh app.
func (*BaseConfig) SetConfigFile ¶
func (cfg *BaseConfig) SetConfigFile(file string)
SetConfigFile overrides the default config file path.
type Config ¶
type Config struct { BaseConfig `mapstructure:"main"` Address *types.Config `mapstructure:"address"` Genesis *GenesisConfig `mapstructure:"genesis"` Tortoise tortoise.Config `mapstructure:"tortoise"` P2P p2p.Config `mapstructure:"p2p"` API apiConfig.Config `mapstructure:"api"` HARE hareConfig.Config `mapstructure:"hare"` HareEligibility eligConfig.Config `mapstructure:"hare-eligibility"` Beacon beacon.Config `mapstructure:"beacon"` TIME timeConfig.TimeConfig `mapstructure:"time"` VM vm.Config `mapstructure:"vm"` POST activation.PostConfig `mapstructure:"post"` POET activation.PoetConfig `mapstructure:"poet"` SMESHING SmeshingConfig `mapstructure:"smeshing"` LOGGING LoggerConfig `mapstructure:"logging"` FETCH fetch.Config `mapstructure:"fetch"` }
Config defines the top level configuration for a spacemesh node.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default configuration for a spacemesh node.
func DefaultTestConfig ¶ added in v1.0.0
func DefaultTestConfig() Config
DefaultTestConfig returns the default config for tests.
type GenesisConfig ¶ added in v1.0.0
type GenesisConfig struct { GenesisTime string `mapstructure:"genesis-time"` ExtraData string `mapstructure:"genesis-extra-data"` Accounts map[string]uint64 `mapstructure:"accounts"` }
GenesisConfig contains immutable parameters for the protocol.
func DefaultGenesisConfig ¶ added in v1.0.0
func DefaultGenesisConfig() *GenesisConfig
DefaultGenesisConfig is the default configuration for the node.
func DefaultTestGenesisConfig ¶ added in v1.0.0
func DefaultTestGenesisConfig() *GenesisConfig
DefaultTestGenesisConfig is the default test configuration for the node.
func (*GenesisConfig) Diff ¶ added in v1.0.0
func (g *GenesisConfig) Diff(other *GenesisConfig) string
Diff returns difference between two configs.
func (*GenesisConfig) GenesisID ¶ added in v1.0.0
func (g *GenesisConfig) GenesisID() types.Hash20
GenesisID computes genesis id from GenesisTime and ExtraData.
func (*GenesisConfig) LoadFromFile ¶ added in v1.0.0
func (g *GenesisConfig) LoadFromFile(filename string) error
LoadFromFile loads config from file.
func (*GenesisConfig) ToAccounts ¶ added in v1.0.0
func (g *GenesisConfig) ToAccounts() []types.Account
ToAccounts creates list of types.Account instance from config.
func (*GenesisConfig) Validate ¶ added in v1.0.0
func (g *GenesisConfig) Validate() error
Validate GenesisConfig.
func (*GenesisConfig) WriteToFile ¶ added in v1.0.0
func (g *GenesisConfig) WriteToFile(filename string) error
WriteToFile writes config content to file.
type LogEncoder ¶ added in v1.0.0
type LogEncoder = string
LogEncoder defines a log encoder kind.
const ( // ConsoleLogEncoder represents logging with plain text. ConsoleLogEncoder LogEncoder = "console" // JSONLogEncoder represents logging with JSON. JSONLogEncoder LogEncoder = "json" )
type LoggerConfig ¶
type LoggerConfig struct { Encoder LogEncoder `mapstructure:"log-encoder"` AppLoggerLevel string `mapstructure:"app"` P2PLoggerLevel string `mapstructure:"p2p"` PostLoggerLevel string `mapstructure:"post"` StateDbLoggerLevel string `mapstructure:"stateDb"` StateLoggerLevel string `mapstructure:"state"` AtxDbStoreLoggerLevel string `mapstructure:"atxDbStore"` BeaconLoggerLevel string `mapstructure:"beacon"` WeakCoinLoggerLevel string `mapstructure:"weakCoin"` PoetDbStoreLoggerLevel string `mapstructure:"poetDbStore"` StoreLoggerLevel string `mapstructure:"store"` PoetDbLoggerLevel string `mapstructure:"poetDb"` MeshDBLoggerLevel string `mapstructure:"meshDb"` TrtlLoggerLevel string `mapstructure:"trtl"` AtxDbLoggerLevel string `mapstructure:"atxDb"` BlkEligibilityLoggerLevel string `mapstructure:"block-eligibility"` MeshLoggerLevel string `mapstructure:"mesh"` SyncLoggerLevel string `mapstructure:"sync"` BlockOracleLevel string `mapstructure:"block-oracle"` HareOracleLoggerLevel string `mapstructure:"hare-oracle"` HareLoggerLevel string `mapstructure:"hare"` BlockBuilderLoggerLevel string `mapstructure:"block-builder"` BlockListenerLoggerLevel string `mapstructure:"block-listener"` PoetListenerLoggerLevel string `mapstructure:"poet"` NipostBuilderLoggerLevel string `mapstructure:"nipost"` AtxBuilderLoggerLevel string `mapstructure:"atx-builder"` HareBeaconLoggerLevel string `mapstructure:"hare-beacon"` TimeSyncLoggerLevel string `mapstructure:"timesync"` VMLogLevel string `mapstructure:"vm"` }
LoggerConfig holds the logging level for each module.
type SmeshingConfig ¶ added in v1.0.0
type SmeshingConfig struct { Start bool `mapstructure:"smeshing-start"` CoinbaseAccount string `mapstructure:"smeshing-coinbase"` Opts activation.PostSetupOpts `mapstructure:"smeshing-opts"` }
SmeshingConfig defines configuration for the node's smeshing (mining).
func DefaultSmeshingConfig ¶ added in v1.0.0
func DefaultSmeshingConfig() SmeshingConfig
DefaultSmeshingConfig returns the node's default smeshing configuration.