syncnode

package
v1.13.7 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLISyncNodes

type CLISyncNodes struct {
	Endpoints      []string
	JWTSecretPaths []string
}

func (*CLISyncNodes) Check

func (p *CLISyncNodes) Check() error

func (*CLISyncNodes) Load

func (p *CLISyncNodes) Load(ctx context.Context, logger log.Logger) ([]SyncNodeSetup, error)

type ManagedNode

type ManagedNode struct {
	Node SyncControl
	// contains filtered or unexported fields
}

func NewManagedNode

func NewManagedNode(log log.Logger, id eth.ChainID, node SyncControl, backend backend, noSubscribe bool) *ManagedNode

func (*ManagedNode) AttachEmitter

func (m *ManagedNode) AttachEmitter(em event.Emitter)

func (*ManagedNode) Close

func (m *ManagedNode) Close() error

func (*ManagedNode) OnEvent

func (m *ManagedNode) OnEvent(ctx context.Context, ev event.Event) bool

OnEvent handles internal supervisor events and translates these into outgoing actions/signals for the managed node.

func (*ManagedNode) PullEvents

func (m *ManagedNode) PullEvents(ctx context.Context) (pulledAny bool, err error)

PullEvents pulls all events, until there are none left, the ctx is canceled, or an error upon event-pulling occurs.

func (*ManagedNode) Start

func (m *ManagedNode) Start()

func (*ManagedNode) SubscribeToNodeEvents

func (m *ManagedNode) SubscribeToNodeEvents()

func (*ManagedNode) WatchSubscriptionErrors

func (m *ManagedNode) WatchSubscriptionErrors()

type Node

type Node interface {
	PullEvents(ctx context.Context) (pulledAny bool, err error)
}

type RPCDialSetup

type RPCDialSetup struct {
	JWTSecret eth.Bytes32
	Endpoint  string
}

func (*RPCDialSetup) Setup

type RPCSyncNode

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

func NewRPCSyncNode

func NewRPCSyncNode(name string, cl client.RPC, opts []client.RPCOption, logger log.Logger, dialSetup *RPCDialSetup) *RPCSyncNode

func (*RPCSyncNode) AnchorPoint

func (rs *RPCSyncNode) AnchorPoint(ctx context.Context) (types.DerivedBlockRefPair, error)

func (*RPCSyncNode) ChainID

func (rs *RPCSyncNode) ChainID(ctx context.Context) (eth.ChainID, error)

func (*RPCSyncNode) Contains added in v1.13.3

func (rs *RPCSyncNode) Contains(ctx context.Context, query types.ContainsQuery) (types.BlockSeal, error)

Contains returns no error iff the specified logHash is recorded in the specified blockNum and logIdx. If the log is out of reach and the block is complete, an ErrConflict is returned. If the log is out of reach and the block is not complete, an ErrFuture is returned. If the log is determined to conflict with the canonical chain, then ErrConflict is returned. logIdx is the index of the log in the array of all logs in the block. This can be used to check the validity of cross-chain interop events. The block-seal of the blockNum block that the log was included in is returned.

func (*RPCSyncNode) FetchReceipts

func (rs *RPCSyncNode) FetchReceipts(ctx context.Context, blockHash common.Hash) (gethtypes.Receipts, error)

func (*RPCSyncNode) InvalidateBlock

func (rs *RPCSyncNode) InvalidateBlock(ctx context.Context, seal types.BlockSeal) error

func (*RPCSyncNode) L2BlockRefByNumber added in v1.13.5

func (rs *RPCSyncNode) L2BlockRefByNumber(ctx context.Context, number uint64) (eth.L2BlockRef, error)

func (*RPCSyncNode) L2BlockRefByTimestamp

func (rs *RPCSyncNode) L2BlockRefByTimestamp(ctx context.Context, timestamp uint64) (eth.L2BlockRef, error)

func (*RPCSyncNode) OutputV0AtTimestamp

func (rs *RPCSyncNode) OutputV0AtTimestamp(ctx context.Context, timestamp uint64) (*eth.OutputV0, error)

func (*RPCSyncNode) PendingOutputV0AtTimestamp

func (rs *RPCSyncNode) PendingOutputV0AtTimestamp(ctx context.Context, timestamp uint64) (*eth.OutputV0, error)

func (*RPCSyncNode) ProvideL1

func (rs *RPCSyncNode) ProvideL1(ctx context.Context, nextL1 eth.BlockRef) error

func (*RPCSyncNode) PullEvent

func (rs *RPCSyncNode) PullEvent(ctx context.Context) (*types.IndexingEvent, error)

PullEvent pulls an event, as alternative to an event-subscription with SubscribeEvents. This returns an io.EOF error if no new events are available.

func (*RPCSyncNode) ReconnectRPC added in v1.13.3

func (rs *RPCSyncNode) ReconnectRPC(ctx context.Context) error

func (*RPCSyncNode) Reset

func (rs *RPCSyncNode) Reset(ctx context.Context, lUnsafe, xUnsafe, lSafe, xSafe, finalized eth.BlockID) error

func (*RPCSyncNode) ResetPreInterop added in v1.13.4

func (rs *RPCSyncNode) ResetPreInterop(ctx context.Context) error

func (*RPCSyncNode) String

func (rs *RPCSyncNode) String() string

func (*RPCSyncNode) SubscribeEvents

func (rs *RPCSyncNode) SubscribeEvents(ctx context.Context, dest chan *types.IndexingEvent) (ethereum.Subscription, error)

func (*RPCSyncNode) UpdateCrossSafe

func (rs *RPCSyncNode) UpdateCrossSafe(ctx context.Context, derived eth.BlockID, source eth.BlockID) error

func (*RPCSyncNode) UpdateCrossUnsafe

func (rs *RPCSyncNode) UpdateCrossUnsafe(ctx context.Context, id eth.BlockID) error

func (*RPCSyncNode) UpdateFinalized

func (rs *RPCSyncNode) UpdateFinalized(ctx context.Context, id eth.BlockID) error

type SyncControl

type SyncControl interface {
	SubscribeEvents(ctx context.Context, c chan *types.IndexingEvent) (ethereum.Subscription, error)
	PullEvent(ctx context.Context) (*types.IndexingEvent, error)
	L2BlockRefByNumber(ctx context.Context, number uint64) (eth.L2BlockRef, error)

	UpdateCrossUnsafe(ctx context.Context, id eth.BlockID) error
	UpdateCrossSafe(ctx context.Context, derived eth.BlockID, source eth.BlockID) error
	UpdateFinalized(ctx context.Context, id eth.BlockID) error

	InvalidateBlock(ctx context.Context, seal types.BlockSeal) error

	Reset(ctx context.Context, lUnsafe, xUnsafe, lSafe, xSafe, finalized eth.BlockID) error
	ResetPreInterop(ctx context.Context) error
	ProvideL1(ctx context.Context, nextL1 eth.BlockRef) error
	AnchorPoint(ctx context.Context) (types.DerivedBlockRefPair, error)

	ReconnectRPC(ctx context.Context) error

	fmt.Stringer
}

type SyncNode

type SyncNode interface {
	SyncSource
	SyncControl
}

type SyncNodeCollection

type SyncNodeCollection interface {
	Load(ctx context.Context, logger log.Logger) ([]SyncNodeSetup, error)
	Check() error
}

type SyncNodeSetup

type SyncNodeSetup interface {
	Setup(ctx context.Context, logger log.Logger, m opmetrics.RPCMetricer) (SyncNode, error)
}

type SyncNodesController

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

SyncNodesController manages a collection of active sync nodes. Sync nodes are used to sync the supervisor, and subject to the canonical chain view as followed by the supervisor.

func NewSyncNodesController

func NewSyncNodesController(l log.Logger, depset depset.DependencySet, eventSys event.System, backend backend) *SyncNodesController

NewSyncNodesController creates a new SyncNodeController

func (*SyncNodesController) AttachEmitter

func (snc *SyncNodesController) AttachEmitter(em event.Emitter)

func (*SyncNodesController) AttachNodeController

func (snc *SyncNodesController) AttachNodeController(chainID eth.ChainID, ctrl SyncControl, noSubscribe bool) (Node, error)

AttachNodeController attaches a node to be managed by the supervisor. If noSubscribe, the node is not actively polled/subscribed to, and requires manual ManagedNode.PullEvents calls.

func (*SyncNodesController) Close

func (snc *SyncNodesController) Close() error

func (*SyncNodesController) OnEvent

func (snc *SyncNodesController) OnEvent(ctx context.Context, ev event.Event) bool

type SyncSource

type SyncSource interface {
	Contains(ctx context.Context, query types.ContainsQuery) (includedIn types.BlockSeal, err error)
	L2BlockRefByNumber(ctx context.Context, number uint64) (eth.L2BlockRef, error)
	FetchReceipts(ctx context.Context, blockHash common.Hash) (gethtypes.Receipts, error)
	ChainID(ctx context.Context) (eth.ChainID, error)
	OutputV0AtTimestamp(ctx context.Context, timestamp uint64) (*eth.OutputV0, error)
	PendingOutputV0AtTimestamp(ctx context.Context, timestamp uint64) (*eth.OutputV0, error)
	L2BlockRefByTimestamp(ctx context.Context, timestamp uint64) (eth.L2BlockRef, error)
	// String identifies the sync source
	String() string
}

Jump to

Keyboard shortcuts

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