core

package module
v0.0.0-...-2fb637e Latest Latest
Warning

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

Go to latest
Published: May 8, 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")
	// ErrInvalidExecutionValue is an error for when the
	// execution value is invalid.
	ErrInvalidExecutionValue = errors.New("invalid execution value")

	// ErrForkVersionNotSupported is an error for when the fork
	// version is not supported.
	ErrForkVersionNotSupported = errors.New("fork version not supported")

	// ErrNilBlk is an error for when the beacon block is nil.
	ErrNilBlk = errors.New("nil beacon block")

	// ErrNilPayload is an error for when there is no payload
	// in a beacon block.
	ErrNilPayload = errors.New("nil payload in beacon block")

	// ErrNilBlkBody is an error for when the block body is nil.
	ErrNilBlkBody = errors.New("nil block body")

	// ErrNilBlockHeader is returned when a block header from a block is nil.
	ErrNilBlockHeader = errors.New("nil block header")
)

Functions

This section is empty.

Types

type AvailabilityStore

type AvailabilityStore[ReadOnlyBeaconBlockBodyT any, SidecarsT any] interface {
	// IsDataAvailable ensures that all blobs referenced in the block are
	// securely stored before it returns without an error.
	IsDataAvailable(
		context.Context, math.Slot, ReadOnlyBeaconBlockBodyT,
	) bool
	// Persist makes sure that the sidecar remains accessible for data
	// availability checks throughout the beacon node's operation.
	Persist(math.Slot, SidecarsT) 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 BlobVerifier

type BlobVerifier[SidecarsT any] interface {
	VerifyBlobs(
		sidecars SidecarsT, kzgOffset uint64,
	) error
}

BlobVerifier is the interface for the blobs processor.

type BlockVerifier

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

BlockVerifier is responsible for verifying incoming BeaconBlocks.

func NewBlockVerifier

func NewBlockVerifier(cs primitives.ChainSpec) *BlockVerifier

NewBlockVerifier creates a new block validator.

func (*BlockVerifier) ValidateBlock

ValidateBlock validates the incoming block.

type PayloadVerifier

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

PayloadVerifier is responsible for verifying incoming execution payloads to ensure they are valid.

func NewPayloadVerifier

func NewPayloadVerifier(cs primitives.ChainSpec) *PayloadVerifier

NewPayloadVerifier creates a new payload validator.

func (*PayloadVerifier) VerifyPayload

func (pv *PayloadVerifier) VerifyPayload(
	st state.BeaconState,
	payload engineprimitives.ExecutionPayload,
) error

VerifyPayload verifies the incoming payload.

type RandaoProcessor

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

RandaoProcessor is the interface for the randao processor.

type StateProcessor

type StateProcessor[SidecarsT interface{ Len() int }] 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[SidecarsT interface{ Len() int }](
	cs primitives.ChainSpec,
	bv BlobVerifier[SidecarsT],
	rp RandaoProcessor,
	signer crypto.BLSSigner,
	logger log.Logger[any],
) *StateProcessor[SidecarsT]

NewStateProcessor creates a new state processor.

func (*StateProcessor[SidecarsT]) ProcessBlobs

func (sp *StateProcessor[SidecarsT]) ProcessBlobs(
	st state.BeaconState,
	avs AvailabilityStore[consensus.ReadOnlyBeaconBlockBody, SidecarsT],
	sidecars SidecarsT,
) error

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

func (*StateProcessor[SidecarsT]) ProcessBlock

func (sp *StateProcessor[SidecarsT]) ProcessBlock(
	st state.BeaconState,
	blk consensus.BeaconBlock,
) error

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

func (*StateProcessor[SidecarsT]) ProcessSlot

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

ProcessSlot is run when a slot is missed.

func (*StateProcessor[SidecarsT]) Transition

func (sp *StateProcessor[SidecarsT]) Transition(
	st state.BeaconState,
	blk consensus.BeaconBlock,

	validateResult bool,
) error

Transition is the main function for processing a state transition.

Directories

Path Synopsis
deneb
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