lachesis

package
v0.0.0-...-59e56fa Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MainNetworkID uint64 = 0xfe
	TestNetworkID uint64 = 0xfe2
	FakeNetworkID uint64 = 0xfe3
)

Variables

View Source
var (
	// PercentUnit is used to define ratios with integers, it's 1.0
	PercentUnit = big.NewInt(1e6)
)

Functions

This section is empty.

Types

type BlocksConfig

type BlocksConfig struct {
	BlockGasHardLimit uint64 `json:"maxBlockGasLimit"` // technical hard limit, gas is mostly governed by gas power allocation
}

BlocksConfig contains blocks constants

type BlocksMissed

type BlocksMissed struct {
	BlocksNum idx.Block
	Period    time.Duration
}

BlocksMissed is information about missed blocks from a staker

type Config

type Config struct {
	Name      string
	NetworkID uint64

	Genesis genesis.Genesis

	// Graph options
	Dag DagConfig

	// Blockchain options
	Blocks BlocksConfig

	// Economy options
	Economy EconomyConfig
}

Config describes lachesis net.

func FakeNetConfig

func FakeNetConfig(accs genesis.VAccounts) Config

func MainNetConfig

func MainNetConfig() Config

func TestNetConfig

func TestNetConfig() Config

func (*Config) EvmChainConfig

func (c *Config) EvmChainConfig() *ethparams.ChainConfig

EvmChainConfig returns ChainConfig for transaction signing and execution

type DagConfig

type DagConfig struct {
	MaxParents     int `json:"maxParents"`
	MaxFreeParents int `json:"maxFreeParents"` // maximum number of parents with no gas cost

	MaxEpochBlocks   idx.Frame     `json:"maxEpochBlocks"`
	MaxEpochDuration time.Duration `json:"maxEpochDuration"`

	VectorClockConfig vector.IndexConfig `json:"vectorClockConfig"`

	MaxValidatorEventsInBlock idx.Event `json:"maxValidatorEventsInBlock"`
}

DagConfig of Lachesis DAG (directed acyclic graph).

func DefaultDagConfig

func DefaultDagConfig() DagConfig

func FakeNetDagConfig

func FakeNetDagConfig() DagConfig

type EconomyConfig

type EconomyConfig struct {
	PoiPeriodDuration       time.Duration
	BlockMissedLatency      idx.Block
	OfflinePenaltyThreshold BlocksMissed
	TxRewardPoiImpact       *big.Int
	InitialRewardPerSecond  *big.Int
	MaxRewardPerSecond      *big.Int

	ShortGasPower GasPowerConfig `json:"shortGasPower"`
	LongGasPower  GasPowerConfig `json:"longGasPower"`
}

EconomyConfig contains economy constants

func DefaultEconomyConfig

func DefaultEconomyConfig() EconomyConfig

DefaultEconomyConfig returns mainnet economy

func FakeEconomyConfig

func FakeEconomyConfig() EconomyConfig

FakeEconomyConfig returns fakenet economy

type GasPowerConfig

type GasPowerConfig struct {
	InitialAllocPerSec uint64          `json:"initialAllocPerSec"`
	MaxAllocPerSec     uint64          `json:"maxAllocPerSec"`
	MinAllocPerSec     uint64          `json:"minAllocPerSec"`
	MaxAllocPeriod     inter.Timestamp `json:"maxAllocPeriod"`
	StartupAllocPeriod inter.Timestamp `json:"startupAllocPeriod"`
	MinStartupGas      uint64          `json:"minStartupGas"`
}

GasPowerConfig defines gas power rules in the consensus.

func DefaulLongGasPowerConfig

func DefaulLongGasPowerConfig() GasPowerConfig

DefaulLongGasPowerConfig is long-window config

func DefaultShortGasPowerConfig

func DefaultShortGasPowerConfig() GasPowerConfig

DefaultShortGasPowerConfig is short-window config

func FakeLongGasPowerConfig

func FakeLongGasPowerConfig() GasPowerConfig

FakeLongGasPowerConfig is fake long-window config

func FakeShortGasPowerConfig

func FakeShortGasPowerConfig() GasPowerConfig

FakeShortGasPowerConfig is fake short-window config

Directories

Path Synopsis
sfc

Jump to

Keyboard shortcuts

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