catalyst

package
v1.17.10 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: GPL-3.0, LGPL-3.0 Imports: 38 Imported by: 171

Documentation

Overview

Package catalyst implements the temporary eth1/eth2 RPC integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(stack *node.Node, backend *eth.Ethereum) error

Register adds the engine API and related APIs to the full node.

func RegisterSimulatedBeaconAPIs added in v1.12.1

func RegisterSimulatedBeaconAPIs(stack *node.Node, sim *SimulatedBeacon)

RegisterSimulatedBeaconAPIs registers the simulated beacon's API with the stack.

Types

type ConsensusAPI added in v1.10.14

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

func NewConsensusAPI added in v1.10.14

func NewConsensusAPI(eth *eth.Ethereum) *ConsensusAPI

NewConsensusAPI creates a new consensus api for the given backend. The underlying blockchain needs to have a valid terminal total difficulty set.

This function creates a long-lived object with an attached background thread. For testing or other short-term use cases, please use newConsensusAPIWithoutHeartbeat.

func (*ConsensusAPI) ExchangeCapabilities added in v1.11.0

func (api *ConsensusAPI) ExchangeCapabilities(caps []string) []string

ExchangeCapabilities returns the current methods provided by this node.

func (*ConsensusAPI) ExchangeTransitionConfigurationV1 added in v1.10.17

func (api *ConsensusAPI) ExchangeTransitionConfigurationV1(config engine.TransitionConfigurationV1) (*engine.TransitionConfigurationV1, error)

ExchangeTransitionConfigurationV1 checks the given configuration against the configuration of the node.

func (*ConsensusAPI) ExecuteStatelessPayloadV1 added in v1.14.10

func (api *ConsensusAPI) ExecuteStatelessPayloadV1(params engine.ExecutableData, opaqueWitness hexutil.Bytes) (engine.StatelessPayloadStatusV1, error)

ExecuteStatelessPayloadV1 is analogous to NewPayloadV1, only it operates in a stateless mode on top of a provided witness instead of the local database.

func (*ConsensusAPI) ExecuteStatelessPayloadV2 added in v1.14.10

func (api *ConsensusAPI) ExecuteStatelessPayloadV2(params engine.ExecutableData, opaqueWitness hexutil.Bytes) (engine.StatelessPayloadStatusV1, error)

ExecuteStatelessPayloadV2 is analogous to NewPayloadV2, only it operates in a stateless mode on top of a provided witness instead of the local database.

func (*ConsensusAPI) ExecuteStatelessPayloadV3 added in v1.14.10

func (api *ConsensusAPI) ExecuteStatelessPayloadV3(params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, opaqueWitness hexutil.Bytes) (engine.StatelessPayloadStatusV1, error)

ExecuteStatelessPayloadV3 is analogous to NewPayloadV3, only it operates in a stateless mode on top of a provided witness instead of the local database.

func (*ConsensusAPI) ExecuteStatelessPayloadV4 added in v1.14.10

func (api *ConsensusAPI) ExecuteStatelessPayloadV4(params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, executionRequests []hexutil.Bytes, opaqueWitness hexutil.Bytes) (engine.StatelessPayloadStatusV1, error)

ExecuteStatelessPayloadV4 is analogous to NewPayloadV4, only it operates in a stateless mode on top of a provided witness instead of the local database.

func (*ConsensusAPI) ExecuteStatelessPayloadV5 added in v1.17.6

func (api *ConsensusAPI) ExecuteStatelessPayloadV5(params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, executionRequests []hexutil.Bytes, opaqueWitness hexutil.Bytes) (engine.StatelessPayloadStatusV1, error)

ExecuteStatelessPayloadV5 is analogous to NewPayloadV5, only it operates in a stateless mode on top of a provided witness instead of the local database.

func (*ConsensusAPI) ForkchoiceUpdatedV1 added in v1.10.14

func (api *ConsensusAPI) ForkchoiceUpdatedV1(ctx context.Context, update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error)

ForkchoiceUpdatedV1 has several responsibilities:

We try to set our blockchain to the headBlock.

If the total difficulty was not reached: we return INVALID.

If the finalizedBlockHash is set: we check if we have the finalizedBlockHash in our db, if not we start a sync.

If there are payloadAttributes: we try to assemble a block with the payloadAttributes and return its payloadID.

func (*ConsensusAPI) ForkchoiceUpdatedV2 added in v1.11.0

func (api *ConsensusAPI) ForkchoiceUpdatedV2(ctx context.Context, update engine.ForkchoiceStateV1, params *engine.PayloadAttributes) (engine.ForkChoiceResponse, error)

ForkchoiceUpdatedV2 is equivalent to V1 with the addition of withdrawals in the payload attributes. It supports both PayloadAttributesV1 and PayloadAttributesV2.

func (*ConsensusAPI) ForkchoiceUpdatedV3 added in v1.13.0

func (api *ConsensusAPI) ForkchoiceUpdatedV3(ctx context.Context, update engine.ForkchoiceStateV1, params *engine.PayloadAttributes) (engine.ForkChoiceResponse, error)

ForkchoiceUpdatedV3 is equivalent to V2 with the addition of parent beacon block root in the payload attributes. It supports only PayloadAttributesV3.

func (*ConsensusAPI) ForkchoiceUpdatedV4 added in v1.17.1

func (api *ConsensusAPI) ForkchoiceUpdatedV4(ctx context.Context, update engine.ForkchoiceStateV1, params *engine.PayloadAttributes, custodyColumns *types.CustodyBitmap) (engine.ForkChoiceResponse, error)

ForkchoiceUpdatedV4 is equivalent to V3 with the addition of slot number in the payload attributes. It supports only PayloadAttributesV4.

func (*ConsensusAPI) ForkchoiceUpdatedWithWitnessV1 added in v1.14.10

func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV1(ctx context.Context, update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error)

ForkchoiceUpdatedWithWitnessV1 is analogous to ForkchoiceUpdatedV1, only it generates an execution witness too if block building was requested.

func (*ConsensusAPI) ForkchoiceUpdatedWithWitnessV2 added in v1.14.10

func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV2(ctx context.Context, update engine.ForkchoiceStateV1, params *engine.PayloadAttributes) (engine.ForkChoiceResponse, error)

ForkchoiceUpdatedWithWitnessV2 is analogous to ForkchoiceUpdatedV2, only it generates an execution witness too if block building was requested.

func (*ConsensusAPI) ForkchoiceUpdatedWithWitnessV3 added in v1.14.10

func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV3(ctx context.Context, update engine.ForkchoiceStateV1, params *engine.PayloadAttributes) (engine.ForkChoiceResponse, error)

ForkchoiceUpdatedWithWitnessV3 is analogous to ForkchoiceUpdatedV3, only it generates an execution witness too if block building was requested.

func (*ConsensusAPI) ForkchoiceUpdatedWithWitnessV4 added in v1.17.6

func (api *ConsensusAPI) ForkchoiceUpdatedWithWitnessV4(ctx context.Context, update engine.ForkchoiceStateV1, params *engine.PayloadAttributes, custodyColumns *types.CustodyBitmap) (engine.ForkChoiceResponse, error)

ForkchoiceUpdatedWithWitnessV4 is analogous to ForkchoiceUpdatedV4, only it generates an execution witness too if block building was requested.

func (*ConsensusAPI) GetBlobsV1 added in v1.14.12

func (api *ConsensusAPI) GetBlobsV1(ctx context.Context, hashes []common.Hash) (result engine.BlobAndProofListV1, err error)

GetBlobsV1 returns a blob from the transaction pool.

Specification:

Given an array of blob versioned hashes client software MUST respond with an array of BlobAndProofV1 objects with matching versioned hashes, respecting the order of versioned hashes in the input array.

Client software MUST place responses in the order given in the request, using null for any missing blobs. For instance:

if the request is [A_versioned_hash, B_versioned_hash, C_versioned_hash] and client software has data for blobs A and C, but doesn't have data for B, the response MUST be [A, null, C].

Client software MUST support request sizes of at least 128 blob versioned hashes. The client MUST return -38004: Too large request error if the number of requested blobs is too large.

Client software MAY return an array of all null entries if syncing or otherwise unable to serve blob pool data.

func (*ConsensusAPI) GetBlobsV2 added in v1.16.0

func (api *ConsensusAPI) GetBlobsV2(ctx context.Context, hashes []common.Hash) (engine.BlobAndProofListV2, error)

GetBlobsV2 returns a blob from the transaction pool.

Specification: Refer to the specification for engine_getBlobsV1 with changes of the following:

Given an array of blob versioned hashes client software MUST respond with an array of BlobAndProofV2 objects with matching versioned hashes, respecting the order of versioned hashes in the input array.

Client software MUST return null in case of any missing or older version blobs. For instance,

  • if the request is [A_versioned_hash, B_versioned_hash, C_versioned_hash] and client software has data for blobs A and C, but doesn't have data for B, the response MUST be null.

  • if the request is [A_versioned_hash_for_blob_with_blob_proof], the response MUST be null as well.

Client software MUST support request sizes of at least 128 blob versioned hashes. The client MUST return -38004: Too large request error if the number of requested blobs is too large.

Client software MUST return null if syncing or otherwise unable to serve blob pool data.

func (*ConsensusAPI) GetBlobsV3 added in v1.17.0

func (api *ConsensusAPI) GetBlobsV3(ctx context.Context, hashes []common.Hash) (engine.BlobAndProofListV2, error)

GetBlobsV3 returns a set of blobs from the transaction pool. Same as GetBlobsV2, except will return partial responses in case there is a missing blob.

func (*ConsensusAPI) GetBlobsV4 added in v1.17.5

func (api *ConsensusAPI) GetBlobsV4(hashes []common.Hash, indicesBitarray types.CustodyBitmap) ([]*engine.BlobCellsAndProofsV1, error)

GetBlobsV4 returns cell-level blob data from the transaction pool. V4 returns only the requested cells as specified by the indices_bitarray.

func (*ConsensusAPI) GetClientVersionV1 added in v1.13.13

func (api *ConsensusAPI) GetClientVersionV1(info engine.ClientVersionV1) []engine.ClientVersionV1

GetClientVersionV1 exchanges client version data of this node.

func (*ConsensusAPI) GetPayloadBodiesByHashV1 added in v1.11.0

func (api *ConsensusAPI) GetPayloadBodiesByHashV1(hashes []common.Hash) []*engine.ExecutionPayloadBody

GetPayloadBodiesByHashV1 implements engine_getPayloadBodiesByHashV1 which allows for retrieval of a list of block bodies by the engine api.

func (*ConsensusAPI) GetPayloadBodiesByHashV2 added in v1.14.9

func (api *ConsensusAPI) GetPayloadBodiesByHashV2(hashes []common.Hash) []*engine.ExecutionPayloadBodyV2

GetPayloadBodiesByHashV2 implements engine_getPayloadBodiesByHashV2 which allows for retrieval of a list of block bodies by the engine api.

func (*ConsensusAPI) GetPayloadBodiesByRangeV1 added in v1.11.0

func (api *ConsensusAPI) GetPayloadBodiesByRangeV1(start, count hexutil.Uint64) ([]*engine.ExecutionPayloadBody, error)

GetPayloadBodiesByRangeV1 implements engine_getPayloadBodiesByRangeV1 which allows for retrieval of a range of block bodies by the engine api.

func (*ConsensusAPI) GetPayloadBodiesByRangeV2 added in v1.14.9

func (api *ConsensusAPI) GetPayloadBodiesByRangeV2(start, count hexutil.Uint64) ([]*engine.ExecutionPayloadBodyV2, error)

GetPayloadBodiesByRangeV2 implements engine_getPayloadBodiesByRangeV2 which allows for retrieval of a range of block bodies by the engine api.

func (*ConsensusAPI) GetPayloadV1 added in v1.10.14

func (api *ConsensusAPI) GetPayloadV1(payloadID engine.PayloadID) (*engine.ExecutableData, error)

GetPayloadV1 returns a cached payload by id.

func (*ConsensusAPI) GetPayloadV2 added in v1.11.0

func (api *ConsensusAPI) GetPayloadV2(payloadID engine.PayloadID) (*engine.ExecutionPayloadEnvelope, error)

GetPayloadV2 returns a cached payload by id.

func (*ConsensusAPI) GetPayloadV3 added in v1.12.1

func (api *ConsensusAPI) GetPayloadV3(payloadID engine.PayloadID) (*engine.ExecutionPayloadEnvelope, error)

GetPayloadV3 returns a cached payload by id. This endpoint should only be used for the Cancun fork.

func (*ConsensusAPI) GetPayloadV4 added in v1.14.9

func (api *ConsensusAPI) GetPayloadV4(payloadID engine.PayloadID) (*engine.ExecutionPayloadEnvelope, error)

GetPayloadV4 returns a cached payload by id. This endpoint should only be used for the Prague fork.

func (*ConsensusAPI) GetPayloadV5 added in v1.16.0

func (api *ConsensusAPI) GetPayloadV5(payloadID engine.PayloadID) (*engine.ExecutionPayloadEnvelope, error)

GetPayloadV5 returns a cached payload by id. This endpoint should only be used after the Osaka fork.

This method follows the same specification as engine_getPayloadV4 with changes of returning BlobsBundleV2 with BlobSidecar version 1.

func (*ConsensusAPI) GetPayloadV6 added in v1.17.1

func (api *ConsensusAPI) GetPayloadV6(payloadID engine.PayloadID) (*engine.ExecutionPayloadEnvelope, error)

GetPayloadV6 returns a cached payload by id. This endpoint should only be used after the Amsterdam fork.

func (*ConsensusAPI) HasBlobs added in v1.17.4

func (api *ConsensusAPI) HasBlobs(hashes []common.Hash) []bool

HasBlobs reports availability for the requested blob-versioned-hashes.

func (*ConsensusAPI) NewPayloadV1 added in v1.10.17

func (api *ConsensusAPI) NewPayloadV1(ctx context.Context, params engine.ExecutableData) (engine.PayloadStatusV1, error)

NewPayloadV1 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.

func (*ConsensusAPI) NewPayloadV2 added in v1.11.0

func (api *ConsensusAPI) NewPayloadV2(ctx context.Context, params engine.ExecutableData) (engine.PayloadStatusV1, error)

NewPayloadV2 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.

func (*ConsensusAPI) NewPayloadV3 added in v1.12.1

func (api *ConsensusAPI) NewPayloadV3(ctx context.Context, params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash) (engine.PayloadStatusV1, error)

NewPayloadV3 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.

func (*ConsensusAPI) NewPayloadV4 added in v1.14.9

func (api *ConsensusAPI) NewPayloadV4(ctx context.Context, params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, executionRequests []hexutil.Bytes) (engine.PayloadStatusV1, error)

NewPayloadV4 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.

func (*ConsensusAPI) NewPayloadV5 added in v1.17.1

func (api *ConsensusAPI) NewPayloadV5(ctx context.Context, params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, executionRequests []hexutil.Bytes) (engine.PayloadStatusV1, error)

NewPayloadV5 creates an Eth1 block, inserts it in the chain, and returns the status of the chain.

func (*ConsensusAPI) NewPayloadWithWitnessV1 added in v1.14.10

func (api *ConsensusAPI) NewPayloadWithWitnessV1(ctx context.Context, params engine.ExecutableData) (engine.PayloadStatusV1, error)

NewPayloadWithWitnessV1 is analogous to NewPayloadV1, only it also generates and returns a stateless witness after running the payload.

func (*ConsensusAPI) NewPayloadWithWitnessV2 added in v1.14.10

func (api *ConsensusAPI) NewPayloadWithWitnessV2(ctx context.Context, params engine.ExecutableData) (engine.PayloadStatusV1, error)

NewPayloadWithWitnessV2 is analogous to NewPayloadV2, only it also generates and returns a stateless witness after running the payload.

func (*ConsensusAPI) NewPayloadWithWitnessV3 added in v1.14.10

func (api *ConsensusAPI) NewPayloadWithWitnessV3(ctx context.Context, params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash) (engine.PayloadStatusV1, error)

NewPayloadWithWitnessV3 is analogous to NewPayloadV3, only it also generates and returns a stateless witness after running the payload.

func (*ConsensusAPI) NewPayloadWithWitnessV4 added in v1.14.10

func (api *ConsensusAPI) NewPayloadWithWitnessV4(ctx context.Context, params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, executionRequests []hexutil.Bytes) (engine.PayloadStatusV1, error)

NewPayloadWithWitnessV4 is analogous to NewPayloadV4, only it also generates and returns a stateless witness after running the payload.

func (*ConsensusAPI) NewPayloadWithWitnessV5 added in v1.17.4

func (api *ConsensusAPI) NewPayloadWithWitnessV5(ctx context.Context, params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash, executionRequests []hexutil.Bytes) (engine.PayloadStatusV1, error)

NewPayloadWithWitnessV5 is analogous to NewPayloadV5, only it also generates and returns a stateless witness after running the payload.

type SimulatedBeacon added in v1.12.1

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

SimulatedBeacon drives an Ethereum instance as if it were a real beacon client. It can run in period mode where it mines a new block every period (seconds) or on every transaction via Commit, Fork and AdjustTime.

func NewSimulatedBeacon added in v1.12.1

func NewSimulatedBeacon(period uint64, feeRecipient common.Address, eth *eth.Ethereum) (*SimulatedBeacon, error)

NewSimulatedBeacon constructs a new simulated beacon chain.

func (*SimulatedBeacon) AdjustTime added in v1.13.10

func (c *SimulatedBeacon) AdjustTime(adjustment time.Duration) error

AdjustTime creates a new block with an adjusted timestamp.

func (*SimulatedBeacon) Commit added in v1.13.10

func (c *SimulatedBeacon) Commit() common.Hash

Commit seals a block on demand.

func (*SimulatedBeacon) Fork added in v1.13.10

func (c *SimulatedBeacon) Fork(parentHash common.Hash) error

Fork sets the head to the provided hash.

func (*SimulatedBeacon) Rollback added in v1.13.10

func (c *SimulatedBeacon) Rollback()

Rollback un-sends previously added transactions.

func (*SimulatedBeacon) Start added in v1.12.1

func (c *SimulatedBeacon) Start() error

Start invokes the SimulatedBeacon life-cycle function in a goroutine.

func (*SimulatedBeacon) Stop added in v1.12.1

func (c *SimulatedBeacon) Stop() error

Stop halts the SimulatedBeacon service.

Jump to

Keyboard shortcuts

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