beaconsync

package
v0.0.0-...-1d04f91 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncProgressTracker

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

SyncProgressTracker is responsible for tracking the L2 execution engine's sync progress, after a beacon sync is triggered in it, and check whether the L2 execution is not able to sync through P2P (due to no connected peer or some other reasons).

func NewSyncProgressTracker

func NewSyncProgressTracker(c *ethclient.Client, timeout time.Duration) *SyncProgressTracker

NewSyncProgressTracker creates a new SyncProgressTracker instance.

func (*SyncProgressTracker) ClearMeta

func (t *SyncProgressTracker) ClearMeta()

ClearMeta cleans the inner beacon sync meta data.

func (*SyncProgressTracker) HeadChanged

func (t *SyncProgressTracker) HeadChanged(newID *big.Int) bool

HeadChanged checks if a new beacon sync request will be needed.

func (*SyncProgressTracker) LastSyncedVerifiedBlockHash

func (t *SyncProgressTracker) LastSyncedVerifiedBlockHash() common.Hash

LastSyncedVerifiedBlockHash returns tracker.lastSyncedVerifiedBlockHash.

func (*SyncProgressTracker) LastSyncedVerifiedBlockHeight

func (t *SyncProgressTracker) LastSyncedVerifiedBlockHeight() *big.Int

LastSyncedVerifiedBlockHeight returns tracker.lastSyncedVerifiedBlockHeight.

func (*SyncProgressTracker) LastSyncedVerifiedBlockID

func (t *SyncProgressTracker) LastSyncedVerifiedBlockID() *big.Int

LastSyncedVerifiedBlockID returns tracker.lastSyncedVerifiedBlockID.

func (*SyncProgressTracker) OutOfSync

func (t *SyncProgressTracker) OutOfSync() bool

OutOfSync tells whether the L2 execution engine is marked as out of sync.

func (*SyncProgressTracker) Track

func (t *SyncProgressTracker) Track(ctx context.Context)

Track starts the inner event loop, to monitor the sync progress.

func (*SyncProgressTracker) Triggered

func (t *SyncProgressTracker) Triggered() bool

Triggered returns tracker.triggered.

func (*SyncProgressTracker) UpdateMeta

func (t *SyncProgressTracker) UpdateMeta(id, height *big.Int, blockHash common.Hash)

UpdateMeta updates the inner beacon sync meta data.

type Syncer

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

Syncer responsible for letting the L2 execution engine catching up with protocol's latest verified block through P2P beacon sync.

func NewSyncer

func NewSyncer(
	ctx context.Context,
	rpc *rpc.Client,
	state *state.State,
	progressTracker *SyncProgressTracker,
) *Syncer

NewSyncer creates a new syncer instance.

func (*Syncer) TriggerBeaconSync

func (s *Syncer) TriggerBeaconSync() error

TriggerBeaconSync triggers the L2 execution engine to start performing a beacon sync.

Jump to

Keyboard shortcuts

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