source

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockProcessorFn

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

func (BlockProcessorFn) ProcessBlock

func (fn BlockProcessorFn) ProcessBlock(ctx context.Context, block eth.BlockRef) 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 Source, chain types.ChainID, processor LogProcessor, rewinder DatabaseRewinder) *ChainProcessor

func (*ChainProcessor) Close added in v1.9.4

func (s *ChainProcessor) Close()

func (*ChainProcessor) OnNewHead

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

type ChainsDBClientForLogProcessor added in v1.9.4

type ChainsDBClientForLogProcessor interface {
	SealBlock(chain types.ChainID, block eth.BlockRef) error
	AddLog(chain types.ChainID, logHash common.Hash, parentBlock eth.BlockID, logIdx uint32, execMsg *types.ExecutingMessage) error
}

type DatabaseRewinder

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

type EventDecoder added in v1.9.1

type EventDecoder interface {
	DecodeExecutingMessageLog(log *ethTypes.Log) (types.ExecutingMessage, 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) error
}

type HeadProcessorFn

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

func OnNewHead added in v1.9.4

func OnNewHead(id types.ChainID, apply func(id types.ChainID, v heads.HeadPointer) error) HeadProcessorFn

OnNewHead is a util function to turn a head-signal processor into head-pointer updater

func (HeadProcessorFn) OnNewHead

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

type LogProcessor added in v1.9.4

type LogProcessor interface {
	ProcessLogs(ctx context.Context, block eth.BlockRef, receipts gethtypes.Receipts) error
}

type LogStorage

type LogStorage interface {
	SealBlock(chain types.ChainID, block eth.BlockRef) error
	AddLog(chain types.ChainID, logHash common.Hash, parentBlock eth.BlockID, logIdx uint32, execMsg *types.ExecutingMessage) error
}

type Metrics

type Metrics interface {
	caching.Metrics
}

type Source added in v1.9.4

type Source interface {
	L1BlockRefByNumber(ctx context.Context, number uint64) (eth.L1BlockRef, error)
	FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, gethtypes.Receipts, error)
}

type Storage

type Storage interface {
	ChainsDBClientForLogProcessor
	DatabaseRewinder
	LatestBlockNum(chainID types.ChainID) (num uint64, ok bool)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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