mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-24 12:27:18 +00:00
a069738c20
* update shared/params * update eth2-types deps * update protobufs * update shared/* * fix testutil/state * update beacon-chain/state * update beacon-chain/db * update tests * fix test * update beacon-chain/core * update beacon-chain/blockchain * update beacon-chain/cache * beacon-chain/forkchoice * update beacon-chain/operations * update beacon-chain/p2p * update beacon-chain/rpc * update sync/initial-sync * update deps * update deps * go fmt * update beacon-chain/sync * update endtoend/ * bazel build //beacon-chain - works w/o issues * update slasher code * udpate tools/ * update validator/ * update fastssz * fix build * fix test building * update tests * update ethereumapis deps * fix tests * update state/stategen * fix build * fix test * add FarFutureSlot * go imports * Radek's suggestions * Ivan's suggestions * type conversions * Nishant's suggestions * add more tests to rpc_send_request * fix test * clean up * fix conflicts Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: nisdas <nishdas93@gmail.com>
49 lines
1.6 KiB
Go
49 lines
1.6 KiB
Go
package forkchoice
|
|
|
|
import (
|
|
"context"
|
|
|
|
types "github.com/prysmaticlabs/eth2-types"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/forkchoice/protoarray"
|
|
)
|
|
|
|
// ForkChoicer represents the full fork choice interface composed of all of the sub-interfaces.
|
|
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.
|
|
}
|
|
|
|
// HeadRetriever retrieves head root of the current chain.
|
|
type HeadRetriever interface {
|
|
Head(context.Context, types.Epoch, [32]byte, []uint64, types.Epoch) ([32]byte, error)
|
|
}
|
|
|
|
// BlockProcessor processes the block that's used for accounting fork choice.
|
|
type BlockProcessor interface {
|
|
ProcessBlock(context.Context, types.Slot, [32]byte, [32]byte, [32]byte, types.Epoch, types.Epoch) error
|
|
}
|
|
|
|
// AttestationProcessor processes the attestation that's used for accounting fork choice.
|
|
type AttestationProcessor interface {
|
|
ProcessAttestation(context.Context, []uint64, [32]byte, types.Epoch)
|
|
}
|
|
|
|
// Pruner prunes the fork choice upon new finalization. This is used to keep fork choice sane.
|
|
type Pruner interface {
|
|
Prune(context.Context, [32]byte) error
|
|
}
|
|
|
|
// Getter returns fork choice related information.
|
|
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 types.Slot) ([]byte, error)
|
|
IsCanonical(root [32]byte) bool
|
|
}
|