Skip to content

Conversation

ranchalp
Copy link
Contributor

@ranchalp ranchalp commented May 22, 2025

Purpose or design rationale of this PR

  • Make db log Trace and not Debug
  • Use blocktime for batch submission timeouts (in line with how bundle timeouts work)
  • Log metrics to track sequencer submission strategy

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

Deployment tag versioning

Has tag in common/version.go been updated or have you added bump-version label to this PR?

  • No, this PR doesn't involve a new deployment, git tag, docker image tag
  • Yes

Breaking change label

Does this PR have the breaking-change label?

  • No, this PR is not a breaking change
  • Yes

Summary by CodeRabbit

  • New Features

    • Introduced new monitoring metrics for current and target blob prices, commit latency, and backlog counts in the L2 relayer.
  • Improvements

    • Enhanced batch processing logic in the L2 relayer to use the timestamp of the first block in a batch for more accurate age calculations, logging, and metrics.
    • Improved metrics reporting with immediate updates after relevant operations.
    • Adjusted SQL trace log verbosity for clearer database operation insights.
  • Other

    • Updated version to v4.5.16.

@ranchalp ranchalp added the bump-version Bump the version tag for deployment label May 22, 2025
Copy link

coderabbitai bot commented May 22, 2025

Walkthrough

This update modifies the L2 relayer's batch processing logic to use the timestamp of the first block in the batch's starting chunk instead of the batch creation time for age calculations, fee checks, and metrics. It also adds new Prometheus metrics for blob prices, commit latency, and backlog counts, adjusts SQL trace logging verbosity, and updates the version string.

Changes

File(s) Change Summary
common/database/db.go Changed the logging level for SQL trace logs from Debug to Trace in the gormLogger's Trace method.
common/version/version.go Updated version tag from "v4.5.15" to "v4.5.16".
rollup/internal/controller/relayer/l2_relayer.go Switched timestamp reference from batch creation to first block's time in batch for fee checks, timeouts, logging, and metrics. Also updated metrics reporting and changed skipSubmitByFee method signature.
rollup/internal/controller/relayer/l2_relayer_metrics.go Added four new Prometheus Gauge metrics to l2RelayerMetrics: current/target blob prices, commit latency, and backlog counts.

Sequence Diagram(s)

sequenceDiagram
    participant Relayer
    participant Metrics
    participant Batch
    participant Chunk

    Relayer->>Batch: Fetch oldest batch
    Batch->>Chunk: Get first chunk's StartBlockTime
    Relayer->>Relayer: Use StartBlockTime for age, fee, and timeout checks
    Relayer->>Metrics: Update backlog count, blob prices, commit latency
    Relayer->>Batch: Submit batch if conditions met
Loading

Possibly related PRs

Suggested reviewers

  • jonastheis
  • colinlyguo

Poem

In the warren where metrics bloom and grow,
The relayer now checks the oldest block’s glow.
With blobs and backlogs counted anew,
Commit latency tracked, precision in view.
A hop, a skip, a version bump too—
v4.5.16, we’re hopping with you!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fe58865 and d945318.

📒 Files selected for processing (1)
  • rollup/internal/controller/relayer/l2_relayer_metrics.go (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • rollup/internal/controller/relayer/l2_relayer_metrics.go
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: tests
  • GitHub Check: tests
  • GitHub Check: check
  • GitHub Check: tests
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ranchalp ranchalp requested review from jonastheis and colinlyguo May 22, 2025 07:42
colinlyguo
colinlyguo previously approved these changes May 22, 2025
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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fa9fab6 and ba5e26d.

📒 Files selected for processing (4)
  • common/database/db.go (1 hunks)
  • common/version/version.go (1 hunks)
  • rollup/internal/controller/relayer/l2_relayer.go (6 hunks)
  • rollup/internal/controller/relayer/l2_relayer_metrics.go (1 hunks)
🔇 Additional comments (9)
common/database/db.go (1)

44-44: Improved log level categorization

Changed the SQL trace logs from Debug to Trace level, providing better categorization of log verbosity.

common/version/version.go (1)

8-8: Version bump for the codebase

Incremented version tag from v4.5.15 to v4.5.16 to reflect the changes in this PR.

rollup/internal/controller/relayer/l2_relayer.go (7)

329-330: Updated backlog count metrics

Added metric update to track backlog counts immediately after retrieving the value, improving monitoring capabilities.


338-343: Use blocktime instead of batch creation time

Changed to use the timestamp of the first block in the batch's starting chunk instead of the batch creation time, which aligns with how bundle timeouts are handled.


346-346: Updated timeout check to use block timestamp

Modified the timeout check to use the block timestamp instead of batch creation time, providing consistency with the rest of the system.


357-357: Updated fee check to use block timestamp and metrics

Modified the function call to pass the block timestamp and metrics object to the fee check function.


443-443: Updated log message to use block timestamp

Changed the log message to reference the block timestamp instead of batch creation time for clarity and consistency.


508-508: Added commit latency metric

Set the commit latency metric based on the time elapsed since the oldest block timestamp, enhancing observability.


1091-1110: Updated fee check function to update metrics

Modified the function signature to accept a metrics parameter and added code to update the current and target blob price metrics, enhancing monitoring capabilities.

@codecov-commenter
Copy link

codecov-commenter commented May 22, 2025

Codecov Report

Attention: Patch coverage is 63.15789% with 14 lines in your changes missing coverage. Please review.

Project coverage is 40.92%. Comparing base (fa9fab6) to head (d945318).

Files with missing lines Patch % Lines
rollup/internal/controller/relayer/l2_relayer.go 33.33% 13 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1663      +/-   ##
===========================================
- Coverage    41.00%   40.92%   -0.08%     
===========================================
  Files          225      225              
  Lines        18031    18061      +30     
===========================================
- Hits          7393     7392       -1     
- Misses        9913     9948      +35     
+ Partials       725      721       -4     
Flag Coverage Δ
common 29.86% <100.00%> (ø)
coordinator 34.47% <ø> (+0.03%) ⬆️
database 42.05% <ø> (ø)
rollup 49.76% <62.16%> (-0.38%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ranchalp and others added 2 commits May 22, 2025 11:08
Co-authored-by: Jonas Theis <4181434+jonastheis@users.noreply.github.com>
@ranchalp ranchalp requested a review from colinlyguo May 22, 2025 10:31
Copy link
Contributor

@colinlyguo colinlyguo left a comment

Choose a reason for hiding this comment

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

Recommend adjusting the pr title to align with other prs.

@jonastheis jonastheis changed the title Submission strategy fix logs, use blocktime for submission strategy and log metrics. perf(relayer): submission strategy fix logs, use blocktime for submission strategy and log metrics. May 22, 2025
@jonastheis jonastheis merged commit ae34020 into develop May 22, 2025
15 checks passed
@jonastheis jonastheis deleted the submission-strategy-fix-logs-use-blocktime branch May 22, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump-version Bump the version tag for deployment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants