syncing

package
v1.0.0-beta.11 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DARetriever

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

DARetriever handles DA retrieval operations for syncing

func NewDARetriever

func NewDARetriever(
	da coreda.DA,
	cache cache.Manager,
	config config.Config,
	genesis genesis.Genesis,
	logger zerolog.Logger,
) *DARetriever

NewDARetriever creates a new DA retriever

func (*DARetriever) RetrieveFromDA

func (r *DARetriever) RetrieveFromDA(ctx context.Context, daHeight uint64) ([]common.DAHeightEvent, error)

RetrieveFromDA retrieves blocks from the specified DA height and returns height events

type P2PHandler

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

P2PHandler coordinates block retrieval from P2P stores for the syncer. It waits for both header and data to be available at a given height, validates their consistency, and emits events to the syncer for processing.

The handler maintains a processedHeight to track the highest block that has been successfully validated and sent to the syncer, preventing duplicate processing.

func NewP2PHandler

func NewP2PHandler(
	headerStore goheader.Store[*types.SignedHeader],
	dataStore goheader.Store[*types.Data],
	cache cache.Manager,
	genesis genesis.Genesis,
	logger zerolog.Logger,
) *P2PHandler

NewP2PHandler creates a new P2P handler.

func (*P2PHandler) ProcessHeight

func (h *P2PHandler) ProcessHeight(ctx context.Context, height uint64, heightInCh chan<- common.DAHeightEvent) error

ProcessHeight retrieves and validates both header and data for the given height from P2P stores. It blocks until both are available, validates consistency (proposer address and data hash match), then emits the event to heightInCh or stores it as pending. Updates processedHeight on success.

func (*P2PHandler) SetProcessedHeight

func (h *P2PHandler) SetProcessedHeight(height uint64)

SetProcessedHeight updates the highest processed block height.

type Syncer

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

Syncer handles block synchronization from DA and P2P sources.

func NewSyncer

func NewSyncer(
	store store.Store,
	exec coreexecutor.Executor,
	da coreda.DA,
	cache cache.Manager,
	metrics *common.Metrics,
	config config.Config,
	genesis genesis.Genesis,
	headerStore common.Broadcaster[*types.SignedHeader],
	dataStore common.Broadcaster[*types.Data],
	logger zerolog.Logger,
	options common.BlockOptions,
	errorCh chan<- error,
) *Syncer

NewSyncer creates a new block syncer

func (*Syncer) GetLastState

func (s *Syncer) GetLastState() types.State

GetLastState returns the current state

func (*Syncer) SetLastState

func (s *Syncer) SetLastState(state types.State)

SetLastState updates the current state

func (*Syncer) Start

func (s *Syncer) Start(ctx context.Context) error

Start begins the syncing component

func (*Syncer) Stop

func (s *Syncer) Stop() error

Stop shuts down the syncing component

Jump to

Keyboard shortcuts

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