beaconapi

package
v0.0.0-...-5f8afbd Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Block

func Block(backend *BeaconBackend) eth2api.Route

Serves phase0 block details for given block id.

func BlockAttestations

func BlockAttestations(backend *BeaconBackend) eth2api.Route

Serves attestations included in requested block.

func BlockHeader

func BlockHeader(backend *BeaconBackend) eth2api.Route

Serve block header for given block id.

func BlockHeaders

func BlockHeaders(backend *BeaconBackend) eth2api.Route

Serves block headers matching given query. By default it will serve current head slot blocks.

func BlockRoot

func BlockRoot(backend *BeaconBackend) eth2api.Route

Serves hashTreeRoot of BeaconBlock/BeaconBlockHeader.

func Blockv2

func Blockv2(backend *BeaconBackend) eth2api.Route

Serves versioned block details for given block id.

func Genesis

func Genesis(backend *BeaconBackend) eth2api.Route

Serve details of the chain's genesis which can be used to identify chain.

func PoolAttestations

func PoolAttestations(backend *BeaconBackend) eth2api.Route

Serves attestations known by the node but not necessarily incorporated into any block

func PoolAttesterSlashings

func PoolAttesterSlashings(backend *BeaconBackend) eth2api.Route

Retrieves attester slashings known by the node but not necessarily incorporated into any block

func PoolProposerSlashings

func PoolProposerSlashings(backend *BeaconBackend) eth2api.Route

Retrieves proposer slashings known by the node but not necessarily incorporated into any block

func PoolVoluntaryExits

func PoolVoluntaryExits(backend *BeaconBackend) eth2api.Route

Retrieves voluntary exits known by the node but not necessarily incorporated into any block

func PublishAttestations

func PublishAttestations(backend *BeaconBackend) eth2api.Route

Handles publishing of attestations, stores them in the pool and sends them to the publisher.

func PublishAttesterSlashing

func PublishAttesterSlashing(backend *BeaconBackend) eth2api.Route

Submits AttesterSlashing object to node's pool and if passes validation node MUST broadcast it to network.

func PublishBlock

func PublishBlock(backend *BeaconBackend) eth2api.Route

Instructs the beacon node to broadcast a newly signed beacon block to the beacon network, to be included in the beacon chain. The beacon node is not required to validate the signed BeaconBlock, and a successful response (20X) only indicates that the broadcast has been successful. The beacon node is expected to integrate the new block into its state, and therefore validate the block internally, however blocks which fail the validation are still broadcast but a different status code is returned (202)

func PublishProposerSlashing

func PublishProposerSlashing(backend *BeaconBackend) eth2api.Route

Submits ProposerSlashing object to node's pool and if passes validation node MUST broadcast it to network.

func PublishSyncCommittees

func PublishSyncCommittees(backend *BeaconBackend) eth2api.Route

Submits sync committee signature objects to the node. Sync committee signatures are not present in phase0, but are required for Altair networks. If a sync committee signature is validated successfully the node MUST publish that sync committee signature on all applicable subnets. If one or more sync committee signatures fail validation the node MUST return a 400 error with details of which sync committee signatures have failed, and why.

func PublishVoluntaryExit

func PublishVoluntaryExit(backend *BeaconBackend) eth2api.Route

Submits SignedVoluntaryExit object to node's pool and if passes validation node MUST broadcast it to network.

Types

type AttestationPool

type AttestationPool interface {
	Search(opts ...pool.AttSearchOption) (out []*phase0.Attestation)
	AddAttestation(ctx context.Context, att *phase0.Attestation, committee common.CommitteeIndices) error
}

type AttesterSlashingPool

type AttesterSlashingPool interface {
	All() []*phase0.AttesterSlashing
	AddAttesterSlashing(ctx context.Context, sl *phase0.AttesterSlashing) error
}

type BeaconBackend

type BeaconBackend struct {
	Spec      *common.Spec
	Chain     beacon.Chain
	BlockDB   BlockReader
	Publisher Publisher

	ProcessBlock func(ctx context.Context, block *common.BeaconBlockEnvelope) error

	ForkDecoder *beacon.ForkDecoder

	AttestationPool      AttestationPool
	AttesterSlashingPool AttesterSlashingPool
	ProposerSlashingPool ProposerSlashingPool
	VoluntaryExitPool    VoluntaryExitPool
	SyncCommitteePool    SyncCommitteePool
}

func (*BeaconBackend) BlockLookup

func (backend *BeaconBackend) BlockLookup(blockId eth2api.BlockId) (entry beacon.ChainEntry, ok bool)

type BlockReader

type BlockReader interface {
	Get(slot common.Slot, root common.Root) (*common.BeaconBlockEnvelope, error)
}

type ProposerSlashingPool

type ProposerSlashingPool interface {
	All() []*phase0.ProposerSlashing
	AddProposerSlashing(ctx context.Context, sl *phase0.ProposerSlashing) error
}

type Publisher

type Publisher interface {
	PublishBlock(ctx context.Context, block *common.BeaconBlockEnvelope) (syncing bool, err error)
	PublishAttestation(ctx context.Context, att *phase0.Attestation) (err error)
	PublishAttesterSlashing(ctx context.Context, sl *phase0.AttesterSlashing) (err error)
	PublishProposerSlashing(ctx context.Context, sl *phase0.ProposerSlashing) (err error)
	PublishVoluntaryExit(ctx context.Context, exit *phase0.SignedVoluntaryExit) (err error)
	PublishSyncCommitteeMessage(ctx context.Context, msg *altair.SyncCommitteeMessage) error
}

type SyncCommitteePool

type SyncCommitteePool interface {
	AddSyncCommitteeMessage(ctx context.Context, msg *altair.SyncCommitteeMessage) error
}

type VoluntaryExitPool

type VoluntaryExitPool interface {
	All() []*phase0.SignedVoluntaryExit
	AddVoluntaryExit(ctx context.Context, exit *phase0.SignedVoluntaryExit) error
}

Jump to

Keyboard shortcuts

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