client

package
v0.6.2-rc6 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHTTPErrorResponse = errors.New("got an HTTP error response")
	ErrNodesUnavailable  = errors.New("beacon nodes are unavailable")
	ErrBlockPublish202   = errors.New("the block failed validation, but was successfully broadcast anyway. It was not integrated into the beacon node's database")
)
View Source
var (
	ErrBeaconNodeSyncing      = errors.New("beacon node is syncing")
	ErrWithdrawalsUnsupported = errors.New("withdrawals are not supported")
	ErrFailedToPublish        = errors.New("failed to publish")
)

Functions

func NewBeaconClient

func NewBeaconClient(l log.Logger, endpoint string, config BeaconConfig) (*beaconClient, error)

Types

type AllValidatorsResponse

type AllValidatorsResponse struct {
	Data []ValidatorResponseEntry
}

AllValidatorsResponse is the response for querying active validators

type BeaconConfig added in v0.4.11

type BeaconConfig struct {
	BeaconEventTimeout time.Duration
	BeaconEventRestart int
	BeaconQueryTimeout time.Duration
}

type BeaconMetrics

type BeaconMetrics struct {
	Timing *prometheus.HistogramVec
}

type BeaconNode

type BeaconNode interface {
	SubscribeToHeadEvents(ctx context.Context, slotC chan HeadEvent)
	GetProposerDuties(structs.Epoch) (*RegisteredProposersResponse, error)
	SyncStatus() (*SyncStatusPayloadData, error)
	KnownValidators(structs.Slot) (AllValidatorsResponse, error)
	Genesis() (structs.GenesisInfo, error)
	GetForkSchedule() (*GetForkScheduleResponse, error)
	PublishBlock(context.Context, structs.SignedBeaconBlock) error
	Randao(structs.Slot) (string, error)
	Endpoint() string
	GetWithdrawals(structs.Slot) (*GetWithdrawalsResponse, error)
	SubscribeToPayloadAttributesEvents(payloadAttrC chan PayloadAttributesEvent)
}

type Data added in v0.4.9

type Data struct {
	Root      string `json:"root"`
	Canonical bool   `json:"canonical"`
	Header    Header `json:"header"`
}

type GenesisResponse

type GenesisResponse struct {
	Data structs.GenesisInfo
}

type GetForkScheduleResponse

type GetForkScheduleResponse struct {
	Data []struct {
		PreviousVersion string `json:"previous_version"`
		CurrentVersion  string `json:"current_version"`
		Epoch           uint64 `json:"epoch,string"`
	}
}

type GetRandaoResponse

type GetRandaoResponse struct {
	Data struct {
		Randao string `json:"randao"`
	}
}

GetRandaoResponse is the response for querying randao from beacon

type GetWithdrawalsResponse

type GetWithdrawalsResponse struct {
	Data struct {
		Withdrawals structs.Withdrawals `json:"withdrawals"`
	}
}

type HeadEvent

type HeadEvent struct {
	Slot uint64 `json:"slot,string"`
}

HeadEvent is emitted when subscribing to head events

func (HeadEvent) Loggable

func (h HeadEvent) Loggable() map[string]any
type Header struct {
	Message   Message `json:"message"`
	Signature string  `json:"signature"`
}

type HeaderRootObject added in v0.4.9

type HeaderRootObject struct {
	ExecutionOptimistic bool   `json:"execution_optimistic"`
	Data                []Data `json:"data"`
}

type Message added in v0.4.9

type Message struct {
	Slot          uint64 `json:"slot,string"`
	ProposerIndex string `json:"proposer_index"`
	ParentRoot    string `json:"parent_root"`
	StateRoot     string `json:"state_root"`
	BodyRoot      string `json:"body_root"`
}

Header is the block header from the beacon chain

type MultiBeaconClient

type MultiBeaconClient struct {
	Log     log.Logger
	Clients []BeaconNode
	// contains filtered or unexported fields
}

func NewMultiBeaconClient

func NewMultiBeaconClient(l log.Logger, clients []BeaconNode) *MultiBeaconClient

func (*MultiBeaconClient) Endpoint

func (b *MultiBeaconClient) Endpoint() string

func (*MultiBeaconClient) Genesis

func (b *MultiBeaconClient) Genesis() (genesisInfo structs.GenesisInfo, err error)

func (*MultiBeaconClient) GetForkSchedule

func (b *MultiBeaconClient) GetForkSchedule() (spec *GetForkScheduleResponse, err error)

func (*MultiBeaconClient) GetProposerDuties

func (b *MultiBeaconClient) GetProposerDuties(epoch structs.Epoch) (*RegisteredProposersResponse, error)

func (*MultiBeaconClient) GetWithdrawals

func (b *MultiBeaconClient) GetWithdrawals(slot structs.Slot) (withdrawalsResp *GetWithdrawalsResponse, err error)

func (*MultiBeaconClient) KnownValidators

func (b *MultiBeaconClient) KnownValidators(headSlot structs.Slot) (AllValidatorsResponse, error)

func (*MultiBeaconClient) PublishBlock

func (b *MultiBeaconClient) PublishBlock(ctx context.Context, block structs.SignedBeaconBlock) (err error)

func (*MultiBeaconClient) Randao

func (b *MultiBeaconClient) Randao(slot structs.Slot) (randao string, err error)

func (*MultiBeaconClient) SubscribeToHeadEvents

func (b *MultiBeaconClient) SubscribeToHeadEvents(ctx context.Context, slotC chan HeadEvent)

func (*MultiBeaconClient) SubscribeToPayloadAttributesEvents added in v0.4.14

func (b *MultiBeaconClient) SubscribeToPayloadAttributesEvents(slotC chan PayloadAttributesEvent)

func (*MultiBeaconClient) SyncStatus

func (b *MultiBeaconClient) SyncStatus() (*SyncStatusPayloadData, error)

type PayloadAttributes added in v0.4.14

type PayloadAttributes struct {
	Timestamp             uint64                `json:"timestamp,string"`
	PrevRandao            string                `json:"prev_randao"`
	SuggestedFeeRecipient string                `json:"suggested_fee_recipient"`
	Withdrawals           []*structs.Withdrawal `json:"withdrawals"`
}

type PayloadAttributesEvent added in v0.4.14

type PayloadAttributesEvent struct {
	Version string                     `json:"version"`
	Data    PayloadAttributesEventData `json:"data"`
}

type PayloadAttributesEventData added in v0.4.14

type PayloadAttributesEventData struct {
	ProposerIndex     uint64            `json:"proposer_index,string"`
	ProposalSlot      uint64            `json:"proposal_slot,string"`
	ParentBlockNumber uint64            `json:"parent_block_number,string"`
	ParentBlockRoot   string            `json:"parent_block_root"`
	ParentBlockHash   string            `json:"parent_block_hash"`
	PayloadAttributes PayloadAttributes `json:"payload_attributes"`
}

type RegisteredProposersResponse

type RegisteredProposersResponse struct {
	Data []RegisteredProposersResponseData
}

RegisteredProposersResponse is the response for querying proposer duties

type RegisteredProposersResponseData

type RegisteredProposersResponseData struct {
	PubKey structs.PubKey `json:"pubkey"`
	Slot   uint64         `json:"slot,string"`
}

type SyncStatusPayload

type SyncStatusPayload struct {
	Data SyncStatusPayloadData
}

SyncStatusPayload is the response payload for /eth/v1/node/syncing

type SyncStatusPayloadData

type SyncStatusPayloadData struct {
	HeadSlot  uint64 `json:"head_slot,string"`
	IsSyncing bool   `json:"is_syncing"`
}

type ValidatorResponseEntry

type ValidatorResponseEntry struct {
	Index     uint64                         `json:"index,string"` // Index of validator in validator registry.
	Balance   string                         `json:"balance"`      // Current validator balance in gwei.
	Status    string                         `json:"status"`
	Validator ValidatorResponseValidatorData `json:"validator"`
}

type ValidatorResponseValidatorData

type ValidatorResponseValidatorData struct {
	Pubkey string `json:"pubkey"`
}

Notes

Bugs

  • do something with unsupported

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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