time

package
v5.2.0-rc.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanProcessEpoch

func CanProcessEpoch(state state.ReadOnlyBeaconState) bool

CanProcessEpoch checks the eligibility to process epoch. The epoch can be processed at the end of the last slot of every epoch.

Spec pseudocode definition:

If (state.slot + 1) % SLOTS_PER_EPOCH == 0:

func CanUpgradeToAltair

func CanUpgradeToAltair(slot primitives.Slot) bool

CanUpgradeToAltair returns true if the input `slot` can upgrade to Altair. Spec code: If state.slot % SLOTS_PER_EPOCH == 0 and compute_epoch_at_slot(state.slot) == ALTAIR_FORK_EPOCH

func CanUpgradeToBellatrix

func CanUpgradeToBellatrix(slot primitives.Slot) bool

CanUpgradeToBellatrix returns true if the input `slot` can upgrade to Bellatrix fork.

Spec code: If state.slot % SLOTS_PER_EPOCH == 0 and compute_epoch_at_slot(state.slot) == BELLATRIX_FORK_EPOCH

func CanUpgradeToCapella

func CanUpgradeToCapella(slot primitives.Slot) bool

CanUpgradeToCapella returns true if the input `slot` can upgrade to Capella. Spec code: If state.slot % SLOTS_PER_EPOCH == 0 and compute_epoch_at_slot(state.slot) == CAPELLA_FORK_EPOCH

func CanUpgradeToDeneb

func CanUpgradeToDeneb(slot primitives.Slot) bool

CanUpgradeToDeneb returns true if the input `slot` can upgrade to Deneb. Spec code: If state.slot % SLOTS_PER_EPOCH == 0 and compute_epoch_at_slot(state.slot) == DENEB_FORK_EPOCH

func CanUpgradeToElectra added in v5.1.0

func CanUpgradeToElectra(slot primitives.Slot) bool

CanUpgradeToElectra returns true if the input `slot` can upgrade to Electra. Spec code: If state.slot % SLOTS_PER_EPOCH == 0 and compute_epoch_at_slot(state.slot) == ELECTRA_FORK_EPOCH

func CurrentEpoch

func CurrentEpoch(state state.ReadOnlyBeaconState) primitives.Epoch

CurrentEpoch returns the current epoch number calculated from the slot number stored in beacon state.

Spec pseudocode definition:

def get_current_epoch(state: BeaconState) -> Epoch:
  """
  Return the current epoch.
  """
  return compute_epoch_at_slot(state.slot)

func HigherEqualThanAltairVersionAndEpoch

func HigherEqualThanAltairVersionAndEpoch(s state.BeaconState, e primitives.Epoch) bool

HigherEqualThanAltairVersionAndEpoch returns if the input state `s` has a higher version number than Altair state and input epoch `e` is higher equal than fork epoch.

func NextEpoch

func NextEpoch(state state.ReadOnlyBeaconState) primitives.Epoch

NextEpoch returns the next epoch number calculated from the slot number stored in beacon state.

func PrevEpoch

func PrevEpoch(state state.ReadOnlyBeaconState) primitives.Epoch

PrevEpoch returns the previous epoch number calculated from the slot number stored in beacon state. It also checks for underflow condition.

Spec pseudocode definition:

def get_previous_epoch(state: BeaconState) -> Epoch:
  """`
  Return the previous epoch (unless the current epoch is ``GENESIS_EPOCH``).
  """
  current_epoch = get_current_epoch(state)
  return GENESIS_EPOCH if current_epoch == GENESIS_EPOCH else Epoch(current_epoch - 1)

Types

This section is empty.

Jump to

Keyboard shortcuts

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