photon

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MainNetworkID   uint64 = 0xa09
	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 Sirius 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 RulesRLP

Rules describes photon 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) DecodeRLP

func (r *Rules) DecodeRLP(s *rlp.Stream) error

DecodeRLP is for RLP serialization.

func (Rules) EncodeRLP

func (r Rules) EncodeRLP(w io.Writer) error

EncodeRLP is for RLP serialization.

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

type RulesRLP

type RulesRLP struct {
	Name      string
	NetworkID uint64

	// Graph options
	Dag DagRules

	// Epochs options
	Epochs EpochsRules

	// Blockchain options
	Blocks BlocksRules

	// Economy options
	Economy EconomyRules

	Upgrades Upgrades `rlp:"-"`
}

type Upgrades

type Upgrades struct {
	Berlin bool
}

Jump to

Keyboard shortcuts

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