Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ var (
utils.L1ConfirmationsFlag,
utils.L1DeploymentBlockFlag,
utils.L1SyncIntervalFlag,
utils.L1FetchBlockRangeFlag,
utils.L1DisableMessageQueueV2Flag,
utils.CircuitCapacityCheckEnabledFlag,
utils.CircuitCapacityCheckWorkersFlag,
Expand Down
7 changes: 7 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,10 @@ var (
Name: "l1.sync.interval",
Usage: "Poll interval for L1 message syncing (e.g., 2s, 10s, 1m)",
}
L1FetchBlockRangeFlag = cli.Uint64Flag{
Name: "l1.sync.fetchblockrange",
Usage: "Block range for L1 message fetching in a single eth_getLogs query",
}
L1DisableMessageQueueV2Flag = &cli.BoolFlag{
Name: "l1.disablemqv2",
Usage: "Disable L1 message queue v2",
Expand Down Expand Up @@ -1477,6 +1481,9 @@ func setL1(ctx *cli.Context, cfg *node.Config) {
if ctx.GlobalIsSet(L1SyncIntervalFlag.Name) {
cfg.L1SyncInterval = ctx.GlobalDuration(L1SyncIntervalFlag.Name)
}
if ctx.GlobalIsSet(L1FetchBlockRangeFlag.Name) {
cfg.L1FetchBlockRange = ctx.GlobalUint64(L1FetchBlockRangeFlag.Name)
}
if ctx.GlobalIsSet(L1DisableMessageQueueV2Flag.Name) {
cfg.L1DisableMessageQueueV2 = ctx.GlobalBool(L1DisableMessageQueueV2Flag.Name)
}
Expand Down
2 changes: 2 additions & 0 deletions node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ type Config struct {
L1DeploymentBlock uint64 `toml:",omitempty"`
// Poll interval for L1 message syncing
L1SyncInterval time.Duration `toml:",omitempty"`
// Block range for L1 message fetching in a single eth_getLogs query
L1FetchBlockRange uint64 `toml:",omitempty"`
// Explicitly disable L1 message queue V2 and only query from L1 message queue V1 (before EuclidV2)
L1DisableMessageQueueV2 bool `toml:",omitempty"`
// Is daSyncingEnabled
Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 9 // Minor version component of the current release
VersionPatch = 5 // Patch version component of the current release
VersionPatch = 6 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down
11 changes: 9 additions & 2 deletions rollup/sync_service/sync_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type SyncService struct {
db ethdb.Database
msgCountFeed event.Feed
pollInterval time.Duration
fetchBlockRange uint64
latestProcessedBlock uint64
scope event.SubscriptionScope
stateMu sync.Mutex
Expand Down Expand Up @@ -105,12 +106,18 @@ func NewSyncService(ctx context.Context, genesisConfig *params.ChainConfig, node
pollInterval = DefaultPollInterval
}

fetchBlockRange := nodeConfig.L1FetchBlockRange
if fetchBlockRange == 0 {
fetchBlockRange = DefaultFetchBlockRange
}

service := SyncService{
ctx: ctx,
cancel: cancel,
client: client,
db: db,
pollInterval: pollInterval,
fetchBlockRange: fetchBlockRange,
latestProcessedBlock: latestProcessedBlock,
}

Expand Down Expand Up @@ -236,7 +243,7 @@ func (s *SyncService) fetchMessages() {
numMsgsCollected := 0

// query in batches
for from := s.latestProcessedBlock + 1; from <= latestConfirmed; from += DefaultFetchBlockRange {
for from := s.latestProcessedBlock + 1; from <= latestConfirmed; from += s.fetchBlockRange {
select {
case <-s.ctx.Done():
// flush pending writes to database
Expand All @@ -250,7 +257,7 @@ func (s *SyncService) fetchMessages() {
default:
}

to := from + DefaultFetchBlockRange - 1
to := from + s.fetchBlockRange - 1
if to > latestConfirmed {
to = latestConfirmed
}
Expand Down
Loading