config

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DUSK is one whole unit of DUSK.
	DUSK = uint64(1_000_000_000)

	// Default Block Gas limit.
	// This value should handle up to ~20 transfers (or ~5 InterContract calls) per block.
	DefaultBlockGasLimit = 5 * DUSK

	// MaxTxSetSize defines the maximum amount of transactions.
	// It is TBD along with block size and processing.MaxFrameSize.
	MaxTxSetSize = 825000

	// Maximum number of blocks to be requested/delivered on a single syncing session with a peer.
	MaxInvBlocks = 500

	MaxBlockTime = 360 // maximum block time in seconds

	// KadcastInitialHeight sets the default initial height for Kadcast broadcast algorithm.
	KadcastInitialHeight byte = 128

	// The dusk-blockchain executable version.
	NodeVersion = "0.6.1"

	// Consensus-related settings
	// Protocol-based consensus step time.
	DefaultConsensusTimeOutSeconds = 5

	// ConsensusTimeThreshold consensus time in seconds above which we don't throttle it.
	ConsensusTimeThreshold = 10

	// ConsensusQuorumThreshold is consensus quorum percentage.
	ConsensusQuorumThreshold = 0.67

	// ConsensusMaxStep consensus max step number.
	ConsensusMaxStep = uint8(213)

	// ConsensusMaxCommitteeSize represents the maximum size of the committee in
	// 1st_Reduction, 2th_Reduction and Agreement phases.
	ConsensusMaxCommitteeSize = 64

	// ConsensusMaxCommitteeSize represents the maximum size of the committee in
	// Selection phase.
	ConsensusSelectionMaxCommitteeSize = 1

	// RuskVersion is the version of the supported rusk binary.
	RuskVersion = "0.5.0"

	// GetCandidateReceivers is a redundancy factor on retrieving a missing candidate block.
	GetCandidateReceivers = 7

	// EPOCH used for stake operations.
	EPOCH = 2160
)

A single point of constants definition.

Variables

This section is empty.

Functions

func Load

func Load(configFileName string, secondary interface{}, customflags func() (string, error)) error

Load makes an attempt to read and unmarshal any configs from flag, env and dusk config file.

It uses the following precedence order. Each item takes precedence over the item below it:

  • flag
  • env
  • config
  • key/value store (not used yet)
  • default

Dusk configuration file can be in form of TOML, JSON, YAML, HCL or Java properties config files.

func Mock

func Mock(m *Registry)

Mock should be used only in test packages. It could be useful when a unit test needs to be rerun with configs different from the default ones.

Types

type Base added in v0.2.0

type Base struct {
	// UsedConfigFile points at the loaded config file.
	UsedConfigFile string
	// FixedConfigFile fixes the config file to be loaded. If not set,
	// the default search-for-config procedure is used.
	FixedConfigFile string

	// name for the config file. Does not include extension.
	ConfigFileName string
	// contains filtered or unexported fields
}

Base configurations structure.

type Registry

type Registry struct {
	Base

	// All configuration groups.
	General   generalConfiguration
	Timeout   timeoutConfiguration
	Database  databaseConfiguration
	Network   networkConfiguration
	Kadcast   kadcastConfiguration
	Mempool   mempoolConfiguration
	Consensus consensusConfiguration
	State     stateConfiguration

	RPC rpcConfiguration
	Gql gqlConfiguration
	API apiConfiguration

	Performance performanceConfiguration
	Logger      loggerConfiguration
	Profile     []profileConfiguration
	// contains filtered or unexported fields
}

Registry stores all loaded configurations according to the config order NB It should be cheap to be copied by value.

func Get

func Get() Registry

Get returns registry by value in order to avoid further modifications after initial configuration loading.

func LoadFromFile added in v0.2.0

func LoadFromFile(configPath string) (Registry, error)

LoadFromFile unmarshalls configPath file into a new Registry instance NB. It does not overwrite the global Registry.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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