Skip to content

Conversation

jonastheis
Copy link

@jonastheis jonastheis commented Oct 2, 2025

1. Purpose or design rationale of this PR

This PR adds a flag to make the L1 sync interval configurable. This is necessary for testing with shorter L1 block and finality times: scroll-tech/rollup-node#343

2. PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • build: Changes that affect the build system or external dependencies (example scopes: yarn, eslint, typescript)
  • ci: Changes to our CI configuration files and scripts (example scopes: vercel, github, cypress)
  • docs: Documentation-only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that doesn't fix a bug, or add a feature, or improves performance
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests

3. Deployment tag versioning

Has the version in params/version.go been updated?

  • This PR doesn't involve a new deployment, git tag, docker image tag, and it doesn't affect traces
  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change
  • Yes

Summary by CodeRabbit

  • New Features

    • Added a CLI option to configure the L1 sync polling interval, allowing users to adjust how frequently the node polls for L1 messages. If not set, a default interval is used.
  • Documentation

    • Updated CLI help to list the new L1 sync interval option under the ROLLUP category, making it easier to discover and configure.

Copy link

coderabbitai bot commented Oct 2, 2025

Walkthrough

Adds a new l1.sync.interval CLI flag, threads it through cmd/utils and node.Config, and uses it in rollup/sync_service to control the L1 polling interval with a zero-value fallback to the existing default.

Changes

Cohort / File(s) Summary
CLI exposure
cmd/geth/main.go, cmd/geth/usage.go
Exposes utils.L1SyncIntervalFlag in public node flags and ROLLUP help group.
Flag definition and wiring
cmd/utils/flags.go
Adds L1SyncIntervalFlag (cli.DurationFlag) and assigns cfg.L1SyncInterval in setL1 from context.
Config surface
node/config.go
Introduces Config.L1SyncInterval time.Duration; imports time.
Sync service consumption
rollup/sync_service/sync_service.go
Reads nodeConfig.L1SyncInterval; uses it to set SyncService.pollInterval with default fallback.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User as CLI User
  participant Geth as geth (cmd/geth)
  participant Utils as utils (flags)
  participant Node as node.Config
  participant Sync as rollup.SyncService

  User->>Geth: Start with --l1.sync.interval=Dur?
  Geth->>Utils: Parse flags
  Utils->>Node: set cfg.L1SyncInterval = Dur (if provided)
  Geth->>Sync: Initialize with nodeConfig
  alt Interval provided
    Sync->>Sync: pollInterval = cfg.L1SyncInterval
  else Zero value
    Sync->>Sync: pollInterval = DefaultPollInterval
  end
  Note over Sync: Ticker uses pollInterval for L1 sync loop
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

bump-version

Suggested reviewers

  • colinlyguo
  • Thegaram

Poem

A bunny taps the ticking clock, hop-hop in perfect time,
New flags set the rhythm now, a configurable chime.
From CLI to syncy burrow, intervals align,
If none is set, the old beat plays—still steady, still fine.
Thump-thump, poll-poll—ship it! 🐇⏱️

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title clearly and concisely summarizes the primary change by indicating a new L1 sync service flag, follows the conventional commit format, and references the correct scope and feature.
Description Check ✅ Passed The pull request description follows the repository template by including all required sections: purpose, title convention compliance, deployment tag versioning, and breaking change label, and each section is properly completed with relevant information.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/l1-sync-interval-flag

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
rollup/sync_service/sync_service.go (1)

103-113: LGTM!

The implementation correctly reads the configured L1SyncInterval and falls back to DefaultPollInterval when the config value is zero, maintaining backward compatibility.

Consider adding validation to ensure the configured interval is reasonable (e.g., not too short), though the current implementation is safe:

 pollInterval := nodeConfig.L1SyncInterval
 if pollInterval == 0 {
 	pollInterval = DefaultPollInterval
+} else if pollInterval < time.Second {
+	log.Warn("L1 sync interval is very short, using minimum of 1 second", "configured", pollInterval)
+	pollInterval = time.Second
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 10b0905 and 61e0321.

📒 Files selected for processing (5)
  • cmd/geth/main.go (1 hunks)
  • cmd/geth/usage.go (1 hunks)
  • cmd/utils/flags.go (2 hunks)
  • node/config.go (2 hunks)
  • rollup/sync_service/sync_service.go (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
cmd/geth/usage.go (1)
cmd/utils/flags.go (1)
  • L1SyncIntervalFlag (856-859)
cmd/geth/main.go (1)
cmd/utils/flags.go (1)
  • L1SyncIntervalFlag (856-859)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (go)
  • GitHub Check: test
🔇 Additional comments (6)
node/config.go (2)

28-28: LGTM!

The time import is correctly added to support the new L1SyncInterval field.


201-202: LGTM!

The L1SyncInterval field is correctly defined with appropriate type, documentation, and TOML tagging consistent with other L1 configuration fields.

cmd/geth/usage.go (1)

236-236: LGTM!

The L1SyncIntervalFlag is correctly added to the ROLLUP flag group, ensuring it appears in the help documentation alongside other L1 configuration options.

cmd/utils/flags.go (2)

856-859: LGTM!

The L1SyncIntervalFlag is correctly defined with a clear name and helpful usage examples demonstrating duration formats.


1477-1479: LGTM!

The flag parsing correctly uses ctx.GlobalDuration and assigns the value to cfg.L1SyncInterval. The zero-value fallback is appropriately handled downstream in the sync service.

cmd/geth/main.go (1)

173-173: LGTM!

The L1SyncIntervalFlag is correctly added to nodeFlags, ensuring the flag is recognized and processed by the CLI.

@jonastheis jonastheis merged commit c5fcd99 into develop Oct 2, 2025
14 checks passed
@jonastheis jonastheis deleted the feat/l1-sync-interval-flag branch October 2, 2025 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants