engine_helpers

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const MaxBuilders = 128

Variables

View Source
var InvalidForkchoiceStateErr = rpc.CustomError{Code: -38002, Message: "Invalid forkchoice state"}
View Source
var InvalidPayloadAttributesErr = rpc.CustomError{Code: -38003, Message: "Invalid payload attributes"}
View Source
var TooLargeRequestErr = rpc.CustomError{Code: -38004, Message: "Too large request"}
View Source
var UnknownPayloadErr = rpc.CustomError{Code: -38001, Message: "Unknown payload"}

Functions

This section is empty.

Types

type ForkValidator

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

func NewForkValidator

func NewForkValidator(ctx context.Context, currentHeight uint64, validatePayload validatePayloadFunc, tmpDir string, blockReader services.FullBlockReader) *ForkValidator

func NewForkValidatorMock

func NewForkValidatorMock(currentHeight uint64) *ForkValidator

func (*ForkValidator) ClearWithUnwind

func (fv *ForkValidator) ClearWithUnwind(accumulator *shards.Accumulator, c shards.StateChangeConsumer)

Clear wipes out current extending fork data.

func (*ForkValidator) ExtendingForkHeadHash

func (fv *ForkValidator) ExtendingForkHeadHash() libcommon.Hash

ExtendingForkHeadHash return the fork head hash of the fork that extends the canonical chain.

func (*ForkValidator) FlushExtendingFork

func (fv *ForkValidator) FlushExtendingFork(tx kv.RwTx, accumulator *shards.Accumulator) error

FlushExtendingFork flush the current extending fork if fcu chooses its head hash as the its forkchoice.

func (*ForkValidator) NotifyCurrentHeight

func (fv *ForkValidator) NotifyCurrentHeight(currentHeight uint64)

NotifyCurrentHeight is to be called at the end of the stage cycle and represent the last processed block.

func (*ForkValidator) ValidatePayload

func (fv *ForkValidator) ValidatePayload(tx kv.Tx, header *types.Header, body *types.RawBody, extendCanonical bool) (status engine_types.EngineStatus, latestValidHash libcommon.Hash, validationError error, criticalError error)

ValidatePayload returns whether a payload is valid or invalid, or if cannot be determined, it will be accepted. if the payload extends the canonical chain, then we stack it in extendingFork without any unwind. if the payload is a fork then we unwind to the point where the fork meets the canonical chain, and there we check whether it is valid. if for any reason none of the actions above can be performed due to lack of information, we accept the payload and avoid validation.

Jump to

Keyboard shortcuts

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