config

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 37 Imported by: 1

Documentation

Overview

Package config contains go-spacemesh node configuration definitions

Index

Constants

View Source
const Account1Private = "0x2dcddb8e0ddd2269f536da5768e890790f2b84366e0fb8396bdcd15c0d7c30b" +
	"90002abedccd3ffcbf46f35f11b314d17c05a2905f918d0d72f2f6989640fbb43"

Account1Private is the private key for test account.

View Source
const Account2Private = "0x0bb3f2936d42f463e597f5fb2c48bbd8475ce74ba91f1eaae97df4084d306b4" +
	"9feaf3d38b6ef430933ebedeb073af7bec018e8d2e379fa47df6a9fa07a6a8344"

Account2Private is the private key for second test account.

Variables

This section is empty.

Functions

func LoadConfig

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

LoadConfig load the config file.

func MainnetAccounts added in v1.0.2

func MainnetAccounts() map[string]uint64

MainnetAccounts generated from preimages at https://github.com/spacemeshos/wiki/wiki/Genesis-ledger.

Types

type BaseConfig

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

	Standalone bool `mapstructure:"standalone"`

	CollectMetrics bool `mapstructure:"metrics"`
	MetricsPort    int  `mapstructure:"metrics-port"`

	ProfilerName string `mapstructure:"profiler-name"`
	ProfilerURL  string `mapstructure:"profiler-url"`

	LayerDuration  time.Duration `mapstructure:"layer-duration"`
	LayerAvgSize   uint32        `mapstructure:"layer-average-size"`
	LayersPerEpoch uint32        `mapstructure:"layers-per-epoch"`

	PoETServers DeprecatedPoETServers `mapstructure:"poet-server"`
	PoetServers []types.PoetServer    `mapstructure:"poet-servers"`

	PprofHTTPServer         bool   `mapstructure:"pprof-server"`
	PprofHTTPServerListener string `mapstructure:"pprof-listener"`
	PprofMutexProfile       bool   `mapstructure:"pprof-mutex-profile"`
	PprofBlockProfile       bool   `mapstructure:"pprof-block-profile"`

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

	DatabaseConnections          int                     `mapstructure:"db-connections"`
	DatabaseLatencyMetering      bool                    `mapstructure:"db-latency-metering"`
	DatabaseSizeMeteringInterval time.Duration           `mapstructure:"db-size-metering-interval"`
	DatabasePruneInterval        time.Duration           `mapstructure:"db-prune-interval"`
	DatabaseVacuumState          int                     `mapstructure:"db-vacuum-state"`
	DatabaseSkipMigrations       []int                   `mapstructure:"db-skip-migrations"`
	DatabaseQueryCache           bool                    `mapstructure:"db-query-cache"`
	DatabaseQueryCacheSizes      DatabaseQueryCacheSizes `mapstructure:"db-query-cache-sizes"`
	DatabaseSchemaAllowDrift     bool                    `mapstructure:"db-allow-schema-drift"`

	PruneActivesetsFrom types.EpochID `mapstructure:"prune-activesets-from"`

	NetworkHRP string `mapstructure:"network-hrp"`

	// MinerGoodAtxsPercent is a threshold to decide if tortoise activeset should be
	// picked from first block instead of synced data.
	MinerGoodAtxsPercent int `mapstructure:"miner-good-atxs-percent"`

	RegossipAtxInterval time.Duration `mapstructure:"regossip-atx-interval"`

	// ATXGradeDelay is used to grade ATXs for selection in tortoise active set.
	// See grading function in miner/proposals_builder.go
	ATXGradeDelay time.Duration `mapstructure:"atx-grade-delay"`

	// PostValidDelay is the time after which a PoST is considered valid
	// counting from the time an ATX was received.
	// Before that time, the PoST must be fully verified.
	// After that time, we depend on PoST malfeasance proofs.
	PostValidDelay time.Duration `mapstructure:"post-valid-delay"`

	// NoMainOverride forces the "nomain" builds to run on the mainnet
	NoMainOverride bool `mapstructure:"no-main-override"`

	// ATX version switches
	// Each entry states on which publish epoch given ATX version becomes valid.
	// Note: There is always one valid version at any given time.
	// ATX V1 starts with epoch 0 unless configured otherwise.
	AtxVersions activation.AtxVersions `mapstructure:"atx-versions"`
}

BaseConfig defines the default configuration options for spacemesh app.

type Config

type Config struct {
	BaseConfig      `mapstructure:"main"`
	Preset          string                     `mapstructure:"preset"`
	Genesis         GenesisConfig              `mapstructure:"genesis"`
	PublicMetrics   PublicMetrics              `mapstructure:"public-metrics"`
	Tortoise        tortoise.Config            `mapstructure:"tortoise"`
	P2P             p2p.Config                 `mapstructure:"p2p"`
	API             grpcserver.Config          `mapstructure:"api"`
	HARE3           hare3.Config               `mapstructure:"hare3"`
	HARE4           hare4.Config               `mapstructure:"hare4"`
	HareEligibility eligibility.Config         `mapstructure:"hare-eligibility"`
	Certificate     blocks.CertConfig          `mapstructure:"certificate"`
	Beacon          beacon.Config              `mapstructure:"beacon"`
	TIME            timeConfig.TimeConfig      `mapstructure:"time"`
	VM              vm.Config                  `mapstructure:"vm"`
	Certifier       activation.CertifierConfig `mapstructure:"certifier"`
	POST            activation.PostConfig      `mapstructure:"post"`
	POSTService     activation.PostSupervisorConfig
	POET            activation.PoetConfig      `mapstructure:"poet"`
	SMESHING        SmeshingConfig             `mapstructure:"smeshing"`
	LOGGING         LoggerConfig               `mapstructure:"logging"`
	FETCH           fetch.Config               `mapstructure:"fetch"`
	Bootstrap       bootstrap.Config           `mapstructure:"bootstrap"`
	Sync            syncer.Config              `mapstructure:"syncer"`
	Recovery        checkpoint.Config          `mapstructure:"recovery"`
	Cache           datastore.Config           `mapstructure:"cache"`
	ActiveSet       miner.ActiveSetPreparation `mapstructure:"active-set-preparation"`
}

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 MainnetConfig added in v1.0.0

func MainnetConfig() Config

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 DatabaseQueryCacheSizes added in v1.4.0

type DatabaseQueryCacheSizes struct {
	EpochATXs     int `mapstructure:"epoch-atxs"`
	ATXBlob       int `mapstructure:"atx-blob"`
	ActiveSetBlob int `mapstructure:"active-set-blob"`
}

type DeprecatedPoETServers added in v1.4.0

type DeprecatedPoETServers struct{}

func (DeprecatedPoETServers) DeprecatedMsg added in v1.4.0

func (DeprecatedPoETServers) DeprecatedMsg() string

DeprecatedMsg implements Deprecated interface.

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) GoldenATX added in v1.0.0

func (g *GenesisConfig) GoldenATX() types.Hash32

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"`
	ClockLoggerLevel           string `mapstructure:"clock"`
	P2PLoggerLevel             string `mapstructure:"p2p"`
	PostLoggerLevel            string `mapstructure:"post"`
	PostServiceLoggerLevel     string `mapstructure:"postService"`
	StateDbLoggerLevel         string `mapstructure:"stateDb"`
	BeaconLoggerLevel          string `mapstructure:"beacon"`
	CachedDBLoggerLevel        string `mapstructure:"cachedDb"`
	PoetDbLoggerLevel          string `mapstructure:"poetDb"`
	TrtlLoggerLevel            string `mapstructure:"trtl"`
	AtxHandlerLevel            string `mapstructure:"atxHandler"`
	AtxBuilderLoggerLevel      string `mapstructure:"atxBuilder"`
	MeshLoggerLevel            string `mapstructure:"mesh"`
	SyncLoggerLevel            string `mapstructure:"sync"`
	HareOracleLoggerLevel      string `mapstructure:"hareOracle"`
	HareLoggerLevel            string `mapstructure:"hare"`
	BlockCertLoggerLevel       string `mapstructure:"blockCert"`
	BlockGenLoggerLevel        string `mapstructure:"blockGenerator"`
	BlockHandlerLoggerLevel    string `mapstructure:"blockHandler"`
	TxHandlerLoggerLevel       string `mapstructure:"txHandler"`
	ProposalStoreLoggerLevel   string `mapstructure:"proposalStore"`
	ProposalBuilderLoggerLevel string `mapstructure:"proposalBuilder"`
	ProposalListenerLevel      string `mapstructure:"proposalListener"`
	NipostBuilderLoggerLevel   string `mapstructure:"nipostBuilder"`
	NipostValidatorLoggerLevel string `mapstructure:"nipostValidator"`
	FetcherLoggerLevel         string `mapstructure:"fetcher"`
	TimeSyncLoggerLevel        string `mapstructure:"timesync"`
	VMLogLevel                 string `mapstructure:"vm"`
	GrpcLoggerLevel            string `mapstructure:"grpc"`
	ConStateLoggerLevel        string `mapstructure:"conState"`
	ExecutorLoggerLevel        string `mapstructure:"executor"`
	MalfeasanceLoggerLevel     string `mapstructure:"malfeasance"`
	BootstrapLoggerLevel       string `mapstructure:"bootstrap"`
}

LoggerConfig holds the logging level for each module.

func DefaultLoggingConfig added in v1.1.10

func DefaultLoggingConfig() LoggerConfig

type PublicMetrics added in v1.0.4

type PublicMetrics struct {
	MetricsURL        string            `mapstructure:"metrics-url"`
	MetricsPushPeriod time.Duration     `mapstructure:"metrics-push-period"`
	MetricsPushUser   string            `mapstructure:"metrics-push-user"`
	MetricsPushPass   string            `mapstructure:"metrics-push-pass"`
	MetricsPushHeader map[string]string `mapstructure:"metrics-push-header"`
}

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"`
	ProvingOpts     activation.PostProvingOpts        `mapstructure:"smeshing-proving-opts"`
	VerifyingOpts   activation.PostProofVerifyingOpts `mapstructure:"smeshing-verifying-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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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