beacon

package
v0.0.0-...-30570a8 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PortBeaconTCP    = 9000
	PortBeaconUDP    = 9000
	PortBeaconAPI    = 4000
	PortBeaconGRPC   = 4001
	PortMetrics      = 8080
	PortValidatorAPI = 5000
)

Variables

View Source
var (
	BLOB_COMMITMENT_VERSION_KZG = byte(0x01)
)
View Source
var EMPTY_TREE_ROOT = tree.Root{}

Functions

func Eth1WithdrawalCredential

func Eth1WithdrawalCredential(validator *phase0.Validator) common.Eth1Address

func HasEth1WithdrawalCredential

func HasEth1WithdrawalCredential(validator *phase0.Validator) bool

func IsFullyWithdrawableValidator

func IsFullyWithdrawableValidator(
	validator *phase0.Validator,
	balance common.Gwei,
	epoch common.Epoch,
) bool

func IsPartiallyWithdrawableValidator

func IsPartiallyWithdrawableValidator(
	spec *common.Spec,
	validator *phase0.Validator,
	balance common.Gwei,
	epoch common.Epoch,
) bool

func KZGCommitmentsToVersionedHashes

func KZGCommitmentsToVersionedHashes(kzgCommitments []common.KZGCommitment) []el_common.Hash

func SpecFromConfig

func SpecFromConfig(cfg *common.Config) (*common.Spec, error)

Types

type BeaconClient

type BeaconClient struct {
	clients.Client
	Logger  utils.Logging
	Config  BeaconClientConfig
	Builder interface{}
	// contains filtered or unexported fields
}

func (*BeaconClient) API

func (bn *BeaconClient) API() *eth2api.Eth2HttpClient

func (*BeaconClient) BeaconAPIURL

func (bn *BeaconClient) BeaconAPIURL() (string, error)

func (*BeaconClient) BeaconConfig

func (bn *BeaconClient) BeaconConfig(
	parentCtx context.Context,
) (*common.Config, error)

Beacon API wrappers

func (*BeaconClient) BeaconStateV2

func (bn *BeaconClient) BeaconStateV2(
	parentCtx context.Context,
	stateId eth2api.StateId,
) (*VersionedBeaconStateResponse, error)

func (*BeaconClient) BeaconStateV2ByBlock

func (bn *BeaconClient) BeaconStateV2ByBlock(
	parentCtx context.Context,
	blockId eth2api.BlockId,
) (*VersionedBeaconStateResponse, error)

func (*BeaconClient) BlobSidecars

func (bn *BeaconClient) BlobSidecars(
	parentCtx context.Context,
	blockId eth2api.BlockId,
) ([]deneb.BlobSidecar, error)

func (*BeaconClient) BlockFinalityCheckpoints

func (bn *BeaconClient) BlockFinalityCheckpoints(
	parentCtx context.Context,
	blockId eth2api.BlockId,
) (*eth2api.FinalityCheckpoints, error)

func (*BeaconClient) BlockHeader

func (bn *BeaconClient) BlockHeader(
	parentCtx context.Context,
	blockId eth2api.BlockId,
) (*eth2api.BeaconBlockHeaderAndInfo, error)

func (*BeaconClient) BlockIsOptimistic

func (bn *BeaconClient) BlockIsOptimistic(
	parentCtx context.Context,
	blockId eth2api.BlockId,
) (bool, error)

func (*BeaconClient) BlockV2

func (bn *BeaconClient) BlockV2(
	parentCtx context.Context,
	blockId eth2api.BlockId,
) (*VersionedSignedBeaconBlock, error)

func (*BeaconClient) BlockV2Root

func (bn *BeaconClient) BlockV2Root(
	parentCtx context.Context,
	blockId eth2api.BlockId,
) (tree.Root, error)

func (*BeaconClient) ClientName

func (bn *BeaconClient) ClientName() string

func (*BeaconClient) ComputeDomain

func (bn *BeaconClient) ComputeDomain(
	ctx context.Context,
	typ common.BLSDomainType,
	version *common.Version,
) (common.BLSDomain, error)

func (*BeaconClient) ENR

func (bn *BeaconClient) ENR(parentCtx context.Context) (string, error)

func (*BeaconClient) EnodeURL

func (bn *BeaconClient) EnodeURL() (string, error)

func (*BeaconClient) ExpectedWithdrawals

func (bn *BeaconClient) ExpectedWithdrawals(
	parentCtx context.Context,
	stateId eth2api.StateId,
) (common.Withdrawals, error)

func (*BeaconClient) GenesisConfig

func (bn *BeaconClient) GenesisConfig(
	parentCtx context.Context,
) (*eth2api.GenesisResponse, error)

func (*BeaconClient) GetBeaconBlockByExecutionHash

func (bn *BeaconClient) GetBeaconBlockByExecutionHash(
	parentCtx context.Context,
	hash ethcommon.Hash,
) (*VersionedSignedBeaconBlock, error)

func (*BeaconClient) GetFilledSlotsCountPerEpoch

func (bn *BeaconClient) GetFilledSlotsCountPerEpoch(
	parentCtx context.Context,
) (map[common.Epoch]uint64, error)

func (*BeaconClient) GetFirstExecutionBeaconBlock

func (bn *BeaconClient) GetFirstExecutionBeaconBlock(
	parentCtx context.Context,
) (*VersionedSignedBeaconBlock, error)

func (*BeaconClient) GetLatestExecutionBeaconBlock

func (bn *BeaconClient) GetLatestExecutionBeaconBlock(
	parentCtx context.Context,
) (*VersionedSignedBeaconBlock, error)

func (*BeaconClient) Init

func (bn *BeaconClient) Init(ctx context.Context) error

func (*BeaconClient) Logf

func (bn *BeaconClient) Logf(format string, values ...interface{})

func (*BeaconClient) P2PAddr

func (bn *BeaconClient) P2PAddr(parentCtx context.Context) (string, error)

func (*BeaconClient) ProposerIndex

func (bn *BeaconClient) ProposerIndex(
	parentCtx context.Context,
	slot common.Slot,
) (common.ValidatorIndex, error)

func (*BeaconClient) Shutdown

func (bn *BeaconClient) Shutdown() error

func (*BeaconClient) Start

func (bn *BeaconClient) Start() error

func (*BeaconClient) StateFinalityCheckpoints

func (bn *BeaconClient) StateFinalityCheckpoints(
	parentCtx context.Context,
	stateId eth2api.StateId,
) (*eth2api.FinalityCheckpoints, error)

func (*BeaconClient) StateFork

func (bn *BeaconClient) StateFork(
	parentCtx context.Context,
	stateId eth2api.StateId,
) (*common.Fork, error)

func (*BeaconClient) StateRandaoMix

func (bn *BeaconClient) StateRandaoMix(
	parentCtx context.Context,
	stateId eth2api.StateId,
) (*tree.Root, error)

func (*BeaconClient) StateValidator

func (bn *BeaconClient) StateValidator(
	parentCtx context.Context,
	stateId eth2api.StateId,
	validatorId eth2api.ValidatorId,
) (*eth2api.ValidatorResponse, error)

func (*BeaconClient) StateValidatorBalances

func (bn *BeaconClient) StateValidatorBalances(
	parentCtx context.Context,
	stateId eth2api.StateId,
	validatorIds []eth2api.ValidatorId,
) ([]eth2api.ValidatorBalanceResponse, error)

func (*BeaconClient) StateValidators

func (bn *BeaconClient) StateValidators(
	parentCtx context.Context,
	stateId eth2api.StateId,
	validatorIds []eth2api.ValidatorId,
	statusFilter []eth2api.ValidatorStatus,
) ([]eth2api.ValidatorResponse, error)

func (*BeaconClient) SubmitPoolBLSToExecutionChange

func (bn *BeaconClient) SubmitPoolBLSToExecutionChange(
	parentCtx context.Context,
	l common.SignedBLSToExecutionChanges,
) error

func (*BeaconClient) SubmitVoluntaryExit

func (bn *BeaconClient) SubmitVoluntaryExit(
	parentCtx context.Context,
	exit *phase0.SignedVoluntaryExit,
) error

func (*BeaconClient) WaitForExecutionPayload

func (b *BeaconClient) WaitForExecutionPayload(
	ctx context.Context,
) (ethcommon.Hash, error)

func (*BeaconClient) WaitForOptimisticState

func (b *BeaconClient) WaitForOptimisticState(
	ctx context.Context,
	blockID eth2api.BlockId,
	optimistic bool,
) (*eth2api.BeaconBlockHeaderAndInfo, error)

type BeaconClientConfig

type BeaconClientConfig struct {
	ClientIndex             int
	TerminalTotalDifficulty int64
	BeaconAPIPort           int
	Spec                    *common.Spec
	GenesisValidatorsRoot   *tree.Root
	GenesisTime             *common.Timestamp
	Subnet                  string
}

type BeaconClients

type BeaconClients []*BeaconClient

func (BeaconClients) ENRs

func (beacons BeaconClients) ENRs(parentCtx context.Context) (string, error)

Returns comma-separated ENRs of all running beacon nodes

func (BeaconClients) GetBeaconBlockByExecutionHash

func (b BeaconClients) GetBeaconBlockByExecutionHash(
	parentCtx context.Context,
	hash ethcommon.Hash,
) (*VersionedSignedBeaconBlock, error)

func (BeaconClients) P2PAddrs

func (beacons BeaconClients) P2PAddrs(
	parentCtx context.Context,
) (string, error)

Returns comma-separated P2PAddr of all running beacon nodes

func (BeaconClients) PrintStatus

func (runningBeacons BeaconClients) PrintStatus(
	ctx context.Context,
)

func (BeaconClients) Running

func (all BeaconClients) Running() BeaconClients

Return subset of clients that are currently running

func (BeaconClients) SubmitPoolBLSToExecutionChange

func (all BeaconClients) SubmitPoolBLSToExecutionChange(
	parentCtx context.Context,
	l common.SignedBLSToExecutionChanges,
) error

func (BeaconClients) Subnet

func (all BeaconClients) Subnet(subnet string) BeaconClients

Return subset of clients that are part of an specific subnet

type BlockV2OptimisticResponse

type BlockV2OptimisticResponse struct {
	Version             string `json:"version"`
	ExecutionOptimistic bool   `json:"execution_optimistic"`
}

type VersionedBeaconStateResponse

type VersionedBeaconStateResponse struct {
	*eth2api.VersionedBeaconState
	// contains filtered or unexported fields
}

func (*VersionedBeaconStateResponse) Balance

func (*VersionedBeaconStateResponse) Balances

func (*VersionedBeaconStateResponse) BlockRoots

func (*VersionedBeaconStateResponse) CurrentEpochAttestations

func (vbs *VersionedBeaconStateResponse) CurrentEpochAttestations() phase0.PendingAttestations

func (*VersionedBeaconStateResponse) CurrentEpochParticipation

func (vbs *VersionedBeaconStateResponse) CurrentEpochParticipation() altair.ParticipationRegistry

func (*VersionedBeaconStateResponse) CurrentJustifiedCheckpoint

func (vbs *VersionedBeaconStateResponse) CurrentJustifiedCheckpoint() common.Checkpoint

func (*VersionedBeaconStateResponse) CurrentSyncCommittee

func (vbs *VersionedBeaconStateResponse) CurrentSyncCommittee() *common.SyncCommittee

Sync

func (*VersionedBeaconStateResponse) CurrentVersion

func (vbs *VersionedBeaconStateResponse) CurrentVersion() common.Version

func (*VersionedBeaconStateResponse) Eth1Data

func (*VersionedBeaconStateResponse) Eth1DataVotes

func (vbs *VersionedBeaconStateResponse) Eth1DataVotes() phase0.Eth1DataVotes

func (*VersionedBeaconStateResponse) Eth1DepositIndex

func (vbs *VersionedBeaconStateResponse) Eth1DepositIndex() common.DepositIndex

func (*VersionedBeaconStateResponse) FinalizedCheckpoint

func (vbs *VersionedBeaconStateResponse) FinalizedCheckpoint() common.Checkpoint

func (*VersionedBeaconStateResponse) Fork

func (*VersionedBeaconStateResponse) GenesisTime

func (vbs *VersionedBeaconStateResponse) GenesisTime() common.Timestamp

func (*VersionedBeaconStateResponse) GenesisValidatorsRoot

func (vbs *VersionedBeaconStateResponse) GenesisValidatorsRoot() common.Root

func (*VersionedBeaconStateResponse) HistoricalRoots

func (vbs *VersionedBeaconStateResponse) HistoricalRoots() phase0.HistoricalRoots

func (*VersionedBeaconStateResponse) InactivityScores

func (vbs *VersionedBeaconStateResponse) InactivityScores() altair.InactivityScores

Altair Inactivity

func (*VersionedBeaconStateResponse) JustificationBits

func (vbs *VersionedBeaconStateResponse) JustificationBits() common.JustificationBits

Finality

func (*VersionedBeaconStateResponse) LatestBlockHeader

func (vbs *VersionedBeaconStateResponse) LatestBlockHeader() common.BeaconBlockHeader

func (*VersionedBeaconStateResponse) LatestExecutionPayloadHeaderHash

func (vbs *VersionedBeaconStateResponse) LatestExecutionPayloadHeaderHash() tree.Root

func (*VersionedBeaconStateResponse) NextSyncCommittee

func (vbs *VersionedBeaconStateResponse) NextSyncCommittee() *common.SyncCommittee

func (*VersionedBeaconStateResponse) NextWithdrawalIndex

func (vbs *VersionedBeaconStateResponse) NextWithdrawalIndex() (common.WithdrawalIndex, error)

func (*VersionedBeaconStateResponse) NextWithdrawalValidatorIndex

func (vbs *VersionedBeaconStateResponse) NextWithdrawalValidatorIndex() (common.ValidatorIndex, error)

func (*VersionedBeaconStateResponse) NextWithdrawals

func (vbs *VersionedBeaconStateResponse) NextWithdrawals(
	slot common.Slot,
) (common.Withdrawals, error)

func (*VersionedBeaconStateResponse) PreviousEpochAttestations

func (vbs *VersionedBeaconStateResponse) PreviousEpochAttestations() phase0.PendingAttestations

func (*VersionedBeaconStateResponse) PreviousEpochParticipation

func (vbs *VersionedBeaconStateResponse) PreviousEpochParticipation() altair.ParticipationRegistry

func (*VersionedBeaconStateResponse) PreviousJustifiedCheckpoint

func (vbs *VersionedBeaconStateResponse) PreviousJustifiedCheckpoint() common.Checkpoint

func (*VersionedBeaconStateResponse) PreviousVersion

func (vbs *VersionedBeaconStateResponse) PreviousVersion() common.Version

func (*VersionedBeaconStateResponse) RandaoMixes

func (vbs *VersionedBeaconStateResponse) RandaoMixes() phase0.RandaoMixes

func (*VersionedBeaconStateResponse) Root

func (*VersionedBeaconStateResponse) Slashings

func (*VersionedBeaconStateResponse) StateRoots

func (*VersionedBeaconStateResponse) StateSlot

func (vbs *VersionedBeaconStateResponse) StateSlot() common.Slot

func (*VersionedBeaconStateResponse) Validators

type VersionedSignedBeaconBlock

type VersionedSignedBeaconBlock struct {
	*eth2api.VersionedSignedBeaconBlock
	// contains filtered or unexported fields
}

func (*VersionedSignedBeaconBlock) ContainsExecutionPayload

func (versionedBlock *VersionedSignedBeaconBlock) ContainsExecutionPayload() bool

func (*VersionedSignedBeaconBlock) ContainsKZGCommitments

func (versionedBlock *VersionedSignedBeaconBlock) ContainsKZGCommitments() bool

func (*VersionedSignedBeaconBlock) ExecutionPayload

func (versionedBlock *VersionedSignedBeaconBlock) ExecutionPayload() (api.ExecutableData, []el_common.Hash, *el_common.Hash, error)

func (*VersionedSignedBeaconBlock) ExecutionPayloadBlockHash

func (b *VersionedSignedBeaconBlock) ExecutionPayloadBlockHash() *tree.Root

func (*VersionedSignedBeaconBlock) KZGCommitments

func (b *VersionedSignedBeaconBlock) KZGCommitments() common.KZGCommitments

func (*VersionedSignedBeaconBlock) ParentRoot

func (b *VersionedSignedBeaconBlock) ParentRoot() tree.Root

func (*VersionedSignedBeaconBlock) ProposerIndex

func (*VersionedSignedBeaconBlock) Root

func (*VersionedSignedBeaconBlock) Slot

func (*VersionedSignedBeaconBlock) StateRoot

func (b *VersionedSignedBeaconBlock) StateRoot() tree.Root

func (*VersionedSignedBeaconBlock) Withdrawals

func (versionedBlock *VersionedSignedBeaconBlock) Withdrawals() (common.Withdrawals, error)

Jump to

Keyboard shortcuts

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