execution

package
v0.1.1-experimental.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrExecutionClientDisconnected represents an error when
	/// the execution client is disconnected.
	ErrExecutionClientDisconnected = errors.New(
		"execution client disconnected")

	// ErrAcceptedSyncingPayloadStatus represents an error when
	// the payload status is SYNCING or ACCEPTED.
	ErrAcceptedSyncingPayloadStatus = errors.New(
		"payload status is SYNCING or ACCEPTED")

	// ErrInvalidPayloadStatus represents an error when the
	// payload status is INVALID.
	ErrInvalidPayloadStatus = errors.New(
		"payload status is INVALID")

	// ErrBadBlockProduced represents an error when the beacon
	// chain has produced a bad block.
	ErrBadBlockProduced = errors.New(
		"beacon chain has produced a bad block, RIP walrus")
)

Functions

This section is empty.

Types

type Engine

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

Engine is Beacon-Kit's implementation of the `ExecutionEngine` from the Ethereum 2.0 Specification.

func NewEngine

func NewEngine(
	ec *client.EngineClient,
	logger log.Logger,
) *Engine

NewExecuitionEngine creates a new Engine.

func (*Engine) GetLogs

func (ee *Engine) GetLogs(
	ctx context.Context,
	blockHash primitives.ExecutionHash,
	addrs []primitives.ExecutionAddress,
) ([]coretypes.Log, error)

TODO move.

func (*Engine) GetPayload

GetPayload returns the payload and blobs bundle for the given slot.

func (*Engine) NotifyForkchoiceUpdate

func (ee *Engine) NotifyForkchoiceUpdate(
	ctx context.Context,
	req *ForkchoiceUpdateRequest,
) (*engine.PayloadID, *primitives.ExecutionHash, error)

NotifyForkchoiceUpdate notifies the execution client of a forkchoice update.

func (*Engine) Start

func (ee *Engine) Start(ctx context.Context)

Start spawns any goroutines required by the service.

func (*Engine) Status

func (ee *Engine) Status() error

Status returns error if the service is not considered healthy.

func (*Engine) VerifyAndNotifyNewPayload

func (ee *Engine) VerifyAndNotifyNewPayload(
	ctx context.Context,
	req *NewPayloadRequest,
) (bool, error)

VerifyAndNotifyNewPayload verifies the new payload and notifies the execution client. It implictly handles: - IsValidBlockHash - IsValidVersionedHashes from the Ethereum 2.0 Specification from within the NewPayload call.

type ForkchoiceUpdateRequest

type ForkchoiceUpdateRequest struct {
	// State is the forkchoice state.
	State *engine.ForkchoiceState
	// PayloadAttributes is the payload attributer.
	PayloadAttributes types.PayloadAttributer
	// ForkVersion is the fork version that we
	// are going to be submitting for.
	ForkVersion uint32
}

ForkchoiceUpdateRequest.

func BuildForkchoiceUpdateRequest

func BuildForkchoiceUpdateRequest(
	state *engine.ForkchoiceState,
	payloadAttributes types.PayloadAttributer,
	forkVersion uint32,
) *ForkchoiceUpdateRequest

BuildForkchoiceUpdateRequest builds a forkchoice update request.

type GetPayloadRequest

type GetPayloadRequest struct {
	// PayloadID is the payload ID.
	PayloadID engine.PayloadID
	// ForkVersion is the fork version that we are
	// currently on.
	ForkVersion uint32
}

GetPayloadRequest represents a request to get a payload.

func BuildGetPayloadRequest

func BuildGetPayloadRequest(
	payloadID engine.PayloadID,
	forkVersion uint32,
) *GetPayloadRequest

BuildGetPayloadRequest builds a get payload request.

type NewPayloadRequest

type NewPayloadRequest struct {
	// ExecutionPayload is the payload to the execution client.
	ExecutionPayload types.ExecutionPayload
	// VersionedHashes is the versioned hashes of the execution payload.
	VersionedHashes []primitives.ExecutionHash
	// ParentBeaconBlockRoot is the root of the parent beacon block.
	ParentBeaconBlockRoot *primitives.Root
}

NewPayloadRequest as per the Ethereum 2.0 specification: https://github.com/ethereum/consensus-specs/blob/dev/specs/deneb/beacon-chain.md#modified-newpayloadrequest

func BuildNewPayloadRequest

func BuildNewPayloadRequest(
	executionPayload types.ExecutionPayload,
	versionedHashes []primitives.ExecutionHash,
	parentBeaconBlockRoot *primitives.Root,
) *NewPayloadRequest

BuildNewPayloadRequest builds a new payload request.

Directories

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