config

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDefaultMaxFee = types.MustParseFIL("10")
View Source
var DefaultForkUpgradeParam = &ForkUpgradeConfig{
	UpgradeBreezeHeight:      41280,
	BreezeGasTampingDuration: 120,
	UpgradeSmokeHeight:       51000,
	UpgradeIgnitionHeight:    94000,
	UpgradeRefuelHeight:      130800,
	UpgradeTapeHeight:        140760,
	UpgradeLiftoffHeight:     148888,
	UpgradeKumquatHeight:     170000,
	UpgradeCalicoHeight:      265200,
	UpgradePersianHeight:     265200 + 120*60,
	UpgradeAssemblyHeight:    138720,
	UpgradeOrangeHeight:      336458,
	UpgradeClausHeight:       343200,
	UpgradeTrustHeight:       550321,
	UpgradeNorwegianHeight:   665280,
	UpgradeTurboHeight:       712320,
	UpgradeHyperdriveHeight:  892800,
	UpgradeChocolateHeight:   1231620,
	UpgradeOhSnapHeight:      1594680,
	UpgradeSkyrHeight:        1960320,
	UpgradeSharkHeight:       2383680,
	UpgradeHyggeHeight:       2683348,
	UpgradeLightningHeight:   2809800,
	UpgradeThunderHeight:     2809800 + 2880*21,
	UpgradeWatermelonHeight:  3431940,

	UpgradeWatermelonFixHeight: -1,

	UpgradeWatermelonFix2Height: -2,
	UpgradeDragonHeight:         3855360,
	UpgradePhoenixHeight:        3855360 + 120,

	UpgradeCalibrationDragonFixHeight: -3,
}
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",
			"https://api.drand.secureweb3.com:6875",
		},
		Relays: []string{
			"/dnsaddr/api.drand.sh/",
			"/dnsaddr/api2.drand.sh/",
			"/dnsaddr/api3.drand.sh/",
		},
		IsChained:     true,
		ChainInfoJSON: `{"public_key":"868f005eb8e6e4ca0a47c8a77ceaa5309a47978a7c71bc5cce96366b5d7a569937c529eeda66c7293784a9402801af31","period":30,"genesis_time":1595431050,"hash":"8990e7a9aaed2ffed73dbd7092123d6f289930540d7651336225dc172e51b2ce","groupHash":"176f93498eac9ca337150b46d21dd58673ea4e3581185f869672e59fa4cb390a"}`,
	},
	DrandQuicknet: {
		Servers: []string{
			"https://api.drand.sh",
			"https://api2.drand.sh",
			"https://api3.drand.sh",
			"https://drand.cloudflare.com",
			"https://api.drand.secureweb3.com:6875",
		},
		Relays: []string{
			"/dnsaddr/api.drand.sh/",
			"/dnsaddr/api2.drand.sh/",
			"/dnsaddr/api3.drand.sh/",
		},
		IsChained:     false,
		ChainInfoJSON: `{"public_key":"83cf0f2896adee7eb8b5f01fcad3912212c437e0073e911fb90022d3e760183c8c4b450b6a0a6c3ac6a5776a2d1064510d1fec758c921cc22b0e17e63aaf4bcb5ed66304de9cf809bd274ca73bab4af5a6e9c76a4bc09e76eae8991ef5ece45a","period":3,"genesis_time":1692803367,"hash":"52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971","groupHash":"f477d5c89f21a17c863a7f937c6a6d15859414d2be09cd448d4279af331c5d3e","schemeID":"bls-unchained-g1-rfc9380","metadata":{"beaconID":"quicknet"}}`,
	},
	DrandTestnet: {
		Servers: []string{
			"https://pl-eu.testnet.drand.sh",
			"https://pl-us.testnet.drand.sh",
		},
		Relays: []string{
			"/dnsaddr/pl-eu.testnet.drand.sh/",
			"/dnsaddr/pl-us.testnet.drand.sh/",
		},
		IsChained:     true,
		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/",
		},
		IsChained:     true,
		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/",
		},
		IsChained:     true,
		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"`
	VenusAuthToken                string   `json:"venusAuthToken"`
	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"`
	Period    string   `json:"period,omitempty"`
}

BootstrapConfig holds all configuration options related to bootstrap nodes

func (*BootstrapConfig) AddPeers added in v1.12.0

func (bsc *BootstrapConfig) AddPeers(peers ...string)

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"`
	FevmConfig    *FevmConfig          `json:"fevm"`
	EventsConfig  *EventsConfig        `json:"events"`
	PubsubConfig  *PubsubConfig        `json:"pubsub"`
	FaultReporter *FaultReporterConfig `json:"faultReporter"`
}

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
	IsChained     bool
}

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
	DrandQuicknet
)

type Duration added in v1.10.0

type Duration time.Duration

Duration is a wrapper type for time.Duration for decoding and encoding from/to JSON

func (Duration) MarshalJSON added in v1.10.0

func (dur Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON added in v1.10.0

func (dur *Duration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements interface for json decoding

type EventConfig added in v1.10.0

type EventConfig struct {
	// DisableRealTimeFilterAPI will disable the RealTimeFilterAPI that can create and query filters for actor events as they are emitted.
	// The API is enabled when EnableEthRPC or Events.EnableActorEventsAPI is true, but can be disabled selectively with this flag.
	DisableRealTimeFilterAPI bool `json:"disableRealTimeFilterAPI"`

	// DisableHistoricFilterAPI will disable the HistoricFilterAPI that can create and query filters for actor events
	// that occurred in the past. HistoricFilterAPI maintains a queryable index of events.
	// The API is enabled when EnableEthRPC or Events.EnableActorEventsAPI is true, but can be disabled selectively with this flag.
	DisableHistoricFilterAPI bool `json:"disableHistoricFilterAPI"`

	// FilterTTL specifies the time to live for actor event filters. Filters that haven't been accessed longer than
	// this time become eligible for automatic deletion.
	FilterTTL Duration `json:"filterTTL"`

	// MaxFilters specifies the maximum number of filters that may exist at any one time.
	MaxFilters int `json:"maxFilters"`

	// MaxFilterResults specifies the maximum number of results that can be accumulated by an actor event filter.
	MaxFilterResults int `json:"maxFilterResults"`

	// MaxFilterHeightRange specifies the maximum range of heights that can be used in a filter (to avoid querying
	// the entire chain)
	MaxFilterHeightRange uint64 `json:"maxFilterHeightRange"`

	// DatabasePath is the full path to a sqlite database that will be used to index actor events to
	// support the historic filter APIs. If the database does not exist it will be created. The directory containing
	// the database must already exist and be writeable. If a relative path is provided here, sqlite treats it as
	// relative to the CWD (current working directory).
	DatabasePath string `json:"databasePath"`
}

type EventsConfig added in v1.15.0

type EventsConfig struct {
	// EnableActorEventsAPI enables the Actor events API that enables clients to consume events
	// emitted by (smart contracts + built-in Actors).
	// This will also enable the RealTimeFilterAPI and HistoricFilterAPI by default, but they can be
	// disabled by setting their respective Disable* options in Fevm.Event.
	EnableActorEventsAPI bool `json:"enableActorEventsAPI"`
}

type FaultReporterConfig added in v1.14.0

type FaultReporterConfig struct {
	// EnableConsensusFaultReporter controls whether the node will monitor and
	// report consensus faults. When enabled, the node will watch for malicious
	// behaviors like double-mining and parent grinding, and submit reports to the
	// network. This can earn reporter rewards, but is not guaranteed. Nodes should
	// enable fault reporting with care, as it may increase resource usage, and may
	// generate gas fees without earning rewards.
	EnableConsensusFaultReporter bool `json:"enableConsensusFaultReporter"`

	// ConsensusFaultReporterDataDir is the path where fault reporter state will be
	// persisted. This directory should have adequate space and permissions for the
	// node process.
	ConsensusFaultReporterDataDir string `json:"consensusFaultReporterDataDir"`

	// ConsensusFaultReporterAddress is the wallet address used for submitting
	// ReportConsensusFault messages. It will pay for gas fees, and receive any
	// rewards. This address should have adequate funds to cover gas fees.
	ConsensusFaultReporterAddress string `json:"consensusFaultReporterAddress"`
}

type FevmConfig added in v1.10.0

type FevmConfig struct {
	//EnableEthRPC enables eth_rpc, and enables storing a mapping of eth transaction hashes to filecoin message Cids.
	EnableEthRPC bool `json:"enableEthRPC"`
	// EthTxHashMappingLifetimeDays the transaction hash lookup database will delete mappings that have been stored for more than x days
	// Set to 0 to keep all mappings
	EthTxHashMappingLifetimeDays int `json:"ethTxHashMappingLifetimeDays"`

	Event EventConfig `json:"event"`
}

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"`
	UpgradeOhSnapHeight               abi.ChainEpoch `json:"upgradeOhSnapHeight"`
	UpgradeSkyrHeight                 abi.ChainEpoch `json:"upgradeSkyrHeight"`
	UpgradeSharkHeight                abi.ChainEpoch `json:"upgradeSharkHeight"`
	UpgradeHyggeHeight                abi.ChainEpoch `json:"upgradeHyggeHeight"`
	UpgradeLightningHeight            abi.ChainEpoch `json:"upgradeLightningHeight"`
	UpgradeThunderHeight              abi.ChainEpoch `json:"upgradeThunderHeight"`
	UpgradeWatermelonHeight           abi.ChainEpoch `json:"upgradeWatermelonHeight"`
	UpgradeWatermelonFixHeight        abi.ChainEpoch `json:"upgradeWatermelonFixHeight"`
	UpgradeWatermelonFix2Height       abi.ChainEpoch `json:"upgradeWatermelonFix2Height"`
	UpgradeDragonHeight               abi.ChainEpoch `json:"upgradeDragonHeight"`
	UpgradePhoenixHeight              abi.ChainEpoch `json:"upgradePhoenixHeight"`
	UpgradeCalibrationDragonFixHeight abi.ChainEpoch `json:"upgradeCalibrationDragonFixHeight"`
}

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:"-"`
	NetworkType             types.NetworkType            `json:"networkType"`
	AddressNetwork          address.Network              `json:"-"`
	GenesisNetworkVersion   network.Version              `json:"-"`
	ConsensusMinerMinPower  uint64                       `json:"-"` // uint64 goes up to 18 EiB
	MinVerifiedDealSize     int64                        `json:"-"`
	ReplaceProofTypes       []abi.RegisteredSealProof    `json:"-"`
	BlockDelay              uint64                       `json:"-"`
	DrandSchedule           map[abi.ChainEpoch]DrandEnum `json:"-"`
	ForkUpgradeParam        *ForkUpgradeConfig           `json:"-"`
	PreCommitChallengeDelay abi.ChainEpoch               `json:"-"`
	PropagationDelaySecs    uint64                       `json:"-"`
	AllowableClockDriftSecs uint64                       `json:"allowableClockDriftSecs"`
	// ChainId defines the chain ID used in the Ethereum JSON-RPC endpoint.
	// As per https://github.com/ethereum-lists/chains
	Eip155ChainID int `json:"-"`
	// NOTE: DO NOT change this unless you REALLY know what you're doing. This is consensus critical.
	ActorDebugging bool `json:"-"`
}

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 PubsubConfig added in v1.13.0

type PubsubConfig struct {
	// Run the node in bootstrap-node mode
	Bootstrapper bool `json:"bootstrapper"`
}

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

	ProtectedPeers []string `json:"protectedPeers"`
	//ConnMgrLow is the number of connections that the basic connection manager
	// will trim down to.
	ConnMgrLow uint `json:"connMgrLow"`

	// ConnMgrHigh is the number of connections that, when exceeded, will trigger
	// a connection GC operation. Note: protected/recently formed connections don't
	// count towards this limit.
	ConnMgrHigh uint `json:"connMgrHigh"`

	// ConnMgrGrace is a time duration that new connections are immune from being
	// closed by the connection manager.
	ConnMgrGrace Duration `json:"connMgrGrace"`
}

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