Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventSource ¶
type EventSource string
const ( NilEventSource EventSource = "" UnknownEventSource EventSource = "unknown" BeaconNodeEventSource EventSource = "beacon_node" XatuPollingEventSource EventSource = "xatu_polling" XatuReorgEventEventSource EventSource = "xatu_reorg_event" )
func NewEventSourceFromString ¶
func NewEventSourceFromString(s string) EventSource
func RandomEventSource ¶
func RandomEventSource() EventSource
func (EventSource) String ¶
func (e EventSource) String() string
type ForkChoice ¶ added in v1.0.3
type ForkChoice struct {
// JustifiedCheckpoint is the store's justified checkpoint.
JustifiedCheckpoint phase0.Checkpoint
// FinalizedCheckpoint is the store's finalized checkpoint.
FinalizedCheckpoint phase0.Checkpoint
// ForkChoiceNodes are the fork choice nodes. Pre-Gloas, and for clients
// without the v2 endpoint, there is one node per block. Post-Gloas a block
// can have a pending, an empty and a full node.
ForkChoiceNodes []*ForkChoiceNode
// ExtraData is the client-specific extra data of the fork choice store,
// such as the unrealized justified checkpoint.
ExtraData map[string]any
}
ForkChoice is a beacon node's fork choice dump, normalized across the v1 and v2 debug fork choice endpoints and the differences between client implementations of them.
Frames stored before Gloas support hold the v1 shape, which this type reads unchanged: the Gloas fields are all optional.
func ForkChoiceFromV1 ¶ added in v1.0.3
func ForkChoiceFromV1(fc *v1.ForkChoice) *ForkChoice
ForkChoiceFromV1 normalizes a GET /eth/v1/debug/fork_choice response.
Since Gloas some clients return one v1 node per fork choice node, i.e. up to three nodes per block with no payload status to tell them apart. Those are collapsed to the heaviest node per block, which is the block's pending node.
func ForkChoiceFromV2 ¶ added in v1.0.3
func ForkChoiceFromV2(fc *v1.ForkChoiceV2) *ForkChoice
ForkChoiceFromV2 normalizes a GET /eth/v2/debug/fork_choice response, which go-eth2-client has checked against the spec (ethereum/beacon-APIs#615), so every node carries all of its values.
func GenerateFakeForkChoice ¶
func GenerateFakeForkChoice() *ForkChoice
func NormalizeV2 ¶ added in v1.0.3
func NormalizeV2(fc *ForkChoice) *ForkChoice
NormalizeV2 normalizes, in place, a fork choice with one node per (block root, payload status) pair.
Empty and full nodes, which the spec points at their own block's pending node, keep the parent block's root as their parent root. Values a node lacks, as nodes received through Xatu from older sentries or from a client predating the spec may, are filled in from its extra_data or its block's other nodes, and missing parent payload statuses are inferred where possible. Empty extra data is set to nil.
func (*ForkChoice) MarshalJSON ¶ added in v1.0.3
func (f *ForkChoice) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ForkChoice) UnmarshalJSON ¶ added in v1.0.3
func (f *ForkChoice) UnmarshalJSON(input []byte) error
UnmarshalJSON implements json.Unmarshaler.
type ForkChoiceNode ¶ added in v1.0.3
type ForkChoiceNode struct {
Slot phase0.Slot
BlockRoot phase0.Root
// ParentRoot is the root of the parent block. Unlike the v2 endpoint, it is
// the parent block's root for empty and full nodes too.
ParentRoot phase0.Root
JustifiedEpoch *phase0.Epoch
FinalizedEpoch *phase0.Epoch
Weight uint64
Validity v1.ForkChoiceNodeValidity
ExecutionBlockHash phase0.Root
// PayloadStatus is the Gloas payload status of the node; unknown (the zero
// value) for nodes without one.
PayloadStatus v1.ForkChoicePayloadStatus
// ParentPayloadStatus is the payload status of the parent fork choice node:
// for a pending node, whether its block was built on the parent block's
// empty or full payload; for empty and full nodes, pending. Nil if unknown.
ParentPayloadStatus *v1.ForkChoicePayloadStatus
PayloadAttesterCount *uint64
PayloadAvailabilityYesCount *uint64
PayloadDataAvailabilityYesCount *uint64
ExtraData map[string]any
}
ForkChoiceNode is a node in the fork choice tree.
func (*ForkChoiceNode) MarshalJSON ¶ added in v1.0.3
func (n *ForkChoiceNode) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ForkChoiceNode) UnmarshalJSON ¶ added in v1.0.3
func (n *ForkChoiceNode) UnmarshalJSON(input []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Frame ¶
type Frame struct {
// Data is the fork choice dump.
Data *ForkChoice `json:"data"`
// Metadata is the metadata of the frame.
Metadata FrameMetadata `json:"metadata"`
}
Frame holds a fork choice dump with a timestamp.
func GenerateFakeFrame ¶
func GenerateFakeFrame() *Frame
func (*Frame) AsGzipJSON ¶
func (*Frame) FromGzipJSON ¶
type FrameMetadata ¶
type FrameMetadata struct {
// ID is the ID of the frame.
ID string `json:"id"`
// Node is the node that provided the frame.
// In the case of a beacon node, this is the beacon node's ID as specified in the config for this service.
// In the case of Xatu, this is the Xatu Sentry ID.
Node string `json:"node"`
// FetchedAt is the time the frame was fetched.
FetchedAt time.Time `json:"fetched_at"`
// WallClockSlot is the wall clock slot at the time the frame was fetched.
WallClockSlot phase0.Slot `json:"wall_clock_slot"`
// WallClockSlot is the wall clock slot at the time the frame was fetched.
WallClockEpoch phase0.Epoch `json:"wall_clock_epoch"`
// Labels are labels to apply to the frame.
Labels []string `json:"labels"`
// ConsensusClient is the consensus client that provided the frame.
ConsensusClient string `json:"consensus_client"`
// EventSource is the event source that provided the frame.
EventSource string `json:"event_source"`
}
func (*FrameMetadata) Validate ¶
func (f *FrameMetadata) Validate() error