forkchoice

package
v1.0.0-alpha.23 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: GPL-3.0 Imports: 2 Imported by: 14

Documentation

Overview

Package forkchoice implements the service to support fork choice for the eth2 beacon chain. This contains the necessary components to track latest validators votes, and balances. Then a store object to be used to calculate head. High level fork choice summary: https://notes.ethereum.org/@vbuterin/rkhCgQteN?type=view#LMD-GHOST-fork-choice-rule

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttestationProcessor

type AttestationProcessor interface {
	ProcessAttestation(context.Context, []uint64, [32]byte, uint64)
}

AttestationProcessor processes the attestation that's used for accounting fork choice.

type BlockProcessor

type BlockProcessor interface {
	ProcessBlock(context.Context, uint64, [32]byte, [32]byte, [32]byte, uint64, uint64) error
}

BlockProcessor processes the block that's used for accounting fork choice.

type ForkChoicer

type ForkChoicer interface {
	HeadRetriever        // to compute head.
	BlockProcessor       // to track new block for fork choice.
	AttestationProcessor // to track new attestation for fork choice.
	Pruner               // to clean old data for fork choice.
	Getter               // to retrieve fork choice information.
}

ForkChoicer represents the full fork choice interface composed of all of the sub-interfaces.

type Getter

type Getter interface {
	Nodes() []*protoarray.Node
	Node([32]byte) *protoarray.Node
	HasNode([32]byte) bool
	Store() *protoarray.Store
	HasParent(root [32]byte) bool
	AncestorRoot(ctx context.Context, root [32]byte, slot uint64) ([]byte, error)
}

Getter returns fork choice related information.

type HeadRetriever

type HeadRetriever interface {
	Head(context.Context, uint64, [32]byte, []uint64, uint64) ([32]byte, error)
}

HeadRetriever retrieves head root of the current chain.

type Pruner

type Pruner interface {
	Prune(context.Context, [32]byte) error
}

Pruner prunes the fork choice upon new finalization. This is used to keep fork choice sane.

Directories

Path Synopsis
Package protoarray implements proto array fork choice as outlined: https://github.com/protolambda/lmd-ghost#array-based-stateful-dag-proto_array This was motivated by the the original implementation by Sigma Prime here: https://github.com/sigp/lighthouse/pull/804
Package protoarray implements proto array fork choice as outlined: https://github.com/protolambda/lmd-ghost#array-based-stateful-dag-proto_array This was motivated by the the original implementation by Sigma Prime here: https://github.com/sigp/lighthouse/pull/804

Jump to

Keyboard shortcuts

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