merge

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeaconBlockBodyType

func BeaconBlockBodyType(spec *common.Spec) *ContainerTypeDef

func BeaconBlockType

func BeaconBlockType(spec *common.Spec) *ContainerTypeDef

func BeaconStateType

func BeaconStateType(spec *common.Spec) *ContainerTypeDef

func ProcessExecutionPayload added in v0.16.0

func ProcessExecutionPayload(ctx context.Context, spec *common.Spec, state ExecutionTrackingBeaconState, executionPayload *common.ExecutionPayload, engine common.ExecutionEngine) error

func SignedBeaconBlockType

func SignedBeaconBlockType(spec *common.Spec) *ContainerTypeDef

Types

type BeaconBlock

type BeaconBlock struct {
	Slot          common.Slot           `json:"slot" yaml:"slot"`
	ProposerIndex common.ValidatorIndex `json:"proposer_index" yaml:"proposer_index"`
	ParentRoot    common.Root           `json:"parent_root" yaml:"parent_root"`
	StateRoot     common.Root           `json:"state_root" yaml:"state_root"`
	Body          BeaconBlockBody       `json:"body" yaml:"body"`
}

func (*BeaconBlock) ByteLength

func (b *BeaconBlock) ByteLength(spec *common.Spec) uint64

func (*BeaconBlock) Deserialize

func (b *BeaconBlock) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*BeaconBlock) FixedLength

func (a *BeaconBlock) FixedLength(*common.Spec) uint64

func (*BeaconBlock) HashTreeRoot

func (b *BeaconBlock) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*BeaconBlock) Header

func (block *BeaconBlock) Header(spec *common.Spec) *common.BeaconBlockHeader

func (*BeaconBlock) Serialize

func (b *BeaconBlock) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type BeaconBlockBody

type BeaconBlockBody struct {
	RandaoReveal common.BLSSignature `json:"randao_reveal" yaml:"randao_reveal"`
	Eth1Data     common.Eth1Data     `json:"eth1_data" yaml:"eth1_data"`
	Graffiti     common.Root         `json:"graffiti" yaml:"graffiti"`

	ProposerSlashings phase0.ProposerSlashings `json:"proposer_slashings" yaml:"proposer_slashings"`
	AttesterSlashings phase0.AttesterSlashings `json:"attester_slashings" yaml:"attester_slashings"`
	Attestations      phase0.Attestations      `json:"attestations" yaml:"attestations"`
	Deposits          phase0.Deposits          `json:"deposits" yaml:"deposits"`
	VoluntaryExits    phase0.VoluntaryExits    `json:"voluntary_exits" yaml:"voluntary_exits"`

	ExecutionPayload common.ExecutionPayload `json:"execution_payload" yaml:"execution_payload"`
}

func (*BeaconBlockBody) ByteLength

func (b *BeaconBlockBody) ByteLength(spec *common.Spec) uint64

func (BeaconBlockBody) CheckLimits

func (b BeaconBlockBody) CheckLimits(spec *common.Spec) error

func (*BeaconBlockBody) Deserialize

func (b *BeaconBlockBody) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*BeaconBlockBody) FixedLength

func (a *BeaconBlockBody) FixedLength(*common.Spec) uint64

func (*BeaconBlockBody) HashTreeRoot

func (b *BeaconBlockBody) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*BeaconBlockBody) Serialize

func (b *BeaconBlockBody) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type BeaconState

type BeaconState struct {
	// Versioning
	GenesisTime           common.Timestamp `json:"genesis_time" yaml:"genesis_time"`
	GenesisValidatorsRoot common.Root      `json:"genesis_validators_root" yaml:"genesis_validators_root"`
	Slot                  common.Slot      `json:"slot" yaml:"slot"`
	Fork                  common.Fork      `json:"fork" yaml:"fork"`
	// History
	LatestBlockHeader common.BeaconBlockHeader    `json:"latest_block_header" yaml:"latest_block_header"`
	BlockRoots        phase0.HistoricalBatchRoots `json:"block_roots" yaml:"block_roots"`
	StateRoots        phase0.HistoricalBatchRoots `json:"state_roots" yaml:"state_roots"`
	HistoricalRoots   phase0.HistoricalRoots      `json:"historical_roots" yaml:"historical_roots"`
	// Eth1
	Eth1Data      common.Eth1Data      `json:"eth1_data" yaml:"eth1_data"`
	Eth1DataVotes phase0.Eth1DataVotes `json:"eth1_data_votes" yaml:"eth1_data_votes"`
	DepositIndex  common.DepositIndex  `json:"eth1_deposit_index" yaml:"eth1_deposit_index"`
	// Registry
	Validators  phase0.ValidatorRegistry `json:"validators" yaml:"validators"`
	Balances    phase0.Balances          `json:"balances" yaml:"balances"`
	RandaoMixes phase0.RandaoMixes       `json:"randao_mixes" yaml:"randao_mixes"`
	Slashings   phase0.SlashingsHistory  `json:"slashings" yaml:"slashings"`
	// Attestations
	PreviousEpochAttestations phase0.PendingAttestations `json:"previous_epoch_attestations" yaml:"previous_epoch_attestations"`
	CurrentEpochAttestations  phase0.PendingAttestations `json:"current_epoch_attestations" yaml:"current_epoch_attestations"`
	// Finality
	JustificationBits           common.JustificationBits `json:"justification_bits" yaml:"justification_bits"`
	PreviousJustifiedCheckpoint common.Checkpoint        `json:"previous_justified_checkpoint" yaml:"previous_justified_checkpoint"`
	CurrentJustifiedCheckpoint  common.Checkpoint        `json:"current_justified_checkpoint" yaml:"current_justified_checkpoint"`
	FinalizedCheckpoint         common.Checkpoint        `json:"finalized_checkpoint" yaml:"finalized_checkpoint"`
	// Execution-layer
	LatestExecutionPayloadHeader common.ExecutionPayloadHeader `json:"latest_execution_payload_header" yaml:"latest_execution_payload_header"`
}

func (*BeaconState) ByteLength

func (v *BeaconState) ByteLength(spec *common.Spec) uint64

func (*BeaconState) Deserialize

func (v *BeaconState) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*BeaconState) FixedLength

func (*BeaconState) FixedLength(*common.Spec) uint64

func (*BeaconState) HashTreeRoot

func (v *BeaconState) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*BeaconState) Serialize

func (v *BeaconState) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

type BeaconStateView

type BeaconStateView struct {
	*ContainerView
}

func AsBeaconStateView

func AsBeaconStateView(v View, err error) (*BeaconStateView, error)

To load a state:

state, err := beacon.AsBeaconStateView(beacon.BeaconStateType.Deserialize(codec.NewDecodingReader(reader, size)))

func NewBeaconStateView

func NewBeaconStateView(spec *common.Spec) *BeaconStateView

func (*BeaconStateView) AddValidator

func (state *BeaconStateView) AddValidator(spec *common.Spec, pub common.BLSPubkey, withdrawalCreds common.Root, balance common.Gwei) error

func (*BeaconStateView) Balances

func (state *BeaconStateView) Balances() (common.Balances, error)

func (*BeaconStateView) BlockRoots

func (state *BeaconStateView) BlockRoots() (common.BatchRoots, error)

func (*BeaconStateView) CopyState added in v0.16.0

func (state *BeaconStateView) CopyState() (common.BeaconState, error)

func (*BeaconStateView) CurrentEpochAttestations

func (state *BeaconStateView) CurrentEpochAttestations() (*phase0.PendingAttestationsView, error)

func (*BeaconStateView) CurrentJustifiedCheckpoint

func (state *BeaconStateView) CurrentJustifiedCheckpoint() (common.Checkpoint, error)

func (*BeaconStateView) DepositIndex

func (state *BeaconStateView) DepositIndex() (common.DepositIndex, error)

func (*BeaconStateView) Eth1Data

func (state *BeaconStateView) Eth1Data() (common.Eth1Data, error)

func (*BeaconStateView) Eth1DataVotes

func (state *BeaconStateView) Eth1DataVotes() (common.Eth1DataVotes, error)

func (*BeaconStateView) FinalizedCheckpoint

func (state *BeaconStateView) FinalizedCheckpoint() (common.Checkpoint, error)

func (*BeaconStateView) Fork

func (state *BeaconStateView) Fork() (common.Fork, error)

func (*BeaconStateView) ForkSettings

func (state *BeaconStateView) ForkSettings(spec *common.Spec) *common.ForkSettings

func (*BeaconStateView) GenesisTime

func (state *BeaconStateView) GenesisTime() (common.Timestamp, error)

func (*BeaconStateView) GenesisValidatorsRoot

func (state *BeaconStateView) GenesisValidatorsRoot() (common.Root, error)

func (*BeaconStateView) HistoricalRoots

func (state *BeaconStateView) HistoricalRoots() (common.HistoricalRoots, error)

func (*BeaconStateView) IncrementDepositIndex

func (state *BeaconStateView) IncrementDepositIndex() error

func (*BeaconStateView) IsExecutionEnabled added in v0.16.0

func (state *BeaconStateView) IsExecutionEnabled(spec *common.Spec, block *BeaconBlock) (bool, error)

func (*BeaconStateView) IsTransitionBlock added in v0.16.0

func (state *BeaconStateView) IsTransitionBlock(spec *common.Spec, block *BeaconBlock) (bool, error)

func (*BeaconStateView) IsTransitionCompleted added in v0.16.0

func (state *BeaconStateView) IsTransitionCompleted() (bool, error)

func (*BeaconStateView) JustificationBits

func (state *BeaconStateView) JustificationBits() (common.JustificationBits, error)

func (*BeaconStateView) LatestBlockHeader

func (state *BeaconStateView) LatestBlockHeader() (*common.BeaconBlockHeader, error)

func (*BeaconStateView) LatestExecutionPayloadHeader

func (state *BeaconStateView) LatestExecutionPayloadHeader() (*common.ExecutionPayloadHeaderView, error)

func (*BeaconStateView) PreviousEpochAttestations

func (state *BeaconStateView) PreviousEpochAttestations() (*phase0.PendingAttestationsView, error)

func (*BeaconStateView) PreviousJustifiedCheckpoint

func (state *BeaconStateView) PreviousJustifiedCheckpoint() (common.Checkpoint, error)

func (*BeaconStateView) ProcessBlock

func (state *BeaconStateView) ProcessBlock(ctx context.Context, spec *common.Spec, epc *common.EpochsContext, benv *common.BeaconBlockEnvelope) error

func (*BeaconStateView) ProcessEpoch

func (state *BeaconStateView) ProcessEpoch(ctx context.Context, spec *common.Spec, epc *common.EpochsContext) error

func (*BeaconStateView) RandaoMixes

func (state *BeaconStateView) RandaoMixes() (common.RandaoMixes, error)

func (*BeaconStateView) Raw

func (state *BeaconStateView) Raw(spec *common.Spec) (*BeaconState, error)

Raw converts the tree-structured state into a flattened native Go structure.

func (*BeaconStateView) SeedRandao

func (state *BeaconStateView) SeedRandao(spec *common.Spec, seed common.Root) error

func (*BeaconStateView) SetBalances added in v0.16.0

func (state *BeaconStateView) SetBalances(balances *phase0.RegistryBalancesView) error

func (*BeaconStateView) SetCurrentJustifiedCheckpoint

func (state *BeaconStateView) SetCurrentJustifiedCheckpoint(c common.Checkpoint) error

func (*BeaconStateView) SetEth1Data

func (state *BeaconStateView) SetEth1Data(v common.Eth1Data) error

func (*BeaconStateView) SetFinalizedCheckpoint

func (state *BeaconStateView) SetFinalizedCheckpoint(c common.Checkpoint) error

func (*BeaconStateView) SetFork

func (state *BeaconStateView) SetFork(f common.Fork) error

func (*BeaconStateView) SetGenesisTime

func (state *BeaconStateView) SetGenesisTime(t common.Timestamp) error

func (*BeaconStateView) SetGenesisValidatorsRoot

func (state *BeaconStateView) SetGenesisValidatorsRoot(r common.Root) error

func (*BeaconStateView) SetJustificationBits

func (state *BeaconStateView) SetJustificationBits(bits common.JustificationBits) error

func (*BeaconStateView) SetLatestBlockHeader

func (state *BeaconStateView) SetLatestBlockHeader(v *common.BeaconBlockHeader) error

func (*BeaconStateView) SetLatestExecutionPayloadHeader

func (state *BeaconStateView) SetLatestExecutionPayloadHeader(h *common.ExecutionPayloadHeader) error

func (*BeaconStateView) SetPreviousJustifiedCheckpoint

func (state *BeaconStateView) SetPreviousJustifiedCheckpoint(c common.Checkpoint) error

func (*BeaconStateView) SetSlot

func (state *BeaconStateView) SetSlot(slot common.Slot) error

func (*BeaconStateView) Slashings

func (state *BeaconStateView) Slashings() (common.Slashings, error)

func (*BeaconStateView) Slot

func (state *BeaconStateView) Slot() (common.Slot, error)

func (*BeaconStateView) StateRoots

func (state *BeaconStateView) StateRoots() (common.BatchRoots, error)

func (*BeaconStateView) Validators

func (state *BeaconStateView) Validators() (common.ValidatorRegistry, error)

type ExecutionTrackingBeaconState added in v0.16.0

type ExecutionTrackingBeaconState interface {
	common.BeaconState

	LatestExecutionPayloadHeader() (*common.ExecutionPayloadHeaderView, error)
	SetLatestExecutionPayloadHeader(h *common.ExecutionPayloadHeader) error
}

type ExecutionUpgradeBeaconState added in v0.16.0

type ExecutionUpgradeBeaconState interface {
	IsExecutionEnabled(spec *common.Spec, block *BeaconBlock) (bool, error)
	IsTransitionCompleted() (bool, error)
	IsTransitionBlock(spec *common.Spec, block *BeaconBlock) (bool, error)
}

type SignedBeaconBlock

type SignedBeaconBlock struct {
	Message   BeaconBlock         `json:"message" yaml:"message"`
	Signature common.BLSSignature `json:"signature" yaml:"signature"`
}

func (*SignedBeaconBlock) ByteLength

func (b *SignedBeaconBlock) ByteLength(spec *common.Spec) uint64

func (*SignedBeaconBlock) Deserialize

func (b *SignedBeaconBlock) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error

func (*SignedBeaconBlock) Envelope

func (*SignedBeaconBlock) FixedLength

func (a *SignedBeaconBlock) FixedLength(*common.Spec) uint64

func (*SignedBeaconBlock) HashTreeRoot

func (b *SignedBeaconBlock) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root

func (*SignedBeaconBlock) Serialize

func (b *SignedBeaconBlock) Serialize(spec *common.Spec, w *codec.EncodingWriter) error

func (*SignedBeaconBlock) SignedHeader

func (block *SignedBeaconBlock) SignedHeader(spec *common.Spec) *common.SignedBeaconBlockHeader

Jump to

Keyboard shortcuts

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