engine

package
v0.0.0-...-6f0676c Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Namespace = "op_node"

Functions

func Auto

func Auto(ctx context.Context, metrics Metricer, client *sources.EngineAPIClient, log log.Logger, shutdown <-chan struct{}, settings *BlockBuildingSettings) error

func Copy

func Copy(ctx context.Context, copyFrom client.RPC, copyTo *sources.EngineAPIClient) error

Copy takes the forkchoice state of copyFrom, and applies it to copyTo, and inserts the head-block. The destination engine should then start syncing to this new chain if it has peers to do so.

func CopyPayload

func CopyPayload(ctx context.Context, number uint64, copyFrom client.RPC, copyTo *sources.EngineAPIClient) error

CopyPayload takes the execution payload at number & applies it via NewPayload to copyTo

func GetChainConfig

func GetChainConfig(ctx context.Context, open client.RPC) (cfg *params.ChainConfig, err error)

func RawJSONInteraction

func RawJSONInteraction(ctx context.Context, client client.RPC, method string, args []string, input io.Reader, output io.Writer) error

func Rewind

func Rewind(ctx context.Context, lgr log.Logger, client *sources.EngineAPIClient, open client.RPC, to uint64, setHead bool) error

func SetForkchoice

func SetForkchoice(ctx context.Context, client *sources.EngineAPIClient, finalizedNum, safeNum, unsafeNum uint64) error

func SetForkchoiceByHash

func SetForkchoiceByHash(ctx context.Context, client *sources.EngineAPIClient, finalized, safe, unsafe common.Hash) error

Types

type BlockBuildingSettings

type BlockBuildingSettings struct {
	BlockTime uint64
	// skip a block; timestamps will still increase in multiples of BlockTime like L1, but there may be gaps.
	AllowGaps    bool
	Random       common.Hash
	FeeRecipient common.Address
	BuildTime    time.Duration
}

type Metricer

type Metricer interface {
	RecordBlockFail()
	RecordBlockStats(hash common.Hash, num uint64, time uint64, txs uint64, gas uint64, baseFee float64)
}

type Metrics

type Metrics struct {
	BlockFails prometheus.Counter

	BlockHash    prometheus.Gauge
	BlockNum     prometheus.Gauge
	BlockTime    prometheus.Gauge
	BlockTxs     prometheus.Gauge
	BlockGas     prometheus.Gauge
	BlockBaseFee prometheus.Gauge
}

func NewMetrics

func NewMetrics(procName string, registry *prometheus.Registry) *Metrics

func (*Metrics) RecordBlockFail

func (r *Metrics) RecordBlockFail()

func (*Metrics) RecordBlockStats

func (r *Metrics) RecordBlockStats(hash common.Hash, num uint64, time uint64, txs uint64, gas uint64, baseFee float64)

type RPCBlock

type RPCBlock struct {
	types.Header
	Transactions []*types.Transaction `json:"transactions"`
}

type StaticVersionProvider

type StaticVersionProvider int

func (StaticVersionProvider) ForkchoiceUpdatedVersion

func (v StaticVersionProvider) ForkchoiceUpdatedVersion(*eth.PayloadAttributes) eth.EngineAPIMethod

func (StaticVersionProvider) GetPayloadVersion

func (v StaticVersionProvider) GetPayloadVersion(uint64) eth.EngineAPIMethod

func (StaticVersionProvider) NewPayloadVersion

func (v StaticVersionProvider) NewPayloadVersion(uint64) eth.EngineAPIMethod

type StatusData

type StatusData struct {
	Head      eth.L1BlockRef `json:"head"`
	Safe      eth.L1BlockRef `json:"safe"`
	Finalized eth.L1BlockRef `json:"finalized"`
	Txs       uint64         `json:"txs"`
	Gas       uint64         `json:"gas"`
	StateRoot common.Hash    `json:"stateRoot"`
	BaseFee   *big.Int       `json:"baseFee"`
}

func Status

func Status(ctx context.Context, client client.RPC) (*StatusData, error)

Jump to

Keyboard shortcuts

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