engineapi

package
v0.0.0-...-92d349b Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	New = iota
	DataWasMissing
)
View Source
const (
	None = iota
	Synced
	Stopping
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ForkChoiceMessage

type ForkChoiceMessage struct {
	HeadBlockHash      libcommon.Hash
	SafeBlockHash      libcommon.Hash
	FinalizedBlockHash libcommon.Hash
}

The message we are going to send to the stage sync in ForkchoiceUpdated

type ForkValidator

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

func NewForkValidator

func NewForkValidator(currentHeight uint64, validatePayload validatePayloadFunc, tmpDir string) *ForkValidator

func NewForkValidatorMock

func NewForkValidatorMock(currentHeight uint64) *ForkValidator

func (*ForkValidator) ClearWithUnwind

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

Clear wipes out current extending fork data and notify txpool.

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 repressent the last processed block.

func (*ForkValidator) TryAddingPoWBlock

func (fv *ForkValidator) TryAddingPoWBlock(block *types.Block)

TryAddingPoWBlock adds a PoW block to the fork validator if possible

func (*ForkValidator) ValidatePayload

func (fv *ForkValidator) ValidatePayload(tx kv.RwTx, header *types.Header, body *types.RawBody, extendCanonical bool) (status remote.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 extend 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 meet the canonical chain and we check if it is valid or not from there. if for any reasons none of the action above can be performed due to lack of information, we accept the payload and avoid validation.

type Interrupt

type Interrupt int

type PayloadStatus

type PayloadStatus struct {
	Status          remote.EngineStatus
	LatestValidHash libcommon.Hash
	ValidationError error
	CriticalError   error
}

This is the status of a newly execute block. Hash: Block hash Status: block's status

type RequestList

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

func NewRequestList

func NewRequestList() *RequestList

func (*RequestList) AddForkChoiceRequest

func (rl *RequestList) AddForkChoiceRequest(message *ForkChoiceMessage)

func (*RequestList) AddPayloadRequest

func (rl *RequestList) AddPayloadRequest(message *types.Block)

func (*RequestList) Interrupt

func (rl *RequestList) Interrupt(kind Interrupt)

func (*RequestList) IsWaiting

func (rl *RequestList) IsWaiting() bool

func (*RequestList) Remove

func (rl *RequestList) Remove(id int)

func (*RequestList) SetStatus

func (rl *RequestList) SetStatus(id int, status RequestStatus)

func (*RequestList) WaitForRequest

func (rl *RequestList) WaitForRequest(onlyNew bool, noWait bool) (interrupt Interrupt, id int, request *RequestWithStatus)

func (*RequestList) WaitForWaiting

func (rl *RequestList) WaitForWaiting(ctx context.Context) (chan struct{}, bool)

type RequestStatus

type RequestStatus int

type RequestWithStatus

type RequestWithStatus struct {
	Message interface{} // *Block or *ForkChoiceMessage
	Status  RequestStatus
}

Jump to

Keyboard shortcuts

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