core

package
v0.1.1-experimental.2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrStateRootMismatch is returned when the state root in a block header
	// does.
	ErrStateRootMismatch = errors.New("state root mismatch")
)

Functions

This section is empty.

Types

type AvailabilityStore

type AvailabilityStore interface {
	// IsDataAvailable ensures that all blobs referenced in the block are
	// securely stored before it returns without an error.
	IsDataAvailable(
		context.Context, primitives.Slot, types.ReadOnlyBeaconBlock,
	) bool
	// Persist makes sure that the sidecar remains accessible for data
	// availability checks throughout the beacon node's operation.
	Persist(primitives.Slot, *datypes.BlobSidecars) error
}

The AvailabilityStore interface is responsible for validating and storing sidecars for specific blocks, as well as verifying sidecars that have already been stored.

type BLSSigner

type BLSSigner interface {
	// PublicKey returns the public key of the signer.
	PublicKey() primitives.BLSPubkey

	// Sign takes a message as a slice of bytes and returns a signature as a
	// slice of bytes and an error.
	Sign([]byte) (primitives.BLSSignature, error)
}

BLSSigner defines an interface for cryptographic signing operations. It uses generic type parameters Signature and Pubkey, both of which are slices of bytes.

type BlobsProcessor

type BlobsProcessor interface {
	ProcessBlobs(
		primitives.Slot,
		AvailabilityStore,
		*datypes.BlobSidecars,
	) error
}

BlobsProcessor is the interface for the blobs processor.

type BlockValidator

type BlockValidator struct {
	// contains filtered or unexported fields
}

BlockValidator is responsible for validating incoming BeaconBlocks.

func NewBlockValidator

func NewBlockValidator(cfg *params.BeaconChainConfig) *BlockValidator

NewBlockValidator creates a new block validator.

func (*BlockValidator) ValidateBlock

func (bv *BlockValidator) ValidateBlock(
	st state.BeaconState,
	blk types.ReadOnlyBeaconBlock,
) error

ValidateBlock validates the incoming block.

type PayloadValidator

type PayloadValidator struct {
	// contains filtered or unexported fields
}

PayloadValidator is responsible for validating incoming execution payloads to ensure they are valid.

func NewPayloadValidator

func NewPayloadValidator(cfg *params.BeaconChainConfig) *PayloadValidator

NewPayloadValidator creates a new payload validator.

func (*PayloadValidator) ValidatePayload

func (pv *PayloadValidator) ValidatePayload(
	st state.BeaconState,
	body types.BeaconBlockBody,
) error

ValidatePayload validates the incoming payload.

type RandaoProcessor

type RandaoProcessor interface {
	ProcessRandao(
		state.BeaconState,
		types.BeaconBlock,
	) error
	ProcessRandaoMixesReset(
		state.BeaconState,
	) error
}

RandaoProcessor is the interface for the randao processor.

type StateProcessor

type StateProcessor struct {
	// contains filtered or unexported fields
}

StateProcessor is a basic Processor, which takes care of the main state transition for the beacon chain.

func NewStateProcessor

func NewStateProcessor(
	cfg *params.BeaconChainConfig,
	bp BlobsProcessor,
	rp RandaoProcessor,
	logger log.Logger,
) *StateProcessor

NewStateProcessor creates a new state processor.

func (*StateProcessor) ProcessBlobs

func (sp *StateProcessor) ProcessBlobs(
	st state.BeaconState,
	avs AvailabilityStore,
	sidecars *datypes.BlobSidecars,
) error

ProcessBlobs processes the blobs and ensures they match the local state.

func (*StateProcessor) ProcessBlock

func (sp *StateProcessor) ProcessBlock(
	st state.BeaconState,
	blk types.BeaconBlock,
) error

ProcessBlock processes the block and ensures it matches the local state.

func (*StateProcessor) ProcessSlot

func (sp *StateProcessor) ProcessSlot(
	st state.BeaconState,
) error

ProcessSlot is run when a slot is missed.

func (*StateProcessor) Transition

func (sp *StateProcessor) Transition(
	st state.BeaconState,
	blk types.ReadOnlyBeaconBlock,

	validateResult bool,
) error

StateTransition is the main function for processing a state transition.

Directories

Path Synopsis
Code generated by fastssz.
Code generated by fastssz.
Code generated by fastssz.
Code generated by fastssz.

Jump to

Keyboard shortcuts

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