beacon

package
v0.0.0-...-09737f6 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VALID              = GenericStringResponse{"VALID"}
	SUCCESS            = GenericStringResponse{"SUCCESS"}
	INVALID            = ForkChoiceResponse{Status: "INVALID", PayloadID: nil}
	SYNCING            = ForkChoiceResponse{Status: "SYNCING", PayloadID: nil}
	GenericServerError = rpc.CustomError{Code: -32000, ValidationError: "Server error"}
	UnknownPayload     = rpc.CustomError{Code: -32001, ValidationError: "Unknown payload"}
	InvalidTB          = rpc.CustomError{Code: -32002, ValidationError: "Invalid terminal block"}
)

Functions

func ExecutableDataToBlock

func ExecutableDataToBlock(params ExecutableDataV1) (*types.Block, error)

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

len(extraData) <= 32
uncleHash = emptyUncleHash
difficulty = 0

and that the blockhash of the constructed block matches the parameters.

Types

type ConsensusValidatedParams

type ConsensusValidatedParams struct {
	BlockHash common.Hash `json:"blockHash"`
	Status    string      `json:"status"`
}

type ExecutableDataV1

type ExecutableDataV1 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:"random"        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"`
}

ExecutableDataV1 structure described at https://github.com/metrachain/execution-apis/src/engine/specification.md

func BlockToExecutableData

func BlockToExecutableData(block *types.Block) *ExecutableDataV1

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

func (ExecutableDataV1) MarshalJSON

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

MarshalJSON marshals as JSON.

func (*ExecutableDataV1) UnmarshalJSON

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

UnmarshalJSON unmarshals from JSON.

type ExecutePayloadResponse

type ExecutePayloadResponse struct {
	Status          string      `json:"status"`
	LatestValidHash common.Hash `json:"latestValidHash"`
}

type ForkChoiceResponse

type ForkChoiceResponse struct {
	Status    string     `json:"status"`
	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 GenericResponse

type GenericResponse struct {
	Success bool `json:"success"`
}

type GenericStringResponse

type GenericStringResponse struct {
	Status string `json:"status"`
}

type NewBlockResponse

type NewBlockResponse struct {
	Valid bool `json:"valid"`
}

type PayloadAttributesV1

type PayloadAttributesV1 struct {
	Timestamp             uint64         `json:"timestamp"     gencodec:"required"`
	Random                common.Hash    `json:"random"        gencodec:"required"`
	SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient"  gencodec:"required"`
}

PayloadAttributesV1 structure described at https://github.com/metrachain/execution-apis/pull/74

func (PayloadAttributesV1) MarshalJSON

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

MarshalJSON marshals as JSON.

func (*PayloadAttributesV1) UnmarshalJSON

func (p *PayloadAttributesV1) 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

Jump to

Keyboard shortcuts

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