engine

package
v0.0.0-...-3debb8d Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// VALID is returned by the engine API in the following calls:
	//   - newPayloadV1:       if the payload was already known or was just validated and executed
	//   - forkchoiceUpdateV1: if the chain accepted the reorg (might ignore if it's stale)
	VALID = "VALID"

	// INVALID is returned by the engine API in the following calls:
	//   - newPayloadV1:       if the payload failed to execute on top of the local chain
	//   - forkchoiceUpdateV1: if the new head is unknown, pre-merge, or reorg to it fails
	INVALID = "INVALID"

	// SYNCING is returned by the engine API in the following calls:
	//   - newPayloadV1:       if the payload was accepted on top of an active sync
	//   - forkchoiceUpdateV1: if the new head was seen before, but not part of the chain
	SYNCING = "SYNCING"

	// ACCEPTED is returned by the engine API in the following calls:
	//   - newPayloadV1: if the payload was accepted, but not processed (side chain)
	ACCEPTED = "ACCEPTED"

	GenericServerError       = &EngineAPIError{code: -32000, msg: "Server error"}
	UnknownPayload           = &EngineAPIError{code: -38001, msg: "Unknown payload"}
	InvalidForkChoiceState   = &EngineAPIError{code: -38002, msg: "Invalid forkchoice state"}
	InvalidPayloadAttributes = &EngineAPIError{code: -38003, msg: "Invalid payload attributes"}
	TooLargeRequest          = &EngineAPIError{code: -38004, msg: "Too large request"}
	InvalidParams            = &EngineAPIError{code: -32602, msg: "Invalid parameters"}
	UnsupportedFork          = &EngineAPIError{code: -38005, msg: "Unsupported fork"}

	STATUS_INVALID         = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: INVALID}, PayloadID: nil}
	STATUS_SYNCING         = ForkChoiceResponse{PayloadStatus: PayloadStatusV1{Status: SYNCING}, PayloadID: nil}
	INVALID_TERMINAL_BLOCK = PayloadStatusV1{Status: INVALID, LatestValidHash: &common.Hash{}}
)

Functions

func ExecutableDataToBlock

func ExecutableDataToBlock(params ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash) (*types.Block, error)

ExecutableDataToBlock constructs a block from executable data. It verifies that the following fields:

	len(extraData) <= 32
	uncleHash = emptyUncleHash
	difficulty = 0
 	if versionedHashes != nil, versionedHashes match to blob transactions

and that the blockhash of the constructed block matches the parameters. Nil Withdrawals value will propagate through the returned block. Empty Withdrawals value must be passed via non-nil, length 0 value in params.

Types

type BlobsBundleV1

type BlobsBundleV1 struct {
	Commitments []hexutil.Bytes `json:"commitments"`
	Proofs      []hexutil.Bytes `json:"proofs"`
	Blobs       []hexutil.Bytes `json:"blobs"`
}

type EngineAPIError

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

EngineAPIError is a standardized error message between consensus and execution clients, also containing any custom error message Geth might include.

func (*EngineAPIError) Error

func (e *EngineAPIError) Error() string

func (*EngineAPIError) ErrorCode

func (e *EngineAPIError) ErrorCode() int

func (*EngineAPIError) ErrorData

func (e *EngineAPIError) ErrorData() interface{}

func (*EngineAPIError) With

func (e *EngineAPIError) With(err error) *EngineAPIError

With returns a copy of the error with a new embedded custom data field.

type ExecutableData

type ExecutableData struct {
	ParentHash    common.Hash         `json:"parentHash"    gencodec:"required"`
	FeeRecipient  common.Address      `json:"feeRecipient"  gencodec:"required"`
	StateRoot     common.Hash         `json:"stateRoot"     gencodec:"required"`
	ReceiptsRoot  common.Hash         `json:"receiptsRoot"  gencodec:"required"`
	LogsBloom     []byte              `json:"logsBloom"     gencodec:"required"`
	Random        common.Hash         `json:"prevRandao"    gencodec:"required"`
	Number        uint64              `json:"blockNumber"   gencodec:"required"`
	GasLimit      uint64              `json:"gasLimit"      gencodec:"required"`
	GasUsed       uint64              `json:"gasUsed"       gencodec:"required"`
	Timestamp     uint64              `json:"timestamp"     gencodec:"required"`
	ExtraData     []byte              `json:"extraData"     gencodec:"required"`
	BaseFeePerGas *big.Int            `json:"baseFeePerGas" gencodec:"required"`
	BlockHash     common.Hash         `json:"blockHash"     gencodec:"required"`
	Transactions  [][]byte            `json:"transactions"  gencodec:"required"`
	Withdrawals   []*types.Withdrawal `json:"withdrawals"`
	BlobGasUsed   *uint64             `json:"blobGasUsed"`
	ExcessBlobGas *uint64             `json:"excessBlobGas"`
}

ExecutableData is the data necessary to execute an EL payload.

func (ExecutableData) MarshalJSON

func (e ExecutableData) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*ExecutableData) UnmarshalJSON

func (e *ExecutableData) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type ExecutionPayloadBodyV1

type ExecutionPayloadBodyV1 struct {
	TransactionData []hexutil.Bytes     `json:"transactions"`
	Withdrawals     []*types.Withdrawal `json:"withdrawals"`
}

ExecutionPayloadBodyV1 is used in the response to GetPayloadBodiesByHashV1 and GetPayloadBodiesByRangeV1

type ExecutionPayloadEnvelope

type ExecutionPayloadEnvelope struct {
	ExecutionPayload *ExecutableData `json:"executionPayload"  gencodec:"required"`
	BlockValue       *big.Int        `json:"blockValue"  gencodec:"required"`
	BlobsBundle      *BlobsBundleV1  `json:"blobsBundle"`
	Override         bool            `json:"shouldOverrideBuilder"`
}

func BlockToExecutableData

func BlockToExecutableData(block *types.Block, fees *big.Int, sidecars []*types.BlobTxSidecar) *ExecutionPayloadEnvelope

BlockToExecutableData constructs the ExecutableData structure by filling the fields from the given block. It assumes the given block is post-merge block.

func (ExecutionPayloadEnvelope) MarshalJSON

func (e ExecutionPayloadEnvelope) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*ExecutionPayloadEnvelope) UnmarshalJSON

func (e *ExecutionPayloadEnvelope) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type ForkChoiceResponse

type ForkChoiceResponse struct {
	PayloadStatus PayloadStatusV1 `json:"payloadStatus"`
	PayloadID     *PayloadID      `json:"payloadId"`
}

type ForkchoiceStateV1

type ForkchoiceStateV1 struct {
	HeadBlockHash      common.Hash `json:"headBlockHash"`
	SafeBlockHash      common.Hash `json:"safeBlockHash"`
	FinalizedBlockHash common.Hash `json:"finalizedBlockHash"`
}

type PayloadAttributes

type PayloadAttributes struct {
	Timestamp             uint64              `json:"timestamp"             gencodec:"required"`
	Random                common.Hash         `json:"prevRandao"            gencodec:"required"`
	SuggestedFeeRecipient common.Address      `json:"suggestedFeeRecipient" gencodec:"required"`
	Withdrawals           []*types.Withdrawal `json:"withdrawals"`
	BeaconRoot            *common.Hash        `json:"parentBeaconBlockRoot"`
}

PayloadAttributes describes the environment context in which a block should be built.

func (PayloadAttributes) MarshalJSON

func (p PayloadAttributes) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*PayloadAttributes) UnmarshalJSON

func (p *PayloadAttributes) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

type PayloadID

type PayloadID [8]byte

PayloadID is an identifier of the payload build process

func (PayloadID) MarshalText

func (b PayloadID) MarshalText() ([]byte, error)

func (PayloadID) String

func (b PayloadID) String() string

func (*PayloadID) UnmarshalText

func (b *PayloadID) UnmarshalText(input []byte) error

type PayloadStatusV1

type PayloadStatusV1 struct {
	Status          string       `json:"status"`
	LatestValidHash *common.Hash `json:"latestValidHash"`
	ValidationError *string      `json:"validationError"`
}

type TransitionConfigurationV1

type TransitionConfigurationV1 struct {
	TerminalTotalDifficulty *hexutil.Big   `json:"terminalTotalDifficulty"`
	TerminalBlockHash       common.Hash    `json:"terminalBlockHash"`
	TerminalBlockNumber     hexutil.Uint64 `json:"terminalBlockNumber"`
}

Jump to

Keyboard shortcuts

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