config

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0, MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDefaultMaxFee = types.MustParseFIL("1")
View Source
var DefaultForkUpgradeParam = &ForkUpgradeConfig{
	UpgradeBreezeHeight:        41280,
	BreezeGasTampingDuration:   120,
	UpgradeSmokeHeight:         51000,
	UpgradeIgnitionHeight:      94000,
	UpgradeRefuelHeight:        130800,
	UpgradeTapeHeight:          140760,
	UpgradeLiftoffHeight:       148888,
	UpgradeKumquatHeight:       170000,
	UpgradePriceListOopsHeight: 265199,
	UpgradeCalicoHeight:        265200,
	UpgradePersianHeight:       265200 + 120*60,
	UpgradeAssemblyHeight:      138720,
	UpgradeOrangeHeight:        336458,
	UpgradeClausHeight:         343200,
	UpgradeTrustHeight:         550321,
	UpgradeNorwegianHeight:     665280,
	UpgradeTurboHeight:         712320,
	UpgradeHyperdriveHeight:    892800,
	UpgradeChocolateHeight:     math.MaxInt32,
}
View Source
var DefaultMessagePoolParam = &MessagePoolConfig{
	MaxNonceGap: 100,
	MaxFee:      DefaultDefaultMaxFee,
}
View Source
var DrandConfigs = map[DrandEnum]DrandConf{
	DrandMainnet: {
		Servers: []string{
			"https://api.drand.sh",
			"https://api2.drand.sh",
			"https://api3.drand.sh",
			"https://drand.cloudflare.com",
		},
		Relays: []string{
			"/dnsaddr/api.drand.sh/",
			"/dnsaddr/api2.drand.sh/",
			"/dnsaddr/api3.drand.sh/",
		},
		ChainInfoJSON: `{"public_key":"868f005eb8e6e4ca0a47c8a77ceaa5309a47978a7c71bc5cce96366b5d7a569937c529eeda66c7293784a9402801af31","period":30,"genesis_time":1595431050,"hash":"8990e7a9aaed2ffed73dbd7092123d6f289930540d7651336225dc172e51b2ce","groupHash":"176f93498eac9ca337150b46d21dd58673ea4e3581185f869672e59fa4cb390a"}`,
	},
	DrandTestnet: {
		Servers: []string{
			"https://pl-eu.testnet.drand.sh",
			"https://pl-us.testnet.drand.sh",
			"https://pl-sin.testnet.drand.sh",
		},
		Relays: []string{
			"/dnsaddr/pl-eu.testnet.drand.sh/",
			"/dnsaddr/pl-us.testnet.drand.sh/",
			"/dnsaddr/pl-sin.testnet.drand.sh/",
		},
		ChainInfoJSON: `{"public_key":"922a2e93828ff83345bae533f5172669a26c02dc76d6bf59c80892e12ab1455c229211886f35bb56af6d5bea981024df","period":25,"genesis_time":1590445175,"hash":"84b2234fb34e835dccd048255d7ad3194b81af7d978c3bf157e3469592ae4e02","groupHash":"4dd408e5fdff9323c76a9b6f087ba8fdc5a6da907bd9217d9d10f2287d081957"}`,
	},
	DrandDevnet: {
		Servers: []string{
			"https://dev1.drand.sh",
			"https://dev2.drand.sh",
		},
		Relays: []string{
			"/dnsaddr/dev1.drand.sh/",
			"/dnsaddr/dev2.drand.sh/",
		},
		ChainInfoJSON: `{"public_key":"8cda589f88914aa728fd183f383980b35789ce81b274e5daee1f338b77d02566ef4d3fb0098af1f844f10f9c803c1827","period":25,"genesis_time":1595348225,"hash":"e73b7dc3c4f6a236378220c0dd6aa110eb16eed26c11259606e07ee122838d4f","groupHash":"567d4785122a5a3e75a9bc9911d7ea807dd85ff76b78dc4ff06b075712898607"}`,
	},
	DrandIncentinet: {
		Servers: []string{
			"https://pl-eu.incentinet.drand.sh",
			"https://pl-us.incentinet.drand.sh",
			"https://pl-sin.incentinet.drand.sh",
		},
		Relays: []string{
			"/dnsaddr/pl-eu.incentinet.drand.sh/",
			"/dnsaddr/pl-us.incentinet.drand.sh/",
			"/dnsaddr/pl-sin.incentinet.drand.sh/",
		},
		ChainInfoJSON: `{"public_key":"8cad0c72c606ab27d36ee06de1d5b2db1faf92e447025ca37575ab3a8aac2eaae83192f846fc9e158bc738423753d000","period":30,"genesis_time":1595873820,"hash":"80c8b872c714f4c00fdd3daa465d5514049f457f01f85a4caf68cdcd394ba039","groupHash":"d9406aaed487f7af71851b4399448e311f2328923d454e971536c05398ce2d9b"}`,
	},
}

DrandConfigs a set of drand config

View Source
var Validators = map[string]func(string, string) error{
	"heartbeat.nickname": validateLettersOnly,
}

Validators hold the list of validation functions for each configuration property. Validators must take a key and json string respectively as arguments, and must return either an error or nil depending on whether or not the given key and value are valid. Validators will only be run if a property being set matches the name given in this map.

Functions

func IsNearUpgrade

func IsNearUpgrade(epoch, upgradeEpoch abi.ChainEpoch) bool

func SanityCheck

func SanityCheck(t *testing.T, cfgJSON string)

Makes some basic checks of a serialized config to ascertain that it looks kind of right. This is instead of brittle hardcoded exact config expectations.

Types

type APIConfig

type APIConfig struct {
	VenusAuthURL                  string   `json:"venusAuthURL"`
	APIAddress                    string   `json:"apiAddress"`
	AccessControlAllowOrigin      []string `json:"accessControlAllowOrigin"`
	AccessControlAllowCredentials bool     `json:"accessControlAllowCredentials"`
	AccessControlAllowMethods     []string `json:"accessControlAllowMethods"`
}

APIConfig holds all configuration options related to the api. nolint

type BootstrapConfig

type BootstrapConfig struct {
	Addresses        []string `json:"addresses"`
	MinPeerThreshold int      `json:"minPeerThreshold"`
	Period           string   `json:"period,omitempty"`
}

BootstrapConfig holds all configuration options related to bootstrap nodes

type Config

type Config struct {
	API           *APIConfig           `json:"api"`
	Bootstrap     *BootstrapConfig     `json:"bootstrap"`
	Datastore     *DatastoreConfig     `json:"datastore"`
	Mpool         *MessagePoolConfig   `json:"mpool"`
	NetworkParams *NetworkParamsConfig `json:"parameters"`
	Observability *ObservabilityConfig `json:"observability"`
	Swarm         *SwarmConfig         `json:"swarm"`
	Wallet        *WalletConfig        `json:"walletModule"`
	SlashFilterDs *SlashFilterDsConfig `json:"slashFilter"`
	RateLimitCfg  *RateLimitCfg        `json:"rateLimit"`
}

Config is an in memory representation of the filecoin configuration file

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a config object with all the fields filled out to their default values

func ReadFile

func ReadFile(file string) (*Config, error)

ReadFile reads a config file from disk.

func (*Config) Get

func (cfg *Config) Get(key string) (interface{}, error)

Get gets the config sub-struct referenced by `key`, e.g. 'api.address'

func (*Config) Set

func (cfg *Config) Set(dottedKey string, jsonString string) error

Set sets the config sub-struct referenced by `key`, e.g. 'api.address' or 'datastore' to the json key value pair encoded in jsonVal.

func (*Config) WriteFile

func (cfg *Config) WriteFile(file string) error

WriteFile writes the config to the given filepath.

type DatastoreConfig

type DatastoreConfig struct {
	Type string `json:"type"`
	Path string `json:"path"`
}

DatastoreConfig holds all the configuration options for the datastore. TODO: use the advanced datastore configuration from ipfs

type DrandConf

type DrandConf struct {
	Servers       []string
	Relays        []string
	ChainInfoJSON string
}

type DrandConfig

type DrandConfig struct {
	StartTimeUnix int64 `json:"startTimeUnix"`
	RoundSeconds  int   `json:"roundSeconds"`
}

DrandConfig holds all configuration options related to pulling randomness from Drand servers

type DrandEnum

type DrandEnum int
const (
	DrandMainnet DrandEnum = iota + 1
	DrandTestnet
	DrandDevnet
	DrandLocalnet
	DrandIncentinet
)

type ForkUpgradeConfig

type ForkUpgradeConfig struct {
	UpgradeSmokeHeight         abi.ChainEpoch `json:"upgradeSmokeHeight"`
	UpgradeBreezeHeight        abi.ChainEpoch `json:"upgradeBreezeHeight"`
	UpgradeIgnitionHeight      abi.ChainEpoch `json:"upgradeIgnitionHeight"`
	UpgradeLiftoffHeight       abi.ChainEpoch `json:"upgradeLiftoffHeight"`
	UpgradeAssemblyHeight      abi.ChainEpoch `json:"upgradeActorsV2Height"`
	UpgradeRefuelHeight        abi.ChainEpoch `json:"upgradeRefuelHeight"`
	UpgradeTapeHeight          abi.ChainEpoch `json:"upgradeTapeHeight"`
	UpgradeKumquatHeight       abi.ChainEpoch `json:"upgradeKumquatHeight"`
	UpgradePriceListOopsHeight abi.ChainEpoch `json:"upgradePriceListOopsHeight"`
	BreezeGasTampingDuration   abi.ChainEpoch `json:"breezeGasTampingDuration"`
	UpgradeCalicoHeight        abi.ChainEpoch `json:"upgradeCalicoHeight"`
	UpgradePersianHeight       abi.ChainEpoch `json:"upgradePersianHeight"`
	UpgradeOrangeHeight        abi.ChainEpoch `json:"upgradeOrangeHeight"`
	UpgradeClausHeight         abi.ChainEpoch `json:"upgradeClausHeight"`
	UpgradeTrustHeight         abi.ChainEpoch `json:"upgradeActorsV3Height"`
	UpgradeNorwegianHeight     abi.ChainEpoch `json:"upgradeNorwegianHeight"`
	UpgradeTurboHeight         abi.ChainEpoch `json:"upgradeActorsV4Height"`
	UpgradeHyperdriveHeight    abi.ChainEpoch `json:"upgradeHyperdriveHeight"`
	UpgradeChocolateHeight     abi.ChainEpoch `json:"upgradeChocolateHeight"`
}

ForkUpgradeConfig record upgrade parameters

type HeartbeatConfig

type HeartbeatConfig struct {
	// BeatTarget represents the address the filecoin node will send heartbeats to.
	BeatTarget string `json:"beatTarget"`
	// BeatPeriod represents how frequently heartbeats are sent.
	// Golang duration units are accepted.
	BeatPeriod string `json:"beatPeriod"`
	// ReconnectPeriod represents how long the node waits before attempting to reconnect.
	// Golang duration units are accepted.
	ReconnectPeriod string `json:"reconnectPeriod"`
	// Nickname represents the nickname of the filecoin node,
	Nickname string `json:"nickname"`
}

HeartbeatConfig holds all configuration options related to node heartbeat.

type MessagePoolConfig

type MessagePoolConfig struct {
	// MaxNonceGap is the maximum nonce of a message past the last received on chain
	MaxNonceGap uint64 `json:"maxNonceGap"`
	// MaxFee
	MaxFee types.FIL `json:"maxFee"`
}

MessagePoolConfig holds all configuration options related to nodes message pool (mpool).

type MetricsConfig

type MetricsConfig struct {
	// Enabled will enable prometheus metrics when true.
	PrometheusEnabled bool `json:"prometheusEnabled"`
	// ReportInterval represents how frequently filecoin will update its prometheus metrics.
	ReportInterval string `json:"reportInterval"`
	// PrometheusEndpoint represents the address filecoin will expose prometheus metrics at.
	PrometheusEndpoint string `json:"prometheusEndpoint"`
}

MetricsConfig holds all configuration options related to node metrics.

type MySQLConfig added in v0.9.4

type MySQLConfig struct {
	ConnectionString string        `json:"connectionString"`
	MaxOpenConn      int           `json:"maxOpenConn"`     // 100
	MaxIdleConn      int           `json:"maxIdleConn"`     // 10
	ConnMaxLifeTime  time.Duration `json:"connMaxLifeTime"` // minuter: 60
	Debug            bool          `json:"debug"`
}

type NetworkParamsConfig

type NetworkParamsConfig struct {
	DevNet                  bool                         `json:"devNet"`
	NetworkType             int                          `json:"networkType"`
	GenesisNetworkVersion   network.Version              `json:"genesisNetworkVersion"`
	ConsensusMinerMinPower  uint64                       `json:"consensusMinerMinPower"` // uint64 goes up to 18 EiB
	MinVerifiedDealSize     int64                        `json:"minVerifiedDealSize"`
	ReplaceProofTypes       []abi.RegisteredSealProof    `json:"replaceProofTypes"`
	BlockDelay              uint64                       `json:"blockDelay"`
	DrandSchedule           map[abi.ChainEpoch]DrandEnum `json:"drandSchedule"`
	ForkUpgradeParam        *ForkUpgradeConfig           `json:"forkUpgradeParam"`
	AddressNetwork          address.Network              `json:"addressNetwork"`
	PreCommitChallengeDelay abi.ChainEpoch               `json:"preCommitChallengeDelay"`
}

NetworkParamsConfig record netork parameters

type ObservabilityConfig

type ObservabilityConfig struct {
	Metrics *MetricsConfig `json:"metrics"`
	Tracing *TraceConfig   `json:"tracing"`
}

ObservabilityConfig is a container for configuration related to observables.

type PassphraseConfig added in v0.9.1

type PassphraseConfig struct {
	ScryptN int `json:"scryptN"`
	ScryptP int `json:"scryptP"`
}

func DefaultPassphraseConfig added in v0.9.1

func DefaultPassphraseConfig() PassphraseConfig

func TestPassphraseConfig added in v0.9.7

func TestPassphraseConfig() PassphraseConfig

type RateLimitCfg added in v1.0.1

type RateLimitCfg struct {
	Endpoint string `json:"RedisEndpoint"`
	User     string `json:"user"`
	Pwd      string `json:"pwd"`
	Enable   bool   `json:"enable"`
}

type SlashFilterDsConfig added in v0.9.4

type SlashFilterDsConfig struct {
	Type  string      `json:"type"`
	MySQL MySQLConfig `json:"mysql"`
}

type SwarmConfig

type SwarmConfig struct {
	Address            string `json:"address"`
	PublicRelayAddress string `json:"public_relay_address,omitempty"`
}

SwarmConfig holds all configuration options related to the swarm.

type TraceConfig

type TraceConfig struct {
	// JaegerTracingEnabled will enable exporting traces to jaeger when true.
	JaegerTracingEnabled bool `json:"jaegerTracingEnabled"`
	// ProbabilitySampler will sample fraction of traces, 1.0 will sample all traces.
	ProbabilitySampler float64 `json:"probabilitySampler"`
	// JaegerEndpoint is the URL traces are collected on.
	JaegerEndpoint string `json:"jaegerEndpoint"`
	ServerName     string `json:"servername"`
}

TraceConfig holds all configuration options related to enabling and exporting filecoin node traces.

type WalletConfig

type WalletConfig struct {
	DefaultAddress   address.Address  `json:"defaultAddress,omitempty"`
	PassphraseConfig PassphraseConfig `json:"passphraseConfig,omitempty"`
	RemoteEnable     bool             `json:"remoteEnable"`
	RemoteBackend    string           `json:"remoteBackend"`
}

WalletConfig holds all configuration options related to the wallet.

Jump to

Keyboard shortcuts

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