Skip to content

fix(verifier,l1follower): update da-codec to latest version #1143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 13, 2025

Conversation

jonastheis
Copy link

@jonastheis jonastheis commented Mar 13, 2025

1. Purpose or design rationale of this PR

A recent da-codec change was not adopted in l2geth which lead to nodes halting with an error message like this:

ERROR[03-13|13:47:18.231|rollup/rollup_sync_service/rollup_sync_service.go:568]   Batch hash mismatch                      batch index=85915 start block=8,484,738 end block=8,484,738 parent batch hash=0x6fcd38355bb2e0ae33bdb2af733c75843f5806db2e3d2b18c5b9109884530ed9 parent TotalL1MessagePopped=1,062,112 l1 finalized batch hash=0x4e2d2be908e693058dd3c82b88ac275233673a361610eb2c27d74d0191569e7a l2 batch hash=0x0b671dc4155c589ffa13dd481271c7b944a778f5ce23d5100546e2b45da61ba6

As a workaround, we bump the codec version and add logic to allow nodes to automatically recover by re-syncing recent batches from L1.

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:

  • fix: A bug fix

3. Deployment tag versioning

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

  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change

Summary by CodeRabbit

  • Chores
    • Upgraded a core dependency to a newer build, enhancing overall stability and performance improvements.
  • New Features
    • Introduced a new error handling mechanism that allows for a reset of the sync height under specific conditions, improving the robustness of rollup event processing.
  • Bug Fixes
    • Implemented a hotfix to address L1 message hash mismatches, ensuring correct batch hash calculations.
  • Documentation
    • Updated the versioning system to reflect the increment of the patch version from 24 to 25.

Copy link

coderabbitai bot commented Mar 13, 2025

Walkthrough

The pull request updates the go.mod file by shifting the dependency version of github.com/scroll-tech/da-codec to a newer commit. Additionally, the VersionPatch constant in params/version.go is incremented from 24 to 25, and a new error variable, ErrShouldResetSyncHeight, is introduced in the rollup_sync_service.go file to enhance error handling during rollup event processing.

Changes

File Change Summary
go.mod Updated github.com/scroll-tech/da-codec dependency version from v0.1.3-0.20250226072559-f8a8d3898f54 to v0.1.3-0.20250313120912-344f2d5e33e1
params/version.go Updated VersionPatch constant from 24 to 25
rollup/rollup_sync_service/rollup_sync_service.go Added error variable ErrShouldResetSyncHeight and modified fetchRollupEvents and validateBatch methods for error handling

Possibly related PRs

Suggested reviewers

  • Thegaram
  • colinlyguo

Poem

Oh, I hop through the code so bright,
Updating versions with all my might,
A dependency shifted in time and space,
A new commit in its cozy place,
Hop along, dear coder, at a bouncy pace!
🐇✨

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 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 1b45967 and 47da2fd.

📒 Files selected for processing (1)
  • rollup/rollup_sync_service/rollup_sync_service.go (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • rollup/rollup_sync_service/rollup_sync_service.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

Thegaram
Thegaram previously approved these changes Mar 13, 2025
@Thegaram Thegaram requested a review from colinlyguo March 13, 2025 14:09
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

🧹 Nitpick comments (3)
rollup/rollup_sync_service/rollup_sync_service.go (3)

46-46: Add a comment for the exported error variable

This newly defined error variable is exported and should have a comment explaining its purpose according to Go's conventions.

-var ErrShouldResetSyncHeight = errors.New("ErrShouldResetSyncHeight")
+// ErrShouldResetSyncHeight is returned when the sync height needs to be reset
+// due to L1 message hash calculation issues after upgrading to EuclidV2
+var ErrShouldResetSyncHeight = errors.New("ErrShouldResetSyncHeight")

211-216: Document the significance of block number 7892668

The code resets to a hardcoded block number, but there's no explanation of why this specific block was chosen. Adding a comment would improve maintainability.

 if errors.Is(err, ErrShouldResetSyncHeight) {
-    log.Warn("Resetting sync height to L1 block 7892668 to fix L1 message queue hash calculation")
+    // Block 7892668 is one block before the L1 block where the last batch in CodecV6 was committed
+    log.Warn("Resetting sync height to L1 block 7892668 to fix L1 message queue hash calculation")
     s.callDataBlobSource.SetL1Height(7892668)

     return nil
 }

212-213: Consider making the reset block height configurable

Hardcoding the reset block height in the code makes it difficult to adjust if needed for different environments or networks.

Consider making this value configurable through a constant or configuration parameter:

+// BlockHeightBeforeLastCodecV6 is the L1 block height one block before the last batch in CodecV6 was committed
+const BlockHeightBeforeLastCodecV6 = 7892668
+
 if errors.Is(err, ErrShouldResetSyncHeight) {
-    log.Warn("Resetting sync height to L1 block 7892668 to fix L1 message queue hash calculation")
-    s.callDataBlobSource.SetL1Height(7892668)
+    log.Warn("Resetting sync height to L1 block %d to fix L1 message queue hash calculation", BlockHeightBeforeLastCodecV6)
+    s.callDataBlobSource.SetL1Height(BlockHeightBeforeLastCodecV6)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5fe1ed2 and 1b45967.

📒 Files selected for processing (1)
  • rollup/rollup_sync_service/rollup_sync_service.go (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build-and-push
  • GitHub Check: test
🔇 Additional comments (1)
rollup/rollup_sync_service/rollup_sync_service.go (1)

9-9: LGTM! Added import for string operations

The import of "strings" package is necessary for the string comparison operation added in the error handling logic.

@Thegaram Thegaram merged commit aec0089 into develop Mar 13, 2025
9 checks passed
@Thegaram Thegaram deleted the fix/l1-message-hash-bug branch March 13, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants