config

package
v0.2.1-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

Package config contains go-spacemesh node configuration definitions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(fileLocation string, vip *viper.Viper) (err error)

LoadConfig load the config file

Types

type BaseConfig

type BaseConfig struct {
	DataDirParent string `mapstructure:"data-folder"`

	ConfigFile string `mapstructure:"config"`

	TestMode bool `mapstructure:"test-mode"`

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

	GenesisTime      string `mapstructure:"genesis-time"`
	LayerDurationSec int    `mapstructure:"layer-duration-sec"`
	LayerAvgSize     int    `mapstructure:"layer-average-size"`
	LayersPerEpoch   uint32 `mapstructure:"layers-per-epoch"`
	Hdist            uint32 `mapstructure:"hdist"`                     // hare/input vector lookback distance
	Zdist            uint32 `mapstructure:"zdist"`                     // hare result wait distance
	ConfidenceParam  uint32 `mapstructure:"tortoise-confidence-param"` // layers to wait for global consensus
	WindowSize       uint32 `mapstructure:"tortoise-window-size"`      // size of the tortoise sliding window (in layers)
	GlobalThreshold  uint8  `mapstructure:"tortoise-global-threshold"` // threshold for finalizing blocks and layers
	LocalThreshold   uint8  `mapstructure:"tortoise-local-threshold"`  // threshold for choosing when to use weak coin

	// how often we rerun tortoise from scratch, in minutes
	TortoiseRerunInterval uint32 `mapstructure:"tortoise-rerun-interval"`

	PoETServer string `mapstructure:"poet-server"`

	PprofHTTPServer bool `mapstructure:"pprof-server"`

	GoldenATXID string `mapstructure:"golden-atx"`

	GenesisActiveSet int `mapstructure:"genesis-active-size"` // the active set size for genesis

	SyncRequestTimeout int `mapstructure:"sync-request-timeout"` // ms the timeout for direct request in the sync

	SyncInterval int `mapstructure:"sync-interval"` // sync interval in seconds

	SyncValidationDelta int `mapstructure:"sync-validation-delta"` // sync interval in seconds

	PublishEventsURL string `mapstructure:"events-url"`

	AtxsPerBlock int `mapstructure:"atxs-per-block"`

	TxsPerBlock int `mapstructure:"txs-per-block"`

	BlockCacheSize int `mapstructure:"block-cache-size"`

	AlwaysListen bool `mapstructure:"always-listen"` // force gossip to always be on (for testing)
}

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"`
	Genesis         *apiConfig.GenesisConfig `mapstructure:"genesis"`
	P2P             p2pConfig.Config         `mapstructure:"p2p"`
	API             apiConfig.Config         `mapstructure:"api"`
	HARE            hareConfig.Config        `mapstructure:"hare"`
	HareEligibility eligConfig.Config        `mapstructure:"hare-eligibility"`
	TortoiseBeacon  tortoisebeacon.Config    `mapstructure:"tortoise-beacon"`
	TIME            timeConfig.TimeConfig    `mapstructure:"time"`
	REWARD          mesh.Config              `mapstructure:"reward"`
	POST            activation.PostConfig    `mapstructure:"post"`
	SMESHING        SmeshingConfig           `mapstructure:"smeshing"`
	LOGGING         LoggerConfig             `mapstructure:"logging"`
	LAYERS          layerfetcher.Config      `mapstructure:"layer-fetch"`
	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.

func (*Config) DataDir added in v0.1.12

func (cfg *Config) DataDir() string

DataDir returns the absolute path to use for the node's data. This is the tilde-expanded path given in the config with a subfolder named after the network ID.

type LoggerConfig

type LoggerConfig struct {
	AppLoggerLevel            string `mapstructure:"app"`
	P2PLoggerLevel            string `mapstructure:"p2p"`
	PostLoggerLevel           string `mapstructure:"post"`
	StateDbLoggerLevel        string `mapstructure:"stateDb"`
	StateLoggerLevel          string `mapstructure:"state"`
	AtxDbStoreLoggerLevel     string `mapstructure:"atxDbStore"`
	TBeaconDbStoreLoggerLevel string `mapstructure:"tbDbStore"`
	TBeaconDbLoggerLevel      string `mapstructure:"tbDb"`
	TBeaconLoggerLevel        string `mapstructure:"tBeacon"`
	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"`
}

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.

Jump to

Keyboard shortcuts

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