forkchoice

package
v1.0.0-alpha.1 Latest Latest
Warning

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

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

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, 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
}

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 following light house implementation: 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 following light house implementation: 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