Skip to content

Conversation

@Thegaram
Copy link
Contributor

@Thegaram Thegaram commented Nov 25, 2025

Purpose or design rationale of this PR

Hard forks define chunk boundaries. After passing the next hard fork block height, we’d expect that rollup-relayer will immediately propose the last chunk of the previous version, but this was not the case during the Galileo testnet upgrade.

Root cause:

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?

  • 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

  • Chores

    • Version bumped to v4.7.7.
  • Bug Fixes

    • Improved hardfork/fork-boundary detection and handling so metrics are recorded and database updates occur immediately when a fork boundary is encountered.
  • Tests

    • Added and extended tests to cover fork-boundary scenarios and related timing/behavior to ensure correct early-exit handling.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 25, 2025

Walkthrough

Version bumped to v4.7.7. Chunk proposer gains hardfork-boundary detection: when blocks in a proposed chunk have differing hardfork names, the chunk is truncated at the boundary, metrics are recorded and the truncated chunk is persisted immediately via an early-return path. Tests updated to exercise the boundary case.

Changes

Cohort / File(s) Summary
Version Update
common/version/version.go
Bumped static tag from v4.7.6 to v4.7.7 (affects computed Version string only).
Hardfork Boundary Logic & Tests
rollup/internal/controller/watcher/chunk_proposer.go, rollup/internal/controller/watcher/chunk_proposer_test.go
Add hardforkBoundary detection in ProposeChunk; truncate blocks at the boundary, log, record metrics and persist truncated chunk immediately via an early-return branch. Tests: add newUint64 helper, inject GalileoTime into ChainConfig, and add a test case covering the fork-boundary scenario.

Sequence Diagram

sequenceDiagram
    participant Proposer as ProposeChunk
    participant Checker as HardforkChecker
    participant Logger as Logger
    participant Metrics as Metrics
    participant DB as Database
    participant Constraints as Constraints

    Proposer->>Checker: Inspect blocks' hardfork names
    alt Hardfork boundary detected
        Checker-->>Proposer: boundary = true
        Proposer->>Proposer: Truncate blocks at boundary
        Proposer->>Logger: Log boundary event
        Proposer->>Metrics: Record boundary metrics
        Proposer->>DB: Persist truncated chunk
        Proposer-->>Proposer: Early return
    else No boundary
        Checker-->>Proposer: boundary = false
        Proposer->>Constraints: Evaluate limits / timeout
        Proposer->>Metrics: Record final metrics
        Proposer->>DB: Persist chunk normally
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Attention points:
    • rollup/internal/controller/watcher/chunk_proposer.go: correctness of boundary detection, truncation indexing, ordering of metric recording and DB update, and impact on existing timeout/limit flows.
    • rollup/internal/controller/watcher/chunk_proposer_test.go: validity of injected GalileoTime setup and coverage for the early-return path.
    • common/version/version.go: trivial version bump.

Possibly related PRs

Suggested labels

bump-version

Suggested reviewers

  • colinlyguo
  • yiweichi
  • jonastheis

Poem

🐰 I hop through lines and sniff the trace,
When forks collide I find the place.
I trim the chunk, I log with glee,
Metrics stored and DB happy.
A tiny bump — v4.7.7, hooray for me!

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 PR title clearly and concisely describes the main feature being implemented: proposing chunks at hardfork boundaries, which directly addresses the root cause identified in the PR.
Description check ✅ Passed The PR description is comprehensive and complete, covering the purpose, root cause analysis, and following the template with conventional commits type and version/breaking-change checkboxes properly marked.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-propose-chunk-at-hardfork-boundary

📜 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 9334ed5 and a2d11dc.

📒 Files selected for processing (1)
  • rollup/internal/controller/watcher/chunk_proposer_test.go (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-10-20T16:13:20.397Z
Learnt from: colinlyguo
Repo: scroll-tech/scroll PR: 1530
File: rollup/internal/controller/watcher/batch_proposer.go:291-294
Timestamp: 2024-10-20T16:13:20.397Z
Learning: In `batch_proposer.go`, it's acceptable to call `utils.CalculateBatchMetrics` multiple times within the loop because the batch's chunks are increasing in the loop, and each calculation reflects the updated batch state.

Applied to files:

  • rollup/internal/controller/watcher/chunk_proposer_test.go
🧬 Code graph analysis (1)
rollup/internal/controller/watcher/chunk_proposer_test.go (2)
rollup/internal/controller/watcher/chunk_proposer.go (1)
  • NewChunkProposer (55-131)
rollup/internal/config/l2.go (1)
  • ChunkProposerConfig (32-37)
⏰ 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). (3)
  • GitHub Check: tests
  • GitHub Check: check
  • GitHub Check: tests
🔇 Additional comments (5)
rollup/internal/controller/watcher/chunk_proposer_test.go (5)

22-22: LGTM! Clean helper for test data.

The newUint64 helper improves readability when creating pointer values for test configuration.


31-31: Good addition for fork boundary testing.

Adding GalileoTime to the test struct enables parameterized testing of hardfork boundary behavior.


93-103: Proper chainConfig setup for hardfork testing.

The chainConfig initialization correctly provides all required fork times to the chunk proposer, with GalileoTime parameterized from test data to enable boundary-condition testing.


105-109: NewChunkProposer call correctly updated.

The call signature properly includes the chainConfig and db parameters, enabling the proposer to detect hardfork boundaries during testing.


68-75: I'll help you verify the hardcoded timestamp in the test case. Let me search for the block definitions and their timestamps.
<function_calls>


#!/bin/bash

Find block1 and block2 definitions with their Header.Time values

rg -n -B 5 -A 15 'block[12]\s*:=|block[12]\s*=\s*&' rollup/internal/controller/watcher/chunk_proposer_test.go | head -100


</function_calls>

<function_calls>


#!/bin/bash

Get line count of the test file to understand its size

wc -l rollup/internal/controller/watcher/chunk_proposer_test.go


</function_calls>

<function_calls>


#!/bin/bash

Read the test file to find block definitions and their timestamps

head -60 rollup/internal/controller/watcher/chunk_proposer_test.go | cat -n


</function_calls>


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.

@codecov-commenter
Copy link

codecov-commenter commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 36.59%. Comparing base (752e4e1) to head (a2d11dc).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1767      +/-   ##
===========================================
+ Coverage    36.54%   36.59%   +0.04%     
===========================================
  Files          247      247              
  Lines        21226    21236      +10     
===========================================
+ Hits          7757     7771      +14     
+ Misses       12639    12634       -5     
- Partials       830      831       +1     
Flag Coverage Δ
rollup 35.45% <100.00%> (+0.16%) ⬆️

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.

jonastheis
jonastheis previously approved these changes Nov 26, 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: 0

🧹 Nitpick comments (1)
rollup/internal/controller/watcher/chunk_proposer_test.go (1)

96-96: Consider extracting ChainConfig initialization for readability.

The ChainConfig initialization is functionally correct, but the line exceeds 250 characters. For improved maintainability, consider extracting it to a separate variable or helper function.

Example refactor:

-		cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{
-			MaxL2GasPerChunk:              tt.maxL2Gas,
-			ChunkTimeoutSec:               tt.chunkTimeoutSec,
-			MaxUncompressedBatchBytesSize: math.MaxUint64,
-		}, encoding.CodecV7, &params.ChainConfig{LondonBlock: big.NewInt(0), BernoulliBlock: big.NewInt(0), CurieBlock: big.NewInt(0), DarwinTime: new(uint64), DarwinV2Time: new(uint64), EuclidTime: new(uint64), EuclidV2Time: new(uint64), FeynmanTime: new(uint64), GalileoTime: tt.GalileoTime}, db, nil)
+		chainConfig := &params.ChainConfig{
+			LondonBlock:    big.NewInt(0),
+			BernoulliBlock: big.NewInt(0),
+			CurieBlock:     big.NewInt(0),
+			DarwinTime:     new(uint64),
+			DarwinV2Time:   new(uint64),
+			EuclidTime:     new(uint64),
+			EuclidV2Time:   new(uint64),
+			FeynmanTime:    new(uint64),
+			GalileoTime:    tt.GalileoTime,
+		}
+		cp := NewChunkProposer(context.Background(), &config.ChunkProposerConfig{
+			MaxL2GasPerChunk:              tt.maxL2Gas,
+			ChunkTimeoutSec:               tt.chunkTimeoutSec,
+			MaxUncompressedBatchBytesSize: math.MaxUint64,
+		}, encoding.CodecV7, chainConfig, db, nil)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7c29ff4 and 9334ed5.

📒 Files selected for processing (2)
  • common/version/version.go (1 hunks)
  • rollup/internal/controller/watcher/chunk_proposer_test.go (3 hunks)
⏰ 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). (3)
  • GitHub Check: check
  • GitHub Check: tests
  • GitHub Check: tests
🔇 Additional comments (4)
common/version/version.go (1)

8-8: LGTM: Version bump aligns with the new feature.

The version increment from v4.7.6 to v4.7.7 is appropriate for the hardfork boundary handling feature introduced in this PR.

rollup/internal/controller/watcher/chunk_proposer_test.go (3)

22-22: LGTM: Idiomatic helper for test setup.

The newUint64 helper follows standard Go patterns for creating pointers to uint64 literals, making test case initialization cleaner.


31-31: LGTM: Test configuration extended appropriately.

Adding the optional GalileoTime field enables fork boundary test scenarios while maintaining backward compatibility with existing test cases.


68-75: I'll help you verify the block2 timestamp claim. Let me search for the block2 fixture definition in the test file.
<function_calls>


#!/bin/bash

Search for block2 definition and its timestamp in the test file

rg -n -A20 'block2' rollup/internal/controller/watcher/chunk_proposer_test.go | head -60


</function_calls>

Let me also search more broadly to understand the test structure:
<function_calls>


#!/bin/bash

Get the overall structure of the test file to understand where fixtures are defined

wc -l rollup/internal/controller/watcher/chunk_proposer_test.go


</function_calls>

<function_calls>


#!/bin/bash

Search for block fixture definitions at the beginning or in setup functions

rg -n 'var.block|:= &types.Block|Timestamp.=' rollup/internal/controller/watcher/chunk_proposer_test.go | head -40


</function_calls>

@Thegaram Thegaram merged commit e75d6c1 into develop Nov 28, 2025
8 of 9 checks passed
@Thegaram Thegaram deleted the feat-propose-chunk-at-hardfork-boundary branch November 28, 2025 16:21
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