backend

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIRouter

type APIRouter interface {
	AddRPC(route string) error
	AddAPIToRPC(route string, api rpc.API) error
}

type Backend

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

func FromConfig

func FromConfig(log log.Logger, m metrics.Metricer, cfg *config.Config, router APIRouter) (*Backend, error)

func (*Backend) Stop

func (b *Backend) Stop(ctx context.Context) error

func (*Backend) SyncTesters

func (b *Backend) SyncTesters() (out map[sttypes.SyncTesterID]eth.ChainID)

type ELReader

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

func NewELReader

func NewELReader(c *ethclient.Client) *ELReader

func (*ELReader) ChainId

func (g *ELReader) ChainId(ctx context.Context) (hexutil.Big, error)

func (*ELReader) GetBlockByHash

func (g *ELReader) GetBlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*ELReader) GetBlockByHashJSON

func (g *ELReader) GetBlockByHashJSON(ctx context.Context, hash common.Hash, fullTx bool) (json.RawMessage, error)

func (*ELReader) GetBlockByNumber

func (g *ELReader) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)

func (*ELReader) GetBlockByNumberJSON

func (g *ELReader) GetBlockByNumberJSON(ctx context.Context, number rpc.BlockNumber, fullTx bool) (json.RawMessage, error)

func (*ELReader) GetBlockReceipts

func (g *ELReader) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, error)

type HeaderNumberOnly

type HeaderNumberOnly struct {
	Number *hexutil.Big `json:"number"  gencodec:"required"`
}

HeaderNumberOnly is a lightweight header type that only contains the block number field. It is useful in contexts where the full Ethereum block header is not needed, and only the block number is required.

type ReadOnlyELBackend

type ReadOnlyELBackend interface {
	GetBlockByNumberJSON(ctx context.Context, number rpc.BlockNumber, fullTx bool) (json.RawMessage, error)
	GetBlockByHashJSON(ctx context.Context, hash common.Hash, fullTx bool) (json.RawMessage, error)
	GetBlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)
	GetBlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
	GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, error)
	ChainId(ctx context.Context) (hexutil.Big, error)
}

ReadOnlyELBackend defines the minimal, read-only execution layer interface used by the sync tester and its mock backends. The interface exposes two flavors of block accessors:

  • JSON-returning methods (GetBlockByNumberJSON, GetBlockByHashJSON) which return the raw RPC payload exactly as delivered by the EL. These are useful for relaying the response from read-only exec layer directly
  • Typed methods (GetBlockByNumber, GetBlockByHash) which decode the RPC response into geth *types.Block for structured inspection in code.
  • Additional helpers include GetBlockReceipts and ChainId

Implementation wraps ethclient.Client to forward RPC calls. For testing, a mock implementation can be provided to return deterministic values without requiring a live execution layer node.

type SyncTester

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

func NewSyncTester

func NewSyncTester(logger log.Logger, m metrics.Metricer, stID sttypes.SyncTesterID, chainID eth.ChainID, elReader ReadOnlyELBackend) *SyncTester

func SyncTesterFromConfig

func SyncTesterFromConfig(logger log.Logger, m metrics.Metricer, stID sttypes.SyncTesterID, stCfg *config.SyncTesterEntry) (*SyncTester, error)

func (*SyncTester) ChainId

func (s *SyncTester) ChainId(ctx context.Context) (hexutil.Big, error)

func (*SyncTester) DeleteSession

func (s *SyncTester) DeleteSession(ctx context.Context) error

func (*SyncTester) ForkchoiceUpdatedV1

func (s *SyncTester) ForkchoiceUpdatedV1(ctx context.Context, state *eth.ForkchoiceState, attr *eth.PayloadAttributes) (*eth.ForkchoiceUpdatedResult, error)

ForkchoiceUpdatedV1 is called for processing V1 attributes

func (*SyncTester) ForkchoiceUpdatedV2

func (s *SyncTester) ForkchoiceUpdatedV2(ctx context.Context, state *eth.ForkchoiceState, attr *eth.PayloadAttributes) (*eth.ForkchoiceUpdatedResult, error)

ForkchoiceUpdatedV2 is called for processing V2 attributes

func (*SyncTester) ForkchoiceUpdatedV3

func (s *SyncTester) ForkchoiceUpdatedV3(ctx context.Context, state *eth.ForkchoiceState, attr *eth.PayloadAttributes) (*eth.ForkchoiceUpdatedResult, error)

ForkchoiceUpdatedV3 must be only called with Ecotone attributes

func (*SyncTester) GetBlockByHash

func (s *SyncTester) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (json.RawMessage, error)

func (*SyncTester) GetBlockByNumber

func (s *SyncTester) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (json.RawMessage, error)

func (*SyncTester) GetBlockReceipts

func (s *SyncTester) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]*types.Receipt, error)

func (*SyncTester) GetPayloadV1

func (s *SyncTester) GetPayloadV1(ctx context.Context, payloadID eth.PayloadID) (*eth.ExecutionPayloadEnvelope, error)

GetPayloadV1 only supports V1 payloads.

func (*SyncTester) GetPayloadV2

func (s *SyncTester) GetPayloadV2(ctx context.Context, payloadID eth.PayloadID) (*eth.ExecutionPayloadEnvelope, error)

GetPayloadV2 supports V1, V2 payloads.

func (*SyncTester) GetPayloadV3

func (s *SyncTester) GetPayloadV3(ctx context.Context, payloadID eth.PayloadID) (*eth.ExecutionPayloadEnvelope, error)

GetPayloadV3 must be only called when Ecotone activated.

func (*SyncTester) GetPayloadV4

func (s *SyncTester) GetPayloadV4(ctx context.Context, payloadID eth.PayloadID) (*eth.ExecutionPayloadEnvelope, error)

GetPayloadV4 must be only called when Isthmus activated.

func (*SyncTester) GetSession

func (s *SyncTester) GetSession(ctx context.Context) (*eth.SyncTesterSession, error)

func (*SyncTester) ListSessions

func (s *SyncTester) ListSessions(ctx context.Context) ([]string, error)

func (*SyncTester) NewPayloadV1

func (s *SyncTester) NewPayloadV1(ctx context.Context, payload *eth.ExecutionPayload) (*eth.PayloadStatusV1, error)

NewPayloadV1 must be only called with Bedrock Payload

func (*SyncTester) NewPayloadV2

func (s *SyncTester) NewPayloadV2(ctx context.Context, payload *eth.ExecutionPayload) (*eth.PayloadStatusV1, error)

NewPayloadV2 must be only called with Bedrock, Canyon, Delta Payload

func (*SyncTester) NewPayloadV3

func (s *SyncTester) NewPayloadV3(ctx context.Context, payload *eth.ExecutionPayload, versionedHashes []common.Hash, beaconRoot *common.Hash) (*eth.PayloadStatusV1, error)

NewPayloadV3 must be only called with Ecotone Payload

func (*SyncTester) NewPayloadV4

func (s *SyncTester) NewPayloadV4(ctx context.Context, payload *eth.ExecutionPayload, versionedHashes []common.Hash, beaconRoot *common.Hash, executionRequests []hexutil.Bytes) (*eth.PayloadStatusV1, error)

NewPayloadV4 must be only called with Isthmus payload

func (*SyncTester) ResetSession added in v1.13.7

func (s *SyncTester) ResetSession(ctx context.Context) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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