syncnode

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: MIT Imports: 22 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(ev event.Event) bool

func (*ManagedNode) OnResetReady added in v1.12.0

func (m *ManagedNode) OnResetReady(lUnsafe, xUnsafe, lSafe, xSafe, finalized eth.BlockID)

OnResetReady handles a reset-ready event from the supervisor once the supervisor has determined the reset target by bisecting the search range

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

func (r *RPCDialSetup) Setup(ctx context.Context, logger log.Logger) (SyncNode, error)

type RPCSyncNode

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

func NewRPCSyncNode

func NewRPCSyncNode(name string, cl client.RPC) *RPCSyncNode

func (*RPCSyncNode) AnchorPoint

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

func (*RPCSyncNode) BlockRefByNumber

func (rs *RPCSyncNode) BlockRefByNumber(ctx context.Context, number uint64) (eth.BlockRef, error)

func (*RPCSyncNode) ChainID

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

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) 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.ManagedEvent, 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) Reset

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

func (*RPCSyncNode) String

func (rs *RPCSyncNode) String() string

func (*RPCSyncNode) SubscribeEvents

func (rs *RPCSyncNode) SubscribeEvents(ctx context.Context, dest chan *types.ManagedEvent) (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.ManagedEvent) (ethereum.Subscription, error)
	PullEvent(ctx context.Context) (*types.ManagedEvent, error)
	BlockRefByNumber(ctx context.Context, number uint64) (eth.BlockRef, 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
	ProvideL1(ctx context.Context, nextL1 eth.BlockRef) error
	AnchorPoint(ctx context.Context) (types.DerivedBlockRefPair, 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) (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(ev event.Event) bool

type SyncSource

type SyncSource interface {
	BlockRefByNumber(ctx context.Context, number uint64) (eth.BlockRef, 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