opera

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MainNetworkID   uint64 = 0xfa
	TestNetworkID   uint64 = 0xfa2
	FakeNetworkID   uint64 = 0xfa3
	DefaultEventGas uint64 = 28000
)

Variables

Functions

This section is empty.

Types

type BlocksMissed

type BlocksMissed struct {
	BlocksNum idx.Block
	Period    inter.Timestamp
}

BlocksMissed is information about missed blocks from a staker

type BlocksRules

type BlocksRules struct {
	MaxBlockGas             uint64 // technical hard limit, gas is mostly governed by gas power allocation
	MaxEmptyBlockSkipPeriod inter.Timestamp
}

BlocksRules contains blocks constants

type DagRules

type DagRules struct {
	MaxParents     idx.Event
	MaxFreeParents idx.Event // maximum number of parents with no gas cost
	MaxExtraData   uint32
}

DagRules of Lachesis DAG (directed acyclic graph).

func DefaultDagRules

func DefaultDagRules() DagRules

type EconomyRules

type EconomyRules struct {
	BlockMissedSlack idx.Block

	Gas GasRules

	MinGasPrice *big.Int

	ShortGasPower GasPowerRules
	LongGasPower  GasPowerRules
}

EconomyRules contains economy constants

func DefaultEconomyRules

func DefaultEconomyRules() EconomyRules

DefaultEconomyRules returns mainnet economy

func FakeEconomyRules

func FakeEconomyRules() EconomyRules

FakeEconomyRules returns fakenet economy

type EpochsRules

type EpochsRules struct {
	MaxEpochGas      uint64
	MaxEpochDuration inter.Timestamp
}

func DefaultEpochsRules

func DefaultEpochsRules() EpochsRules

func FakeNetEpochsRules

func FakeNetEpochsRules() EpochsRules

type GasPowerRules

type GasPowerRules struct {
	AllocPerSec        uint64
	MaxAllocPeriod     inter.Timestamp
	StartupAllocPeriod inter.Timestamp
	MinStartupGas      uint64
}

GasPowerRules defines gas power rules in the consensus.

func DefaulLongGasPowerRules

func DefaulLongGasPowerRules() GasPowerRules

DefaulLongGasPowerRules is long-window config

func DefaultShortGasPowerRules

func DefaultShortGasPowerRules() GasPowerRules

DefaultShortGasPowerRules is short-window config

func FakeLongGasPowerRules

func FakeLongGasPowerRules() GasPowerRules

FakeLongGasPowerRules is fake long-window config

func FakeShortGasPowerRules

func FakeShortGasPowerRules() GasPowerRules

FakeShortGasPowerRules is fake short-window config

type GasRules

type GasRules struct {
	MaxEventGas  uint64
	EventGas     uint64
	ParentGas    uint64
	ExtraDataGas uint64
}

func DefaultGasRules

func DefaultGasRules() GasRules

type Genesis

type Genesis struct {
	Accounts    genesis.Accounts
	Storage     genesis.Storage
	Delegations genesis.Delegations
	Blocks      genesis.Blocks
	RawEvmItems genesis.RawEvmItems
	Validators  gpos.Validators

	FirstEpoch    idx.Epoch
	PrevEpochTime inter.Timestamp
	Time          inter.Timestamp
	ExtraData     []byte

	TotalSupply *big.Int

	DriverOwner common.Address

	Rules Rules

	Hash func() hash.Hash
}

type Rules

type Rules struct {
	Name      string
	NetworkID uint64

	// Graph options
	Dag DagRules

	// Epochs options
	Epochs EpochsRules

	// Blockchain options
	Blocks BlocksRules

	// Economy options
	Economy EconomyRules
}

Rules describes opera net. Note keep track of all the non-copiable variables in Copy()

func FakeNetRules

func FakeNetRules() Rules

func MainNetRules

func MainNetRules() Rules

func TestNetRules

func TestNetRules() Rules

func UpdateRules

func UpdateRules(src Rules, diff []byte) (res Rules, err error)

func (Rules) Copy

func (r Rules) Copy() Rules

func (Rules) EvmChainConfig

func (r Rules) EvmChainConfig() *ethparams.ChainConfig

EvmChainConfig returns ChainConfig for transactions signing and execution

func (Rules) String

func (r Rules) String() string

Jump to

Keyboard shortcuts

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