forks

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package forks contains useful helpers for Ethereum consensus fork-related functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateForkDigest

func CreateForkDigest(
	genesisTime time.Time,
	genesisValidatorsRoot []byte,
) ([4]byte, error)

CreateForkDigest creates a fork digest from a genesis time and genesis validators root, utilizing the current slot to determine the active fork version in the node.

func Fork

func Fork(
	targetEpoch types.Epoch,
) (*ethpb.Fork, error)

Fork given a target epoch, returns the active fork version during this epoch.

func ForkDigestFromEpoch

func ForkDigestFromEpoch(currentEpoch types.Epoch, genesisValidatorsRoot []byte) ([4]byte, error)

ForkDigestFromEpoch retrieves the fork digest from the current schedule determined by the provided epoch.

func IsForkNextEpoch

func IsForkNextEpoch(genesisTime time.Time, genesisValidatorsRoot []byte) (bool, error)

IsForkNextEpoch checks if an alloted fork is in the following epoch.

func NextForkData

func NextForkData(currEpoch types.Epoch) ([4]byte, types.Epoch, error)

NextForkData retrieves the next fork data according to the provided current epoch.

func RetrieveForkDataFromDigest

func RetrieveForkDataFromDigest(digest [4]byte, genesisValidatorsRoot []byte) ([4]byte, types.Epoch, error)

RetrieveForkDataFromDigest performs the inverse, where it tries to determine the fork version and epoch from a provided digest by looping through our current fork schedule.

func SortedForkVersions

func SortedForkVersions(forkSchedule map[[4]byte]types.Epoch) [][4]byte

SortedForkVersions sorts the provided fork schedule in ascending order by epoch.

Types

This section is empty.

Jump to

Keyboard shortcuts

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