Skip to content

feat(rollup-relayer): support codecv8 #1681

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

colinlyguo
Copy link
Member

@colinlyguo colinlyguo commented Jun 16, 2025

Purpose or design rationale of this PR

Enable rollup-relayer to support codecv8 and update bridge-history's da-codec commit for batch hash validation compatibility.

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:

  • feat: A new feature

Deployment tag versioning

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

  • Yes

Breaking change label

Does this PR have the breaking-change label?

  • No, this PR is not a breaking change

Summary by CodeRabbit

  • New Features

    • Added support for codec version 8 in batch processing and relayer operations.
    • Introduced a new "feynmanTime" field in the proposer tool genesis configuration.
  • Improvements

    • Unified handling of codec versions 7 and 8 in relayer batch commit and finalize operations.
  • Chores

    • Updated several dependencies to their latest versions.
    • Bumped the application version to v4.5.24.

Copy link

coderabbitai bot commented Jun 16, 2025

Walkthrough

This change updates dependency versions for several modules, increments the main version tag, adds support for codec version 8 in batch processing logic, and introduces a new configuration field in the proposer tool genesis JSON. Method signatures and logic in the relayer are adjusted to handle codec version 8 alongside version 7.

Changes

File(s) Change Summary
bridge-history-api/go.mod
coordinator/go.mod
rollup/go.mod
Updated github.com/scroll-tech/da-codec and github.com/scroll-tech/go-ethereum dependency versions.
common/version/version.go Bumped version tag from "v4.5.23" to "v4.5.24".
coordinator/internal/logic/provertask/batch_prover_task.go Added support for codec version 8 in batch task detail processing.
rollup/internal/controller/relayer/l2_relayer.go Extended batch commit/finalize logic to handle codec V8 like V7; updated context ID and batch hash extraction logic.
rollup/proposer-tool-genesis.json Added new "feynmanTime" field to the config object.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Layer2Relayer
    participant DB

    User->>Layer2Relayer: ProcessPendingBatches()
    Layer2Relayer->>Layer2Relayer: Determine codec version (V7 or V8)
    alt Codec V7 or V8
        Layer2Relayer->>Layer2Relayer: constructCommitBatchPayloadCodecV7()
        Layer2Relayer->>Layer2Relayer: contextIDFromBatches(codecVersion, batches)
    else Other versions
        Layer2Relayer->>Layer2Relayer: Handle accordingly
    end
    Layer2Relayer->>DB: SendTransaction(contextID)
    DB-->>Layer2Relayer: Transaction result
Loading

Possibly related PRs

Suggested labels

bump-version

Suggested reviewers

  • georgehao
  • zimpha

Poem

A hop, a skip, a version jump,
New codecs land with quite a thump!
Genesis gains a "feynman" twist,
Relayers now know V8 exists.
With every merge, the code grows bright—
Rabbits cheer for changes right!
🐇✨


📜 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 8f44dc9 and d274123.

📒 Files selected for processing (1)
  • rollup/internal/controller/relayer/l2_relayer.go (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • rollup/internal/controller/relayer/l2_relayer.go
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: tests
  • 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.

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: 2

🔭 Outside diff range comments (1)
rollup/internal/controller/relayer/l2_relayer.go (1)

469-475: Method name & log message now misleading for V8 support

The switch correctly re-uses constructCommitBatchPayloadCodecV7 for both V7 and V8, but

  1. the helper’s name still ends in “CodecV7”;
  2. the error log hard-codes “…payload for V7”.

This will confuse future maintainers when troubleshooting V8 flows. Rename the helper (e.g. constructCommitBatchPayloadCodecV7V8) or introduce a thin wrapper for V8, and update the log message to reflect the actual codecVersion.

🧹 Nitpick comments (1)
rollup/proposer-tool-config.json (1)

4-8: Validate increased chunk proposer limits
Raising max_block_num_per_chunk to 1000 and max_l2_gas_per_chunk to 200000000000 can stress memory, database, and network layers. Confirm that the infrastructure and upstream components can handle these new limits without performance regressions.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5d6b5a8 and 30153c1.

⛔ Files ignored due to path filters (4)
  • bridge-history-api/go.sum is excluded by !**/*.sum
  • coordinator/go.sum is excluded by !**/*.sum
  • go.work.sum is excluded by !**/*.sum
  • rollup/go.sum is excluded by !**/*.sum
📒 Files selected for processing (11)
  • bridge-history-api/go.mod (1 hunks)
  • common/version/version.go (1 hunks)
  • coordinator/go.mod (1 hunks)
  • coordinator/internal/logic/provertask/batch_prover_task.go (1 hunks)
  • coordinator/internal/types/prover.go (1 hunks)
  • rollup/docker-compose-proposer-tool.yml (1 hunks)
  • rollup/go.mod (1 hunks)
  • rollup/internal/controller/relayer/l2_relayer.go (4 hunks)
  • rollup/internal/controller/watcher/proposer_tool.go (1 hunks)
  • rollup/proposer-tool-config.json (1 hunks)
  • rollup/proposer-tool-genesis.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
rollup/internal/controller/relayer/l2_relayer.go (1)
rollup/internal/orm/batch.go (2)
  • Batch (22-72)
  • Batch (80-82)
🔇 Additional comments (10)
common/version/version.go (1)

8-8: Version tag bumped correctly.

The patch version was incremented to v4.5.22 in line with the updated da-codec and go-ethereum dependencies across modules.

rollup/internal/controller/watcher/proposer_tool.go (1)

1-162: No logic changes detected.

This PR only reorders the import of scroll-tech/database/migrate; functionality remains unchanged.

rollup/go.mod (1)

14-15: Ensure consistency of dependency versions across modules.

Please verify that the updated da-codec and go-ethereum commit hashes here match exactly in coordinator/go.mod and bridge-history-api/go.mod to avoid build mismatches.

Run:

#!/bin/bash
rg "github.com/scroll-tech/da-codec v0.1.3-0.20250616065246-17bf3e4990cd" -l
rg "github.com/scroll-tech/go-ethereum v1.10.14-0.20250611141528-cf3d22ef8707" -l
coordinator/go.mod (1)

12-13: Align dependency versions with other modules.

The da-codec and go-ethereum versions were bumped here; confirm they are identical to those in rollup/go.mod and bridge-history-api/go.mod to maintain cross-module compatibility.

bridge-history-api/go.mod (2)

13-14: Verify updated require directives.

The da-codec and go-ethereum versions have been upgraded; ensure these commits align with those in the rollup and coordinator modules.


21-21: Confirm hotfix coverage in replace directive.

The replace directive for go-ethereum points to commit 20250616074821-cba908db071d with a note about a header hash hotfix. Please verify that this commit indeed contains the intended fix.

coordinator/internal/types/prover.go (1)

3-7: No functional changes detected
The blank line added between the "fmt" and "scroll-tech/common/types/message" imports is purely stylistic and does not affect behavior.

rollup/docker-compose-proposer-tool.yml (1)

30-32: Verify updated --start-l2-block value
Ensure that the new block number "14907015" correctly aligns with the intended activation point for CODEC V8 support and that no downstream tooling assumes the old start height.

rollup/proposer-tool-genesis.json (1)

8-11: Ensure feynmanTime field is utilized
The new "feynmanTime": 0 field has been added to the genesis config. Verify that the proposer‐tool code actually reads and applies this parameter, otherwise it may be silently ignored.

coordinator/internal/logic/provertask/batch_prover_task.go (1)

267-272: Extend batch codec support to V8
Incorporating encoding.CodecV8 alongside existing versions is correct. Please ensure you have added or updated unit/integration tests to cover the new V8 decoding path and validate backward compatibility.

@colinlyguo colinlyguo force-pushed the feat-rollup-relayer-support-codecv8 branch from 30153c1 to 377e8bb Compare June 16, 2025 10:26
@codecov-commenter
Copy link

codecov-commenter commented Jun 16, 2025

Codecov Report

Attention: Patch coverage is 62.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 40.07%. Comparing base (b0943b1) to head (d274123).

Files with missing lines Patch % Lines
rollup/internal/controller/relayer/l2_relayer.go 71.42% 1 Missing and 1 partial ⚠️
...tor/internal/logic/provertask/batch_prover_task.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1681      +/-   ##
===========================================
- Coverage    40.16%   40.07%   -0.10%     
===========================================
  Files          232      232              
  Lines        18447    18440       -7     
===========================================
- Hits          7409     7389      -20     
- Misses       10315    10331      +16     
+ Partials       723      720       -3     
Flag Coverage Δ
bridge-history-api 8.14% <ø> (ø)
coordinator 34.15% <0.00%> (-0.40%) ⬇️

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.

georgehao
georgehao previously approved these changes Jun 18, 2025
github.com/stretchr/testify v1.9.0
github.com/urfave/cli/v2 v2.25.7
golang.org/x/sync v0.11.0
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde
)

replace github.com/scroll-tech/go-ethereum => github.com/scroll-tech/go-ethereum v1.10.14-0.20250305084331-57148478e950 // It's a hotfix for the header hash incompatibility issue, pls change this with caution
Copy link
Contributor

Choose a reason for hiding this comment

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

is this version update intended?

Copy link
Member Author

@colinlyguo colinlyguo Jun 18, 2025

Choose a reason for hiding this comment

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

Yes. It's based on this pr: scroll-tech/go-ethereum#1133 (the latest commit is merging develop branch) because it's nice to include recent fixes like scroll-tech/go-ethereum#1191 and scroll-tech/go-ethereum#1195, especially scroll-tech/go-ethereum#1191.

@@ -2,8 +2,8 @@
"l2_config": {
"endpoint": "https://rpc.scroll.io",
"chunk_proposer_config": {
"max_block_num_per_chunk": 100,
"max_l2_gas_per_chunk": 20000000,
"max_block_num_per_chunk": 1000,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why these updates to the config?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is changed to test the previous experimental dynamic encoding of codecv8, to remove other limits, so setting large values in them.

Copy link
Member Author

Choose a reason for hiding this comment

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

Reverted in commit d274123.

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 (1)
rollup/internal/controller/relayer/l2_relayer.go (1)

468-476: Minor log message mismatch after Codec V8 support
The error log inside the new switch block is hard-coded to “for V7”, which is misleading when codecVersion is V8.

-            log.Error("failed to construct constructCommitBatchPayloadCodecV7 payload for V7", "codecVersion", codecVersion, ...
+            log.Error("failed to construct commitBatch payload", "codecVersion", codecVersion, ...

Purely cosmetic, but worth adjusting to avoid confusion when debugging.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 60a2280 and 8f44dc9.

📒 Files selected for processing (1)
  • rollup/internal/controller/relayer/l2_relayer.go (4 hunks)
🧰 Additional context used
🪛 golangci-lint (1.64.8)
rollup/internal/controller/relayer/l2_relayer.go

525-525: undefined: dbBatchWithChunksAndParent

(typecheck)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: check
  • GitHub Check: tests
  • GitHub Check: test
  • GitHub Check: check
  • GitHub Check: tests
🔇 Additional comments (1)
rollup/internal/controller/relayer/l2_relayer.go (1)

534-537: Future-proof parsing LGTM
The generalized batchHashesFromContextID correctly handles any v<N>-… prefix and gracefully falls back. Nice improvement over the old fixed-version check.

@colinlyguo colinlyguo force-pushed the feat-rollup-relayer-support-codecv8 branch from e5a75c7 to d274123 Compare June 18, 2025 15:22
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.

4 participants