node

package
v1.14.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT, MIT Imports: 50 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyClosed = errors.New("node is already closed")

Functions

func NewAdminAPI

func NewAdminAPI(dr driverClient, log log.Logger) *adminAPI

func NewConductorClient added in v1.5.0

func NewConductorClient(cfg *config.Config, log log.Logger, metrics *metrics.Metrics) conductor.SequencerConductor

NewConductorClient returns a new conductor client for the op-conductor RPC service.

func NewNodeAPI

func NewNodeAPI(config *rollup.Config, depSet depset.DependencySet, l2Client l2EthClient, dr driverClient, safeDB SafeDBReader, log log.Logger) *nodeAPI

func NewOpstackAPI added in v1.13.3

func NewOpstackAPI(eng engine.RollupAPI, publisher apis.PublishAPI) *opstackAPI

Types

type BeaconClient added in v1.14.3

type BeaconClient interface {
	GetVersion(ctx context.Context) (string, error)
	GetBlobs(ctx context.Context, ref eth.L1BlockRef, hashes []eth.IndexedBlobHash) ([]*eth.Blob, error)
}

BeaconClient is the interface that op-node uses to interact with L1 Beacon. This allows wrapped or mocked clients to be used

type ConductorClient added in v1.5.0

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

ConductorClient is a client for the op-conductor RPC service.

func (*ConductorClient) Close added in v1.5.0

func (c *ConductorClient) Close()

func (*ConductorClient) CommitUnsafePayload added in v1.5.0

func (c *ConductorClient) CommitUnsafePayload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error

CommitUnsafePayload commits an unsafe payload to the conductor log.

func (*ConductorClient) Enabled added in v1.9.4

func (c *ConductorClient) Enabled(ctx context.Context) bool

Enabled returns true if the conductor is enabled, and since the conductor client is initialized, the conductor is always enabled.

func (*ConductorClient) Leader added in v1.5.0

func (c *ConductorClient) Leader(ctx context.Context) (bool, error)

Leader returns true if this node is the leader sequencer.

func (*ConductorClient) OverrideLeader added in v1.8.0

func (c *ConductorClient) OverrideLeader(ctx context.Context) error

OverrideLeader implements conductor.SequencerConductor.

type InitializationOverrides added in v1.14.3

type InitializationOverrides struct {
	L1Source        L1Source
	Beacon          L1Beacon
	RPCHandler      *oprpc.Handler
	MetricsRegistry func(*prometheus.Registry)
}

type L1Beacon added in v1.14.3

type L1Beacon interface {
	GetBlobs(ctx context.Context, ref eth.L1BlockRef, hashes []eth.IndexedBlobHash) ([]*eth.Blob, error)
}

L1Beacon provides access to L1 beacon chain data, specifically for blob data retrieval.

type L1Client added in v1.14.3

type L1Client interface {
	L1BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L1BlockRef, error)
	L1BlockRefByNumber(ctx context.Context, num uint64) (eth.L1BlockRef, error)
	L1BlockRefByHash(ctx context.Context, hash common.Hash) (eth.L1BlockRef, error)
	InfoByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, error)
	InfoByNumber(ctx context.Context, number uint64) (eth.BlockInfo, error)
	InfoByLabel(ctx context.Context, label eth.BlockLabel) (eth.BlockInfo, error)
	InfoAndTxsByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, types.Transactions, error)
	InfoAndTxsByNumber(ctx context.Context, number uint64) (eth.BlockInfo, types.Transactions, error)
	InfoAndTxsByLabel(ctx context.Context, label eth.BlockLabel) (eth.BlockInfo, types.Transactions, error)
	FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
	GetProof(ctx context.Context, address common.Address, storage []common.Hash, blockTag string) (*eth.AccountResult, error)
	GetStorageAt(ctx context.Context, address common.Address, storageSlot common.Hash, blockTag string) (common.Hash, error)
	ReadStorageAt(ctx context.Context, address common.Address, storageSlot common.Hash, blockHash common.Hash) (common.Hash, error)
	SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
	ChainID(ctx context.Context) (*big.Int, error)
	Close()
}

L1Client is the interface that op-node uses to interact with L1. This allows wrapped or mocked clients to be used

type L1Source added in v1.14.3

type L1Source interface {
	L1BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L1BlockRef, error)
	L1BlockRefByNumber(ctx context.Context, num uint64) (eth.L1BlockRef, error)
	L1BlockRefByHash(ctx context.Context, hash common.Hash) (eth.L1BlockRef, error)
	SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
	ReadStorageAt(ctx context.Context, address common.Address, storageSlot common.Hash, blockHash common.Hash) (common.Hash, error)
	InfoByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, error)
	InfoAndTxsByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, types.Transactions, error)
	FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
	Close()
}

L1Source provides the necessary L1 blockchain data for the node.

type OpNode

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

func New

func New(ctx context.Context, cfg *config.Config, log log.Logger, appVersion string, m *metrics.Metrics) (*OpNode, error)

New creates a new OpNode instance. The provided ctx argument is for the span of initialization only; the node will immediately Stop(ctx) before finishing initialization if the context is canceled during initialization.

func NewWithOverride added in v1.14.3

func NewWithOverride(ctx context.Context, cfg *config.Config, log log.Logger, appVersion string, m *metrics.Metrics, override InitializationOverrides) (*OpNode, error)

NewWithOverride creates a new OpNode instance with optional initialization overrides. This allows callers to override specific initialization steps, enabling resource sharing (e.g., shared L1Client across multiple nodes) without duplicating connections or caches. If override is nil or any of its fields are nil, the default initialization is used for those steps.

func (*OpNode) HTTPEndpoint

func (n *OpNode) HTTPEndpoint() string

func (*OpNode) HTTPPort added in v1.13.2

func (n *OpNode) HTTPPort() (int, error)

func (*OpNode) InteropRPC added in v1.11.0

func (n *OpNode) InteropRPC() (rpcEndpoint string, jwtSecret eth.Bytes32)

func (*OpNode) InteropRPCPort added in v1.13.2

func (n *OpNode) InteropRPCPort() (int, error)

func (*OpNode) P2P

func (n *OpNode) P2P() p2p.Node

func (*OpNode) PublishBlock added in v1.13.3

func (n *OpNode) PublishBlock(ctx context.Context, signedEnvelope *opsigner.SignedExecutionPayloadEnvelope) error

func (*OpNode) RequestL2Range

func (n *OpNode) RequestL2Range(ctx context.Context, start, end eth.L2BlockRef) error

func (*OpNode) RuntimeConfig added in v1.1.6

func (n *OpNode) RuntimeConfig() runcfg.ReadonlyRuntimeConfig

func (*OpNode) SignAndPublishL2Payload added in v1.13.3

func (n *OpNode) SignAndPublishL2Payload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope) error

func (*OpNode) Start

func (n *OpNode) Start(ctx context.Context) error

func (*OpNode) Stop added in v1.2.0

func (n *OpNode) Stop(ctx context.Context) error

Stop stops the node and closes all resources. If the provided ctx is expired, the node will accelerate the stop where possible, but still fully close.

func (*OpNode) Stopped added in v1.2.0

func (n *OpNode) Stopped() bool

type SafeDBReader added in v1.7.2

type SafeDBReader interface {
	SafeHeadAtL1(ctx context.Context, l1BlockNum uint64) (l1 eth.BlockID, l2 eth.BlockID, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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