state

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: GPL-3.0 Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ForkEpoch

type ForkEpoch struct {
	Epoch   phase0.Epoch `yaml:"epoch"`
	Version string       `json:"version"`
	Name    string       `json:"name"`
}

ForkEpoch is a beacon fork that activates at a specific epoch.

func (*ForkEpoch) Active

func (f *ForkEpoch) Active(slot, slotsPerEpoch phase0.Slot) bool

Active returns true if the fork is active at the given slot.

type ForkEpochs

type ForkEpochs []*ForkEpoch

ForkEpochs is a list of forks that activate at specific epochs.

func (*ForkEpochs) Active

func (f *ForkEpochs) Active(slot, slotsPerEpoch phase0.Slot) []*ForkEpoch

Active returns a list of forks that are active at the given slot.

func (*ForkEpochs) AsScheduledForks

func (f *ForkEpochs) AsScheduledForks() ([]*ScheduledFork, error)

AsScheduledForks returns the forks as scheduled forks.

func (*ForkEpochs) CurrentFork

func (f *ForkEpochs) CurrentFork(slot, slotsPerEpoch phase0.Slot) (*ForkEpoch, error)

CurrentFork returns the current fork at the given slot.

func (*ForkEpochs) GetByName

func (f *ForkEpochs) GetByName(name string) (*ForkEpoch, error)

GetByName returns the fork with the given name.

func (*ForkEpochs) PreviousFork

func (f *ForkEpochs) PreviousFork(slot, slotsPerEpoch phase0.Slot) (*ForkEpoch, error)

PreviousFork returns the previous fork at the given slot.

func (*ForkEpochs) Scheduled

func (f *ForkEpochs) Scheduled(slot, slotsPerEpoch phase0.Slot) []*ForkEpoch

CurrentFork returns the current fork at the given slot.

type ScheduledFork

type ScheduledFork struct {
	CurrentVersion  string `json:"current_version"`
	Epoch           string `json:"epoch"`
	PreviousVersion string `json:"previous_version"`
}

ScheduledFork is an upcoming fork.

func ForkScheduleFromForkEpochs

func ForkScheduleFromForkEpochs(forks ForkEpochs) ([]*ScheduledFork, error)

ForkScheduleFromForkEpochs returns a fork schedule from a list of forks.

type Spec

type Spec struct {
	PresetBase string `json:"PRESET_BASE"`
	ConfigName string `json:"CONFIG_NAME"`

	DepositChainID         uint64 `json:"DEPOSIT_CHAIN_ID,string"`
	DepositContractAddress string `json:"DEPOSIT_CONTRACT_ADDRESS"`

	SafeSlotsToUpdateJustified phase0.Slot `json:"SAFE_SLOTS_TO_UPDATE_JUSTIFIED,string"`
	SlotsPerEpoch              phase0.Slot `json:"SLOTS_PER_EPOCH,string"`

	EpochsPerSyncCommitteePeriod phase0.Epoch `json:"EPOCHS_PER_SYNC_COMMITTEE_PERIOD,string"`
	MinSyncCommitteeParticipants uint64       `json:"MIN_SYNC_COMMITTEE_PARTICIPANTS,string"`
	TargetCommitteeSize          uint64       `json:"TARGET_COMMITTEE_SIZE,string"`
	SyncCommitteeSize            uint64       `json:"SYNC_COMMITTEE_SIZE,string"`

	TerminalBlockHashActivationEpoch phase0.Epoch `json:"TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH,string"`
	TerminalTotalDifficulty          big.Int      `json:"-"`

	MaxValidatorsPerCommittee uint64      `json:"MAX_VALIDATORS_PER_COMMITTEE,string"`
	BaseRewardFactor          uint64      `json:"BASE_REWARD_FACTOR,string"`
	EffectiveBalanceIncrement phase0.Gwei `json:"EFFECTIVE_BALANCE_INCREMENT,string"`
	MaxEffectiveBalance       phase0.Gwei `json:"MAX_EFFECTIVE_BALANCE,string"`
	MinDepositAmount          phase0.Gwei `json:"MIN_DEPOSIT_AMOUNT,string"`
	MaxAttestations           uint64      `json:"MAX_ATTESTATIONS,string"`

	SecondsPerEth1Block            StringerDuration `json:"SECONDS_PER_ETH1_BLOCK,string"`
	GenesisDelay                   StringerDuration `json:"GENESIS_DELAY,string"`
	SecondsPerSlot                 StringerDuration `json:"SECONDS_PER_SLOT,string"`
	MaxDeposits                    uint64           `json:"MAX_DEPOSITS,string"`
	MinGenesisActiveValidatorCount uint64           `json:"MIN_GENESIS_ACTIVE_VALIDATOR_COUNT,string"`
	Eth1FollowDistance             uint64           `json:"ETH1_FOLLOW_DISTANCE,string"`

	ForkEpochs ForkEpochs `json:"-"`
}

Spec represents the state of the spec.

func NewSpec

func NewSpec(data map[string]interface{}) Spec

NewSpec creates a new spec instance.

func (*Spec) Validate

func (s *Spec) Validate() error

Validate performs basic validation of the spec.

type StringerDuration

type StringerDuration time.Duration

StringerDuration is a time.Duration that can be marshalled to JSON as a string.

func (StringerDuration) AsDuration

func (s StringerDuration) AsDuration() time.Duration

AsDuration returns the duration as a time.Duration.

func (StringerDuration) MarshalJSON

func (s StringerDuration) MarshalJSON() ([]byte, error)

func (*StringerDuration) UnmarshalJSON

func (s *StringerDuration) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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