config

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: LGPL-3.0 Imports: 16 Imported by: 9

Documentation

Index

Constants

View Source
const (
	LowPowerProfile   = "lowpower"
	SharedNodeProfile = "shared"
	DefaultProfile    = "default"
)
View Source
const (
	DefaultDataDir            = "datadir"
	DefaultPort               = 40404
	DefaultRpcHost            = "localhost"
	DefaultRpcPort            = 9009
	DefaultRpcPortBuiltInNode = 9119
	DefaultIpfsDataDir        = "ipfs"
	DefaultIpfsPort           = 40405
	DefaultGodAddress         = "0x4d60dc6a2cba8c3ef1ba5e1eba5c12c54cee6b61"
	DefaultCeremonyTime       = int64(1567171800)
	DefaultSwarmKey           = "00d6f96bb2b02a7308ad87938d6139a974b555cc029ce416641a60c46db2f531"
	DefaultForceFullSync      = 100
	DefaultStoreCertRange     = 2000

	DefaultMaxInboundOwnShardPeers     = 8
	DefaultMaxOutboundOwnShardPeers    = 4
	DefaultMaxInboundNotOwnShardPeers  = 4
	DefaultMaxOutboundNotOwnShardPeers = 2

	DefaultBurntTxRange = 4320

	LowPowerMaxInboundOwnShardPeers     = 3
	LowPowerMaxOutboundOwnShardPeers    = 2
	LowPowerMaxInboundNotOwnShardPeers  = 1
	LowPowerMaxOutboundNotOwnShardPeers = 1

	SharedNodeMaxInboundOwnShardPeers     = 11
	SharedNodeMaxOutboundOwnShardPeers    = 5
	SharedNodeMaxInboundNotOwnShardPeers  = 6
	SharedNodeMaxOutboundNotOwnShardPeers = 3
)
View Source
const (
	FlipLottery      = 5 * time.Minute
	ShortSession     = 2 * time.Minute
	AfterLongSession = 1 * time.Minute
)

Variables

View Source
var (
	DefaultIpfsBootstrapNodes = []string{
		"/ip4/135.181.40.10/tcp/40405/ipfs/QmNYWtiwM1UfeCmHfWSdefrMuQdg6nycY5yS64HYqWCUhD",
		"/ip4/157.230.61.115/tcp/40403/ipfs/QmQHYY49pWWFeXXdR9rKd31bHRqRi2E4tk4CXDgYJZq5ry",
		"/ip4/124.71.148.124/tcp/40405/ipfs/QmWH9D4DjSvQyWyRUw76AopCfRS5CPR2gRnRoxP3QFaefx",
		"/ip4/139.59.42.4/tcp/40405/ipfs/QmNagyEFFNMdkFT7W6HivNjJAmYB6zjrr7ussnC8ys9b7f",
	}
	CfgFileFlag = cli.StringFlag{
		Name:  "config",
		Usage: "JSON configuration file",
	}
	DataDirFlag = cli.StringFlag{
		Name:  "datadir",
		Usage: "datadir for blockchain",
	}
	TcpPortFlag = cli.IntFlag{
		Name:  "port",
		Usage: "Network listening port",
	}
	RpcHostFlag = cli.StringFlag{
		Name:  "rpcaddr",
		Usage: "RPC listening address",
	}
	RpcPortFlag = cli.IntFlag{
		Name:  "rpcport",
		Usage: "RPC listening port",
	}
	BootNodeFlag = cli.StringFlag{
		Name:  "bootnode",
		Usage: "Bootstrap node url",
	}
	AutomineFlag = cli.BoolFlag{
		Name:  "automine",
		Usage: "Mine blocks alone without peers",
	}
	IpfsBootNodeFlag = cli.StringFlag{
		Name:  "ipfsbootnode",
		Usage: "Ipfs bootstrap node (overrides existing)",
	}
	IpfsPortFlag = cli.IntFlag{
		Name:  "ipfsport",
		Usage: "Ipfs port",
	}
	NoDiscoveryFlag = cli.BoolFlag{
		Name:  "nodiscovery",
		Usage: "NoDiscovery can be used to disable the peer discovery mechanism.",
	}
	VerbosityFlag = cli.IntFlag{
		Name:  "verbosity",
		Usage: "Log verbosity",
		Value: 3,
	}
	GodAddressFlag = cli.StringFlag{
		Name:  "godaddress",
		Usage: "Idena god address",
	}
	CeremonyTimeFlag = cli.Int64Flag{
		Name:  "ceremonytime",
		Usage: "First ceremony time (unix)",
	}
	MaxNetworkDelayFlag = cli.IntFlag{
		Name:  "maxnetdelay",
		Usage: "Max network delay for broadcasting",
	}
	FastSyncFlag = cli.BoolFlag{
		Name:  "fast",
		Usage: "Enable fast sync",
	}
	ForceFullSyncFlag = cli.Uint64Flag{
		Name:  "forcefullsync",
		Usage: "Force full sync on last blocks",
	}
	ProfileFlag = cli.StringFlag{
		Name:  "profile",
		Usage: "Configuration profile",
	}
	IpfsPortStaticFlag = cli.BoolFlag{
		Name:  "ipfsportstatic",
		Usage: "Enable static ipfs port",
	}
	ApiKeyFlag = cli.StringFlag{
		Name:  "apikey",
		Usage: "Set RPC api key",
	}
	LogFileSizeFlag = cli.IntFlag{
		Name:  "logfilesize",
		Usage: "Set log file size in KB",
		Value: 1024 * 100,
	}
	LogColoring = cli.BoolFlag{
		Name:  "logcoloring",
		Usage: "Use log coloring",
	}
	AutoOnline = cli.BoolFlag{
		Name:  "autoonline",
		Usage: "Node will automatically turn on online mining status",
	}
)
View Source
var (
	ConsensusVersions map[ConsensusVerson]*ConsensusConf
)

Functions

func ApplyConsensusVersion added in v0.23.0

func ApplyConsensusVersion(ver ConsensusVerson, cfg *ConsensusConf)

Types

type BlockchainConfig

type BlockchainConfig struct {
	// distance between blocks with permanent certificates
	StoreCertRange uint64
	BurnTxRange    uint64
}

type Config

type Config struct {
	DataDir          string
	Network          uint32
	AutoOnline       bool
	Consensus        *ConsensusConf
	P2P              P2P
	RPC              *rpc.Config
	GenesisConf      *GenesisConf
	IpfsConf         *IpfsConfig
	Validation       *ValidationConfig
	Sync             *SyncConfig
	OfflineDetection *OfflineDetectionConfig
	Blockchain       *BlockchainConfig
	Mempool          *Mempool
}

func MakeConfig

func MakeConfig(ctx *cli.Context, cfgTransform func(cfg *Config)) (*Config, error)

func MakeConfigFromFile

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

func MakeMobileConfig

func MakeMobileConfig(path string, cfg string) (*Config, error)

func (*Config) KeyStoreDataDir

func (c *Config) KeyStoreDataDir() (string, error)

func (*Config) NodeDB

func (c *Config) NodeDB() string

NodeDB returns the path to the discovery node database.

func (*Config) NodeKey

func (c *Config) NodeKey() (*ecdsa.PrivateKey, error)

func (*Config) ProvideNodeKey

func (c *Config) ProvideNodeKey(key string, password string, withBackup bool) error

func (*Config) SetApiKey

func (c *Config) SetApiKey() error

type ConsensusConf

type ConsensusConf struct {
	Version                     ConsensusVerson
	StartActivationDate         int64 // unix timestamp
	EndActivationDate           int64 // unix timestamp
	MigrationTimeout            time.Duration
	GenerateGenesisAfterUpgrade bool

	MaxSteps                          uint8
	AgreementThreshold                float64
	CommitteePercent                  float64
	FinalCommitteePercent             float64
	WaitBlockDelay                    time.Duration
	WaitSortitionProofDelay           time.Duration
	EstimatedBaVariance               time.Duration
	WaitForStepDelay                  time.Duration
	Automine                          bool
	BlockReward                       *big.Int
	StakeRewardRate                   float32
	StakeRewardRateForNewbie          float32
	FinalCommitteeReward              *big.Int
	FeeBurnRate                       float32
	SnapshotRange                     uint64
	OfflinePenaltyBlocksCount         int64
	SuccessfulValidationRewardPercent float32
	StakingRewardPercent              float32
	CandidateRewardPercent            float32
	FlipRewardPercent                 float32
	ValidInvitationRewardPercent      float32
	ReportsRewardPercent              float32
	FoundationPayoutsPercent          float32
	ZeroWalletPercent                 float32
	FirstInvitationRewardCoef         float32
	SecondInvitationRewardCoef        float32
	ThirdInvitationRewardCoef         float32
	SavedInviteRewardCoef             float32
	SavedInviteWinnerRewardCoef       float32
	FeeSensitivityCoef                float32
	MinBlockDistance                  time.Duration
	MaxCommitteeSize                  int
	StatusSwitchRange                 uint64
	DelegationSwitchRange             uint64
	InvitesPercent                    float32
	MinProposerThreshold              float64
	UpgradeIntervalBeforeValidation   time.Duration
	ReductionOneDelay                 time.Duration
	NewKeyWordsEpoch                  uint16
	EnableUpgrade7                    bool
	EnableUpgrade8                    bool
}

func GetDefaultConsensusConfig

func GetDefaultConsensusConfig() *ConsensusConf

type ConsensusVerson added in v0.23.0

type ConsensusVerson uint16
const (
	// Enables validation sharding
	ConsensusV6 ConsensusVerson = 6

	ConsensusV7 ConsensusVerson = 7

	ConsensusV8 ConsensusVerson = 8
)

type GenesisAllocation

type GenesisAllocation struct {
	Balance *big.Int
	Stake   *big.Int
	State   uint8
}

type GenesisConf

type GenesisConf struct {
	Alloc             map[common.Address]GenesisAllocation
	GodAddress        common.Address
	FirstCeremonyTime int64
	GodAddressInvites uint16
}

type IpfsConfig

type IpfsConfig struct {
	DataDir            string
	BootNodes          []string
	IpfsPort           int
	StaticPort         bool
	SwarmKey           string
	Routing            string
	LowWater           int
	HighWater          int
	GracePeriod        string
	ReproviderInterval string
	Profile            string
	BlockPinThreshold  float32
	FlipPinThreshold   float32
	PublishPeers       bool
}

func GetDefaultIpfsConfig added in v0.19.2

func GetDefaultIpfsConfig() *IpfsConfig

type Mempool added in v0.19.2

type Mempool struct {
	TxPoolQueueSlots      int
	TxPoolExecutableSlots int

	TxPoolAddrQueueLimit      int
	TxPoolAddrExecutableLimit int
	TxLifetime                time.Duration
	ResetInCeremony           bool
}

func GetDefaultMempoolConfig added in v0.19.2

func GetDefaultMempoolConfig() *Mempool

type OfflineDetectionConfig

type OfflineDetectionConfig struct {
	PersistInterval             int
	MaxSelfOffline              time.Duration
	OfflineProposeInterval      time.Duration
	OfflineVoteInterval         time.Duration
	IntervalBetweenOfflineRetry time.Duration
}

func GetDefaultOfflineDetectionConfig

func GetDefaultOfflineDetectionConfig() *OfflineDetectionConfig

type P2P

type P2P struct {
	MaxInboundPeers  int
	MaxOutboundPeers int

	MaxInboundOwnShardPeers  int
	MaxOutboundOwnShardPeers int

	MaxDelay       int
	DisableMetrics bool
	Multishard     bool
	Shared         bool
}

type SyncConfig

type SyncConfig struct {
	FastSync            bool
	ForceFullSync       uint64
	LoadAllFlips        bool
	AllFlipsLoadingTime time.Duration
}

type ValidationConfig

type ValidationConfig struct {
	// Do not use directly
	ValidationInterval time.Duration
	// Do not use directly
	FlipLotteryDuration time.Duration
	// Do not use directly
	ShortSessionDuration time.Duration
	// Do not use directly
	LongSessionDuration time.Duration
}

func (*ValidationConfig) GetFlipLotteryDuration

func (cfg *ValidationConfig) GetFlipLotteryDuration() time.Duration

func (*ValidationConfig) GetLongSessionDuration

func (cfg *ValidationConfig) GetLongSessionDuration(networkSize int) time.Duration

func (*ValidationConfig) GetNextValidationTime

func (cfg *ValidationConfig) GetNextValidationTime(validationTime time.Time, networkSize int) time.Time

func (*ValidationConfig) GetShortSessionDuration

func (cfg *ValidationConfig) GetShortSessionDuration() time.Duration

Jump to

Keyboard shortcuts

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