Documentation ¶
Index ¶
- type Checkpoint
- type Epoch
- type ExtendedNodeRef
- type Forkchoice
- type ForkchoiceGraph
- type ForkchoiceNodeInput
- type ForkchoiceView
- type Gwei
- type NodeIndex
- type NodeRef
- type ProtoForkChoice
- func (fc *ProtoForkChoice) CanonAtSlot(anchor Root, slot Slot, withBlock bool) (closest NodeRef, err error)
- func (fc *ProtoForkChoice) CanonicalChain(anchorRoot Root, anchorSlot Slot) ([]ExtendedNodeRef, error)
- func (fc *ProtoForkChoice) ClosestToSlot(anchor Root, slot Slot) (ref NodeRef, err error)
- func (fc *ProtoForkChoice) Finalized() Checkpoint
- func (fc *ProtoForkChoice) FindHead(anchorRoot Root, anchorSlot Slot) (NodeRef, error)
- func (fc *ProtoForkChoice) GetSlot(root Root) (slot Slot, ok bool)
- func (fc *ProtoForkChoice) Head() (NodeRef, error)
- func (fc *ProtoForkChoice) InSubtree(anchor Root, root Root) (unknown bool, inSubtree bool)
- func (fc *ProtoForkChoice) Justified() Checkpoint
- func (fc *ProtoForkChoice) Pin() *NodeRef
- func (fc *ProtoForkChoice) ProcessAttestation(index ValidatorIndex, blockRoot Root, headSlot Slot) (ok bool)
- func (fc *ProtoForkChoice) ProcessBlock(parentRoot Root, blockRoot Root, blockSlot Slot, justifiedEpoch Epoch, ...) (ok bool)
- func (fc *ProtoForkChoice) ProcessSlot(parentRoot Root, slot Slot, justifiedEpoch Epoch, finalizedEpoch Epoch)
- func (fc *ProtoForkChoice) Search(anchor NodeRef, parentRoot *Root, slot *Slot) (nonCanon []NodeRef, canon []NodeRef, err error)
- func (fc *ProtoForkChoice) SetPin(root Root, slot Slot) error
- func (fc *ProtoForkChoice) UpdateJustified(ctx context.Context, trigger Root, justified Checkpoint, finalized Checkpoint, ...) error
- type Root
- type SignedGwei
- type Slot
- type ValidatorIndex
- type VoteInput
- type VoteStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checkpoint ¶
type Checkpoint = common.Checkpoint
type ExtendedNodeRef ¶ added in v0.14.0
type ExtendedNodeRef = common.ExtendedNodeRef
type Forkchoice ¶ added in v0.14.0
type Forkchoice interface { ForkchoiceView ForkchoiceNodeInput VoteInput UpdateJustified(ctx context.Context, trigger Root, justified Checkpoint, finalized Checkpoint, justifiedStateBalances func() ([]Gwei, error)) error Pin() *NodeRef SetPin(root Root, slot Slot) error Justified() Checkpoint Finalized() Checkpoint Head() (NodeRef, error) }
func NewForkChoice ¶
func NewForkChoice(spec *common.Spec, finalized Checkpoint, justified Checkpoint, anchorRoot Root, anchorSlot Slot, graph ForkchoiceGraph, votes VoteStore, initialBalances []Gwei) (Forkchoice, error)
type ForkchoiceGraph ¶ added in v0.14.0
type ForkchoiceGraph interface { ForkchoiceView ForkchoiceNodeInput Indices() map[NodeRef]NodeIndex ApplyScoreChanges(deltas []SignedGwei, justifiedEpoch Epoch, finalizedEpoch Epoch) error OnPrune(ctx context.Context, anchorRoot Root, anchorSlot Slot) error }
type ForkchoiceNodeInput ¶ added in v0.14.0
type ForkchoiceView ¶ added in v0.14.0
type ForkchoiceView interface { CanonicalChain(anchorRoot Root, anchorSlot Slot) ([]ExtendedNodeRef, error) ClosestToSlot(anchor Root, slot Slot) (closest NodeRef, err error) CanonAtSlot(anchor Root, slot Slot, withBlock bool) (at NodeRef, err error) GetSlot(blockRoot Root) (slot Slot, ok bool) FindHead(anchorRoot Root, anchorSlot Slot) (NodeRef, error) InSubtree(anchor Root, root Root) (unknown bool, inSubtree bool) Search(anchor NodeRef, parentRoot *Root, slot *Slot) (nonCanon []NodeRef, canon []NodeRef, err error) }
type ProtoForkChoice ¶ added in v0.14.0
type ProtoForkChoice struct {
// contains filtered or unexported fields
}
func (*ProtoForkChoice) CanonAtSlot ¶ added in v0.14.0
func (*ProtoForkChoice) CanonicalChain ¶ added in v0.14.0
func (fc *ProtoForkChoice) CanonicalChain(anchorRoot Root, anchorSlot Slot) ([]ExtendedNodeRef, error)
func (*ProtoForkChoice) ClosestToSlot ¶ added in v0.14.0
func (fc *ProtoForkChoice) ClosestToSlot(anchor Root, slot Slot) (ref NodeRef, err error)
func (*ProtoForkChoice) Finalized ¶ added in v0.14.0
func (fc *ProtoForkChoice) Finalized() Checkpoint
func (*ProtoForkChoice) FindHead ¶ added in v0.14.0
func (fc *ProtoForkChoice) FindHead(anchorRoot Root, anchorSlot Slot) (NodeRef, error)
func (*ProtoForkChoice) GetSlot ¶ added in v0.14.0
func (fc *ProtoForkChoice) GetSlot(root Root) (slot Slot, ok bool)
func (*ProtoForkChoice) Head ¶ added in v0.14.0
func (fc *ProtoForkChoice) Head() (NodeRef, error)
func (*ProtoForkChoice) InSubtree ¶ added in v0.14.0
func (fc *ProtoForkChoice) InSubtree(anchor Root, root Root) (unknown bool, inSubtree bool)
func (*ProtoForkChoice) Justified ¶ added in v0.14.0
func (fc *ProtoForkChoice) Justified() Checkpoint
func (*ProtoForkChoice) Pin ¶ added in v0.14.0
func (fc *ProtoForkChoice) Pin() *NodeRef
func (*ProtoForkChoice) ProcessAttestation ¶ added in v0.14.0
func (fc *ProtoForkChoice) ProcessAttestation(index ValidatorIndex, blockRoot Root, headSlot Slot) (ok bool)
func (*ProtoForkChoice) ProcessBlock ¶ added in v0.14.0
func (*ProtoForkChoice) ProcessSlot ¶ added in v0.14.0
func (fc *ProtoForkChoice) ProcessSlot(parentRoot Root, slot Slot, justifiedEpoch Epoch, finalizedEpoch Epoch)
func (*ProtoForkChoice) SetPin ¶ added in v0.14.0
func (fc *ProtoForkChoice) SetPin(root Root, slot Slot) error
func (*ProtoForkChoice) UpdateJustified ¶ added in v0.14.0
func (fc *ProtoForkChoice) UpdateJustified(ctx context.Context, trigger Root, justified Checkpoint, finalized Checkpoint, justifiedStateBalances func() ([]Gwei, error)) error
UpdateJustified updates what is recognized as justified and finalized checkpoint, and adjusts justified balances for vote weights. If the finalized checkpoint changes, it triggers pruning. Note that pruning can prune the pre-block node of the start slot of the finalized epoch, if it is not a gap slot. And the finalizing node with the block will remain. The justification/finalization trigger must be within the pinned subtree (if any).
type SignedGwei ¶
type SignedGwei int64
type ValidatorIndex ¶
type ValidatorIndex = common.ValidatorIndex
type VoteInput ¶ added in v0.14.0
type VoteInput interface { // ProcessAttestation overrides any previous vote, and applies voting weight to the new root/slot. // If the root/slot combination does not exist, no changes are made, and ok=false is returned. // It is up to the caller if nodes should be added, to then process the attestation. ProcessAttestation(index ValidatorIndex, blockRoot Root, headSlot Slot) (ok bool) }
Click to show internal directories.
Click to hide internal directories.