source

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockByNumberSource

type BlockByNumberSource interface {
	L1BlockRefByNumber(ctx context.Context, number uint64) (eth.L1BlockRef, error)
}

type BlockProcessor

type BlockProcessor interface {
	ProcessBlock(ctx context.Context, block eth.L1BlockRef) error
}

type BlockProcessorFn

type BlockProcessorFn func(ctx context.Context, block eth.L1BlockRef) error

func (BlockProcessorFn) ProcessBlock

func (fn BlockProcessorFn) ProcessBlock(ctx context.Context, block eth.L1BlockRef) error

type ChainMonitor

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

ChainMonitor monitors a source L2 chain, retrieving the data required to populate the database and perform interop consolidation. It detects and notifies when reorgs occur.

func NewChainMonitor

func NewChainMonitor(ctx context.Context, logger log.Logger, m Metrics, chainID types.ChainID, rpc string, client client.RPC, store Storage) (*ChainMonitor, error)

func (*ChainMonitor) Start

func (c *ChainMonitor) Start() error

func (*ChainMonitor) Stop

func (c *ChainMonitor) Stop() error

type ChainProcessor

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

ChainProcessor is a HeadProcessor that fills in any skipped blocks between head update events. It ensures that, absent reorgs, every block in the chain is processed even if some head advancements are skipped.

func NewChainProcessor

func NewChainProcessor(log log.Logger, client BlockByNumberSource, chain types.ChainID, startingHead eth.L1BlockRef, processor BlockProcessor, rewinder DatabaseRewinder) *ChainProcessor

func (*ChainProcessor) OnNewHead

func (s *ChainProcessor) OnNewHead(ctx context.Context, head eth.L1BlockRef)

type DatabaseRewinder

type DatabaseRewinder interface {
	Rewind(chain types.ChainID, headBlockNum uint64) error
}

type HeadChangeCallback

type HeadChangeCallback interface {
	OnNewUnsafeHead(ctx context.Context, block eth.L1BlockRef)
	OnNewSafeHead(ctx context.Context, block eth.L1BlockRef)
	OnNewFinalizedHead(ctx context.Context, block eth.L1BlockRef)
}

type HeadMonitor

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

HeadMonitor monitors an L2 chain and sends notifications when the unsafe, safe or finalized head changes. Head updates may be coalesced, allowing the head block to skip forward multiple blocks. Reorgs are not identified.

func NewHeadMonitor

func NewHeadMonitor(logger log.Logger, epochPollInterval time.Duration, rpc HeadMonitorClient, callback HeadChangeCallback) *HeadMonitor

func (*HeadMonitor) Start

func (h *HeadMonitor) Start() error

func (*HeadMonitor) Stop

func (h *HeadMonitor) Stop() error

type HeadMonitorClient

type HeadMonitorClient interface {
	eth.NewHeadSource
	eth.L1BlockRefsSource
}

type HeadProcessor

type HeadProcessor interface {
	OnNewHead(ctx context.Context, head eth.L1BlockRef)
}

type HeadProcessorFn

type HeadProcessorFn func(ctx context.Context, head eth.L1BlockRef)

func (HeadProcessorFn) OnNewHead

func (f HeadProcessorFn) OnNewHead(ctx context.Context, head eth.L1BlockRef)

type LogSource

type LogSource interface {
	FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
}

type LogStorage

type LogStorage interface {
	AddLog(chain supTypes.ChainID, logHash types.TruncatedHash, block eth.BlockID, timestamp uint64, logIdx uint32, execMsg *types.ExecutingMessage) error
}

type Metrics

type Metrics interface {
	caching.Metrics
}

type ReceiptProcessor

type ReceiptProcessor interface {
	ProcessLogs(ctx context.Context, block eth.L1BlockRef, rcpts types.Receipts) error
}

type ReceiptProcessorFn

type ReceiptProcessorFn func(ctx context.Context, block eth.L1BlockRef, rcpts types.Receipts) error

func (ReceiptProcessorFn) ProcessLogs

func (r ReceiptProcessorFn) ProcessLogs(ctx context.Context, block eth.L1BlockRef, rcpts types.Receipts) error

type Storage

type Storage interface {
	LogStorage
	DatabaseRewinder
	LatestBlockNum(chainID types.ChainID) uint64
}

Jump to

Keyboard shortcuts

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