Documentation ¶
Index ¶
- type SyncProgressTracker
- func (t *SyncProgressTracker) ClearMeta()
- func (t *SyncProgressTracker) Finished() bool
- func (t *SyncProgressTracker) LastSyncedBlockHash() common.Hash
- func (t *SyncProgressTracker) LastSyncedBlockID() *big.Int
- func (t *SyncProgressTracker) MarkFinished()
- func (t *SyncProgressTracker) NeedReSync(newID *big.Int) (bool, error)
- func (t *SyncProgressTracker) OutOfSync() bool
- func (t *SyncProgressTracker) Track(ctx context.Context)
- func (t *SyncProgressTracker) Triggered() bool
- func (t *SyncProgressTracker) UpdateMeta(id *big.Int, blockHash common.Hash)
- type Syncer
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, 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 *rpc.EthClient, timeout time.Duration) *SyncProgressTracker
NewSyncProgressTracker creates a new SyncProgressTracker instance.
func (*SyncProgressTracker) ClearMeta ¶
func (t *SyncProgressTracker) ClearMeta()
ClearMeta cleans the inner beacon sync metadata.
func (*SyncProgressTracker) Finished ¶
func (t *SyncProgressTracker) Finished() bool
Finished returns whether the current beacon sync has been finished.
func (*SyncProgressTracker) LastSyncedBlockHash ¶
func (t *SyncProgressTracker) LastSyncedBlockHash() common.Hash
LastSyncedBlockHash returns tracker.lastSyncedBlockHash.
func (*SyncProgressTracker) LastSyncedBlockID ¶
func (t *SyncProgressTracker) LastSyncedBlockID() *big.Int
LastSyncedBlockID returns tracker.lastSyncedBlockID.
func (*SyncProgressTracker) MarkFinished ¶
func (t *SyncProgressTracker) MarkFinished()
MarkFinished marks the current beacon sync as finished.
func (*SyncProgressTracker) NeedReSync ¶
func (t *SyncProgressTracker) NeedReSync(newID *big.Int) (bool, error)
NeedReSync checks if a new beacon sync request will be needed: 1, if the beacon sync has not been triggered yet 2, if there is 64 blocks gap between the last head to sync and the new block 3, if the last triggered beacon sync is finished, but there are still new blocks
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 *big.Int, blockHash common.Hash)
UpdateMeta updates the inner beacon sync metadata.
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, syncMode string, progressTracker *SyncProgressTracker, ) *Syncer
NewSyncer creates a new syncer instance.
func (*Syncer) TriggerBeaconSync ¶
TriggerBeaconSync triggers the L2 execution engine to start performing a beacon sync, if the latest verified block has changed.