Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// DBPath path of the DB
DBPath string `mapstructure:"DBPath"`
// BlockFinality indicates the status of the blocks that will be queried in order to sync
BlockFinality string `` //nolint:lll
/* 134-byte string literal not displayed */
// InitialBlockNum is the first block that will be queried when starting the synchronization from scratch.
// It should be a number equal or bellow the creation of the bridge contract
InitialBlockNum uint64 `mapstructure:"InitialBlockNum"`
// GlobalExitRootL2Addr is the address of the GER smart contract on L2
GlobalExitRootL2Addr common.Address `mapstructure:"GlobalExitRootL2Addr"`
// RetryAfterErrorPeriod is the time that will be waited when an unexpected error happens before retry
RetryAfterErrorPeriod types.Duration `mapstructure:"RetryAfterErrorPeriod"`
// MaxRetryAttemptsAfterError is the maximum number of consecutive attempts that will happen before panicing.
// Any number smaller than zero will be considered as unlimited retries
MaxRetryAttemptsAfterError int `mapstructure:"MaxRetryAttemptsAfterError"`
// WaitForNewBlocksPeriod time that will be waited when the synchronizer has reached the latest block
WaitForNewBlocksPeriod types.Duration `mapstructure:"WaitForNewBlocksPeriod"`
// DownloadBufferSize buffer of events to be porcessed. When the buffer limit is reached,
// downloading will stop until the processing catches up.
DownloadBufferSize int `mapstructure:"DownloadBufferSize"`
// RequireStorageContentCompatibility is true it's mandatory that data stored in the database
// is compatible with the running environment
RequireStorageContentCompatibility bool `mapstructure:"RequireStorageContentCompatibility"`
}
type EthClienter ¶
type EthClienter interface {
ethereum.LogFilterer
ethereum.BlockNumberReader
ethereum.ChainReader
ethereum.ChainIDReader
bind.ContractBackend
}
type LastGERSync ¶
type LastGERSync struct {
// contains filtered or unexported fields
}
LastGERSync is responsible for managing GER synchronization.
func New ¶
func New( ctx context.Context, dbPath string, rdL2 sync.ReorgDetector, l2Client EthClienter, globalExitRootL2 common.Address, l1InfoTreesync *l1infotreesync.L1InfoTreeSync, retryAfterErrorPeriod time.Duration, maxRetryAttemptsAfterError int, blockFinality etherman.BlockNumberFinality, waitForNewBlocksPeriod time.Duration, downloadBufferSize int, requireStorageContentCompatibility bool, ) (*LastGERSync, error)
New initializes and returns a new instance of LastGERSync
func (*LastGERSync) GetFirstGERAfterL1InfoTreeIndex ¶
func (s *LastGERSync) GetFirstGERAfterL1InfoTreeIndex( ctx context.Context, atOrAfterL1InfoTreeIndex uint32, ) (Event, error)
GetFirstGERAfterL1InfoTreeIndex returns the first GER after a specified L1 info tree index
func (*LastGERSync) GetLastProcessedBlock ¶
func (s *LastGERSync) GetLastProcessedBlock(ctx context.Context) (uint64, error)
GetLastProcessedBlock returns the last processed block number
Click to show internal directories.
Click to hide internal directories.