chain

package
v0.0.0-...-92d349b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ChainName string
	ChainID   *big.Int `json:"chainId"` // chainId identifies the current chain and is used for replay protection

	Consensus chain.ConsensusName `json:"consensus,omitempty"` // aura, ethash or clique

	// ETH mainnet upgrades
	// See https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades
	HomesteadBlock        *big.Int `json:"homesteadBlock,omitempty"`
	DAOForkBlock          *big.Int `json:"daoForkBlock,omitempty"`
	TangerineWhistleBlock *big.Int `json:"eip150Block,omitempty"`
	SpuriousDragonBlock   *big.Int `json:"eip155Block,omitempty"`
	ByzantiumBlock        *big.Int `json:"byzantiumBlock,omitempty"`
	ConstantinopleBlock   *big.Int `json:"constantinopleBlock,omitempty"`
	PetersburgBlock       *big.Int `json:"petersburgBlock,omitempty"`
	IstanbulBlock         *big.Int `json:"istanbulBlock,omitempty"`
	MuirGlacierBlock      *big.Int `json:"muirGlacierBlock,omitempty"`
	BerlinBlock           *big.Int `json:"berlinBlock,omitempty"`
	LondonBlock           *big.Int `json:"londonBlock,omitempty"`
	ArrowGlacierBlock     *big.Int `json:"arrowGlacierBlock,omitempty"`
	GrayGlacierBlock      *big.Int `json:"grayGlacierBlock,omitempty"`

	// EIP-3675: Upgrade consensus to Proof-of-Stake (a.k.a. "Paris", "The Merge")
	TerminalTotalDifficulty       *big.Int `json:"terminalTotalDifficulty,omitempty"`       // The merge happens when terminal total difficulty is reached
	TerminalTotalDifficultyPassed bool     `json:"terminalTotalDifficultyPassed,omitempty"` // Disable PoW sync for networks that have already passed through the Merge
	MergeNetsplitBlock            *big.Int `json:"mergeNetsplitBlock,omitempty"`            // Virtual fork after The Merge to use as a network splitter; see FORK_NEXT_VALUE in EIP-3675

	// Mainnet fork scheduling switched from block numbers to timestamps after The Merge
	ShanghaiTime *big.Int `json:"shanghaiTime,omitempty"`
	CancunTime   *big.Int `json:"cancunTime,omitempty"`
	PragueTime   *big.Int `json:"pragueTime,omitempty"`

	Eip1559FeeCollector           *common.Address `json:"eip1559FeeCollector,omitempty"`           // (Optional) Address where burnt EIP-1559 fees go to
	Eip1559FeeCollectorTransition *big.Int        `json:"eip1559FeeCollectorTransition,omitempty"` // (Optional) Block from which burnt EIP-1559 fees go to the Eip1559FeeCollector

	// Various consensus engines
	Ethash *chain.EthashConfig `json:"ethash,omitempty"`
	Clique *chain.CliqueConfig `json:"clique,omitempty"`
	Aura   *chain.AuRaConfig   `json:"aura,omitempty"`
	Bor    *chain.BorConfig    `json:"bor,omitempty"`

	//zkEVM updates
	MordorBlock *big.Int `json:"mordorBlock,omitempty"`
}

Config is the core config which determines the blockchain settings.

Config is stored in the database on a per block basis. This means that any network, identified by its genesis block, can have its own set of configuration options.

func (*Config) CheckCompatible

func (c *Config) CheckCompatible(newcfg *Config, height uint64) *chain.ConfigCompatError

CheckCompatible checks whether scheduled fork transitions have been imported with a mismatching chain configuration.

func (*Config) CheckConfigForkOrder

func (c *Config) CheckConfigForkOrder() error

CheckConfigForkOrder checks that we don't "skip" any forks

func (*Config) IsArrowGlacier

func (c *Config) IsArrowGlacier(num uint64) bool

IsArrowGlacier returns whether num is either equal to the Arrow Glacier (EIP-4345) fork block or greater.

func (*Config) IsBerlin

func (c *Config) IsBerlin(num uint64) bool

IsBerlin returns whether num is either equal to the Berlin fork block or greater.

func (*Config) IsByzantium

func (c *Config) IsByzantium(num uint64) bool

IsByzantium returns whether num is either equal to the Byzantium fork block or greater.

func (*Config) IsCancun

func (c *Config) IsCancun(time uint64) bool

IsCancun returns whether time is either equal to the Cancun fork time or greater.

func (*Config) IsConstantinople

func (c *Config) IsConstantinople(num uint64) bool

IsConstantinople returns whether num is either equal to the Constantinople fork block or greater.

func (*Config) IsDAOFork

func (c *Config) IsDAOFork(num uint64) bool

IsDAOFork returns whether num is either equal to the DAO fork block or greater.

func (*Config) IsEip1559FeeCollector

func (c *Config) IsEip1559FeeCollector(num uint64) bool

func (*Config) IsGrayGlacier

func (c *Config) IsGrayGlacier(num uint64) bool

IsGrayGlacier returns whether num is either equal to the Gray Glacier (EIP-5133) fork block or greater.

func (*Config) IsHomestead

func (c *Config) IsHomestead(num uint64) bool

IsHomestead returns whether num is either equal to the homestead block or greater.

func (*Config) IsIstanbul

func (c *Config) IsIstanbul(num uint64) bool

IsIstanbul returns whether num is either equal to the Istanbul fork block or greater.

func (*Config) IsLondon

func (c *Config) IsLondon(num uint64) bool

IsLondon returns whether num is either equal to the London fork block or greater.

func (*Config) IsMordor

func (c *Config) IsMordor(num uint64) bool

func (*Config) IsMuirGlacier

func (c *Config) IsMuirGlacier(num uint64) bool

IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater.

func (*Config) IsPetersburg

func (c *Config) IsPetersburg(num uint64) bool

IsPetersburg returns whether num is either - equal to or greater than the PetersburgBlock fork block, - OR is nil, and Constantinople is active

func (*Config) IsPrague

func (c *Config) IsPrague(time uint64) bool

IsPrague returns whether time is either equal to the Prague fork time or greater.

func (*Config) IsShanghai

func (c *Config) IsShanghai(time uint64) bool

IsShanghai returns whether time is either equal to the Shanghai fork time or greater.

func (*Config) IsSpuriousDragon

func (c *Config) IsSpuriousDragon(num uint64) bool

IsSpuriousDragon returns whether num is either equal to the Spurious Dragon fork block or greater.

func (*Config) IsTangerineWhistle

func (c *Config) IsTangerineWhistle(num uint64) bool

IsTangerineWhistle returns whether num is either equal to the Tangerine Whistle (EIP150) fork block or greater.

func (*Config) Rules

func (c *Config) Rules(num uint64, time uint64) *Rules

Rules ensures c's ChainID is not nil and returns a new Rules instance

func (*Config) String

func (c *Config) String() string

type Rules

type Rules struct {
	ChainID                                                 *big.Int
	IsHomestead, IsTangerineWhistle, IsSpuriousDragon       bool
	IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
	IsBerlin, IsLondon, IsShanghai, IsCancun, IsPrague      bool
	IsEip1559FeeCollector, IsAura, IsMordor                 bool
}

Rules is syntactic sugar over Config. It can be used for functions that do not have or require information about the block.

Rules is a one time interface meaning that it shouldn't be used in between transition phases.

Jump to

Keyboard shortcuts

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