Documentation
¶
Index ¶
- func CanonicalHash(db kv.Getter, number uint64, buf []byte) ([]byte, error)
- func CurrentBlockNumber(db kv.Getter) (*uint64, error)
- func HeadHeaderHash(db kv.Getter) ([]byte, error)
- func HeaderNumber(db kv.Getter, hash []byte) (*uint64, error)
- type AuRaConfig
- type BorConfig
- func (c *BorConfig) CalculateBackupMultiplier(number uint64) uint64
- func (c *BorConfig) CalculatePeriod(number uint64) uint64
- func (c *BorConfig) CalculateProducerDelay(number uint64) uint64
- func (c *BorConfig) CalculateSprint(number uint64) uint64
- func (c *BorConfig) CalculateSprintCount(from, to uint64) int
- func (c *BorConfig) CalculateStateSyncDelay(number uint64) uint64
- func (c *BorConfig) IsDelhi(number uint64) bool
- func (c *BorConfig) IsIndore(number uint64) bool
- func (c *BorConfig) IsJaipur(number uint64) bool
- func (c *BorConfig) IsParallelUniverse(number uint64) bool
- func (b *BorConfig) String() string
- type CliqueConfig
- type Config
- func (c *Config) CheckCompatible(newcfg *Config, height uint64) *ConfigCompatError
- func (c *Config) CheckConfigForkOrder() error
- func (c *Config) GetBlobGasPriceUpdateFraction() uint64
- func (c *Config) GetBurntContract(num uint64) *common.Address
- func (c *Config) GetMaxBlobGasPerBlock() uint64
- func (c *Config) GetMaxBlobsPerBlock() uint64
- func (c *Config) GetMinBlobGasPrice() uint64
- func (c *Config) GetTargetBlobGasPerBlock() uint64
- func (c *Config) IsAgra(num uint64) bool
- func (c *Config) IsArrowGlacier(num uint64) bool
- func (c *Config) IsBerlin(num uint64) bool
- func (c *Config) IsByzantium(num uint64) bool
- func (c *Config) IsCancun(time uint64) bool
- func (c *Config) IsConstantinople(num uint64) bool
- func (c *Config) IsDAOFork(num uint64) bool
- func (c *Config) IsGrayGlacier(num uint64) bool
- func (c *Config) IsHomestead(num uint64) bool
- func (c *Config) IsIstanbul(num uint64) bool
- func (c *Config) IsLondon(num uint64) bool
- func (c *Config) IsMuirGlacier(num uint64) bool
- func (c *Config) IsPetersburg(num uint64) bool
- func (c *Config) IsPrague(time uint64) bool
- func (c *Config) IsShanghai(time uint64) bool
- func (c *Config) IsSpuriousDragon(num uint64) bool
- func (c *Config) IsTangerineWhistle(num uint64) bool
- func (c *Config) Rules(num uint64, time uint64) *Rules
- func (c *Config) String() string
- type ConfigCompatError
- type ConsensusName
- type EthashConfig
- type Rules
- type ValidatorSetJson
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HeadHeaderHash ¶
HeadHeaderHash retrieves the hash of the current canonical head header.
Types ¶
type AuRaConfig ¶
type AuRaConfig struct { StepDuration *uint64 `json:"stepDuration"` // Block duration, in seconds. Validators *ValidatorSetJson `json:"validators"` // Valid authorities // Starting step. Determined automatically if not specified. // To be used for testing only. StartStep *uint64 `json:"startStep"` ValidateScoreTransition *uint64 `json:"validateScoreTransition"` // Block at which score validation should start. ValidateStepTransition *uint64 `json:"validateStepTransition"` // Block from which monotonic steps start. ImmediateTransitions *bool `json:"immediateTransitions"` // Whether transitions should be immediate. BlockReward *uint64 `json:"blockReward"` // Reward per block in wei. // Block at which the block reward contract should start being used. This option allows one to // add a single block reward contract transition and is compatible with the multiple address // option `block_reward_contract_transitions` below. BlockRewardContractTransition *uint64 `json:"blockRewardContractTransition"` /// Block reward contract address which overrides the `block_reward` setting. This option allows /// one to add a single block reward contract address and is compatible with the multiple /// address option `block_reward_contract_transitions` below. BlockRewardContractAddress *common.Address `json:"blockRewardContractAddress"` // Block reward contract addresses with their associated starting block numbers. // // Setting the block reward contract overrides `block_reward`. If the single block reward // contract address is also present then it is added into the map at the block number stored in // `block_reward_contract_transition` or 0 if that block number is not provided. Therefore both // a single block reward contract transition and a map of reward contract transitions can be // used simultaneously in the same configuration. In such a case the code requires that the // block number of the single transition is strictly less than any of the block numbers in the // map. BlockRewardContractTransitions map[uint]common.Address `json:"blockRewardContractTransitions"` // Block at which maximum uncle count should be considered. MaximumUncleCountTransition *uint64 `json:"maximumUncleCountTransition"` // Maximum number of accepted uncles. MaximumUncleCount *uint `json:"maximumUncleCount"` // Strict validation of empty steps transition block. StrictEmptyStepsTransition *uint `json:"strictEmptyStepsTransition"` // The random number contract's address, or a map of contract transitions. RandomnessContractAddress map[uint64]common.Address `json:"randomnessContractAddress"` // The addresses of contracts that determine the block gas limit starting from the block number // associated with each of those contracts. BlockGasLimitContractTransitions map[uint64]common.Address `json:"blockGasLimitContractTransitions"` // The block number at which the consensus engine switches from AuRa to AuRa with POSDAO // modifications. PosdaoTransition *uint64 `json:"PosdaoTransition"` // Stores human-readable keys associated with addresses, like DNS information. // This contract is primarily required to store the address of the Certifier contract. Registrar *common.Address `json:"registrar"` // See https://github.com/gnosischain/specs/blob/master/execution/withdrawals.md WithdrawalContractAddress *common.Address `json:"withdrawalContractAddress"` RewriteBytecode map[uint64]map[common.Address]hexutility.Bytes `json:"rewriteBytecode"` }
AuRaConfig is the consensus engine configs for proof-of-authority based sealing.
func (*AuRaConfig) String ¶
func (c *AuRaConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type BorConfig ¶
type BorConfig struct { Period map[string]uint64 `json:"period"` // Number of seconds between blocks to enforce ProducerDelay map[string]uint64 `json:"producerDelay"` // Number of seconds delay between two producer interval Sprint map[string]uint64 `json:"sprint"` // Epoch length to proposer BackupMultiplier map[string]uint64 `json:"backupMultiplier"` // Backup multiplier to determine the wiggle time ValidatorContract string `json:"validatorContract"` // Validator set contract StateReceiverContract string `json:"stateReceiverContract"` // State receiver contract OverrideStateSyncRecords map[string]int `json:"overrideStateSyncRecords"` // override state records count BlockAlloc map[string]interface{} `json:"blockAlloc"` JaipurBlock *big.Int `json:"jaipurBlock"` // Jaipur switch block (nil = no fork, 0 = already on jaipur) DelhiBlock *big.Int `json:"delhiBlock"` // Delhi switch block (nil = no fork, 0 = already on delhi) IndoreBlock *big.Int `json:"indoreBlock"` // Indore switch block (nil = no fork, 0 = already on indore) AgraBlock *big.Int `json:"agraBlock"` // Agra switch block (nil = no fork, 0 = already in agra) StateSyncConfirmationDelay map[string]uint64 `json:"stateSyncConfirmationDelay"` // StateSync Confirmation Delay, in seconds, to calculate `to` ParallelUniverseBlock *big.Int `json:"parallelUniverseBlock"` // TODO: update all occurrence, change name and finalize number (hardfork for block-stm related changes) // contains filtered or unexported fields }
BorConfig is the consensus engine configs for Matic bor based sealing.
func (*BorConfig) CalculateBackupMultiplier ¶
func (*BorConfig) CalculatePeriod ¶
func (*BorConfig) CalculateProducerDelay ¶
func (*BorConfig) CalculateSprint ¶
func (*BorConfig) CalculateSprintCount ¶
func (*BorConfig) CalculateStateSyncDelay ¶
func (*BorConfig) IsParallelUniverse ¶
TODO: modify this function once the block number is finalized
type CliqueConfig ¶
type CliqueConfig struct { Period uint64 `json:"period"` // Number of seconds between blocks to enforce Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint }
CliqueConfig is the consensus engine configs for proof-of-authority based sealing.
func (*CliqueConfig) String ¶
func (c *CliqueConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type Config ¶
type Config struct { ChainName string ChainID *big.Int `json:"chainId"` // chainId identifies the current chain and is used for replay protection Consensus 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"` // Optional EIP-4844 parameters MinBlobGasPrice *uint64 `json:"minBlobGasPrice,omitempty"` MaxBlobGasPerBlock *uint64 `json:"maxBlobGasPerBlock,omitempty"` TargetBlobGasPerBlock *uint64 `json:"targetBlobGasPerBlock,omitempty"` BlobGasPriceUpdateFraction *uint64 `json:"blobGasPriceUpdateFraction,omitempty"` // (Optional) governance contract where EIP-1559 fees will be sent to that otherwise would be burnt since the London fork BurntContract map[string]common.Address `json:"burntContract,omitempty"` // Various consensus engines Ethash *EthashConfig `json:"ethash,omitempty"` Clique *CliqueConfig `json:"clique,omitempty"` Aura *AuRaConfig `json:"aura,omitempty"` Bor *BorConfig `json:"bor,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) *ConfigCompatError
CheckCompatible checks whether scheduled fork transitions have been imported with a mismatching chain configuration.
func (*Config) CheckConfigForkOrder ¶
CheckConfigForkOrder checks that we don't "skip" any forks
func (*Config) GetBlobGasPriceUpdateFraction ¶
func (*Config) GetMaxBlobGasPerBlock ¶
func (*Config) GetMaxBlobsPerBlock ¶
func (*Config) GetMinBlobGasPrice ¶
func (*Config) GetTargetBlobGasPerBlock ¶
func (*Config) IsAgra ¶
IsAgra returns whether num is either equal to the Agra fork block or greater. The Agra hard fork is based on the Shanghai hard fork, but it doesn't include withdrawals. Also Agra is activated based on the block number rather than the timestamp. Refer to https://forum.polygon.technology/t/pip-28-agra-hardfork
func (*Config) IsArrowGlacier ¶
IsArrowGlacier returns whether num is either equal to the Arrow Glacier (EIP-4345) fork block or greater.
func (*Config) IsBerlin ¶
IsBerlin returns whether num is either equal to the Berlin fork block or greater.
func (*Config) IsByzantium ¶
IsByzantium returns whether num is either equal to the Byzantium fork block or greater.
func (*Config) IsCancun ¶
IsCancun returns whether time is either equal to the Cancun fork time or greater.
func (*Config) IsConstantinople ¶
IsConstantinople returns whether num is either equal to the Constantinople fork block or greater.
func (*Config) IsDAOFork ¶
IsDAOFork returns whether num is either equal to the DAO fork block or greater.
func (*Config) IsGrayGlacier ¶
IsGrayGlacier returns whether num is either equal to the Gray Glacier (EIP-5133) fork block or greater.
func (*Config) IsHomestead ¶
IsHomestead returns whether num is either equal to the homestead block or greater.
func (*Config) IsIstanbul ¶
IsIstanbul returns whether num is either equal to the Istanbul fork block or greater.
func (*Config) IsLondon ¶
IsLondon returns whether num is either equal to the London fork block or greater.
func (*Config) IsMuirGlacier ¶
IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater.
func (*Config) IsPetersburg ¶
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 ¶
IsPrague returns whether time is either equal to the Prague fork time or greater.
func (*Config) IsShanghai ¶
IsShanghai returns whether time is either equal to the Shanghai fork time or greater.
func (*Config) IsSpuriousDragon ¶
IsSpuriousDragon returns whether num is either equal to the Spurious Dragon fork block or greater.
func (*Config) IsTangerineWhistle ¶
IsTangerineWhistle returns whether num is either equal to the Tangerine Whistle (EIP150) fork block or greater.
type ConfigCompatError ¶
type ConfigCompatError struct { What string // block numbers of the stored and new configurations StoredConfig, NewConfig *big.Int // the block number to which the local chain must be rewound to correct the error RewindTo uint64 }
ConfigCompatError is raised if the locally-stored blockchain is initialised with a ChainConfig that would alter the past.
func (*ConfigCompatError) Error ¶
func (err *ConfigCompatError) Error() string
type ConsensusName ¶
type ConsensusName string
const ( AuRaConsensus ConsensusName = "aura" EtHashConsensus ConsensusName = "ethash" CliqueConsensus ConsensusName = "clique" BorConsensus ConsensusName = "bor" )
type EthashConfig ¶
type EthashConfig struct{}
EthashConfig is the consensus engine configs for proof-of-work based sealing.
func (*EthashConfig) String ¶
func (c *EthashConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type Rules ¶
type Rules struct { ChainID *big.Int IsHomestead, IsTangerineWhistle, IsSpuriousDragon bool IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool IsBerlin, IsLondon, IsShanghai, IsCancun, IsPrague bool IsAura 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.
type ValidatorSetJson ¶
type ValidatorSetJson struct { // A simple list of authorities. List []common.Address `json:"list"` // Address of a contract that indicates the list of authorities. SafeContract *common.Address `json:"safeContract"` // Address of a contract that indicates the list of authorities and enables reporting of their misbehaviour using transactions. Contract *common.Address `json:"contract"` // A map of starting blocks for each validator set. Multi map[uint64]*ValidatorSetJson `json:"multi"` }
Different ways of specifying validators.