Skip to content

feat(rollup): shadow-fork testing switches, estimateGas cap, stranded-bundle logging#1814

Open
lispc wants to merge 3 commits into
developfrom
feat/rollup-shadow-fork-switches
Open

feat(rollup): shadow-fork testing switches, estimateGas cap, stranded-bundle logging#1814
lispc wants to merge 3 commits into
developfrom
feat/rollup-shadow-fork-switches

Conversation

@lispc

@lispc lispc commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Split out from #1803 (second of two PRs, independent of #1813). All switches default off; production behavior is unchanged except where noted.

1. Shadow-fork testing switches (feat)

Opt-in config switches needed when running the relayer against a shadow fork with a DB imported from production:

  • l2_config.disable_l2_watcher: skip the missing-blocks fetch loop (an imported/empty l2_block table would otherwise trigger a genesis crawl).
  • disable on chunk/batch/bundle proposer configs: turn off proposal loops independently.
  • bundle_propose_cooldown_sec: wall-clock cooldown between bundle proposals — on a shadow fork L2 block timestamps are historical, so the normal bundle timeout would fire immediately.
  • sender.chain_nonce_only: initialize the sender nonce from the chain pending nonce only, ignoring stale pending_transaction rows in an imported DB.

2. eth_estimateGas explicit gas cap (fix)

Some nodes (e.g. Anvil) reject estimation requests that carry fee caps but leave Gas at the go-ethereum default of 0. CallMsg.Gas is now set to 30M. ⚠️ This touches the production path (all commit/finalize/blob estimations): go-ethereum's EstimateGas only uses CallMsg.Gas as the upper bound of its binary search (and still caps it by balance), so a generous cap should not change results — worth one reviewer's confirmation.

3. Relayer logging (chore)

  • Commit/finalize failure logs dumped full calldata at Error level on every retry tick; calldata moved to a Debug log.
  • When a finalize tx confirms as failed, the bundle is marked RollupFinalizeFailed(7), which ProcessPendingBundles never picks up again (GetFirstPendingBundle only queries RollupPending). A loud Error log now records the bundle index and that manual intervention (reset rollup_status to 1) is required.
  • Dropped the stale "only used in unit tests" comment on GetBundles, now used by the relayer.

Test plan

  • go build ./..., go vet, gofmt/goimports, go mod tidy clean
  • make mock_abi && make lint (golangci-lint v1.57.2) passes
  • go test passes for internal/config, internal/controller/sender, internal/controller/relayer, internal/controller/watcher (testcontainers)

Summary by CodeRabbit

  • New Features

    • Added configuration options to disable L2 watching, chunk proposing, batch proposing, and bundle proposing.
    • Added a configurable cooldown between successful bundle proposals.
    • Added an option to initialize transaction nonces from the chain’s pending nonce only.
  • Bug Fixes

    • Improved gas estimation compatibility across different node configurations.
    • Improved handling and diagnostics for failed bundle finalization and stranded bundles.
  • Logging

    • Reduced error-log noise while retaining detailed transaction data in debug logs.

lispc added 3 commits July 16, 2026 22:48
Add opt-in config switches (all default off, production behavior
unchanged) needed when running the relayer against a shadow fork with a
DB imported from production:

- l2_config.disable_l2_watcher: skip the missing-blocks fetch loop; an
  imported/empty l2_block table would otherwise trigger a genesis crawl.
- chunk/batch/bundle proposer 'disable': turn off proposal loops
  independently.
- bundle_propose_cooldown_sec: wall-clock cooldown between bundle
  proposals; on a shadow fork the L2 block timestamps are historical so
  the normal bundle timeout would fire immediately.
- sender chain_nonce_only: initialize the sender nonce from the chain
  pending nonce only, ignoring stale pending_transaction rows in an
  imported DB.
Some nodes (e.g. Anvil) reject estimation requests that carry fee caps
but leave Gas at the go-ethereum default of 0. go-ethereum's EstimateGas
only uses CallMsg.Gas as the upper bound of its binary search, so a
generous 30M cap does not change the estimation result.
… bundle

- Commit/finalize failure logs dumped full calldata at Error level on
  every retry tick; move the calldata to a Debug log.
- When a finalize tx confirms as failed, the bundle is marked
  RollupFinalizeFailed(7), which ProcessPendingBundles never picks up
  again (GetFirstPendingBundle only queries RollupPending). Emit a loud
  Error log with the bundle index making the required manual
  intervention (reset rollup_status to 1) explicit.
- Drop the stale 'only used in unit tests' comment on GetBundles, now
  used by the relayer.
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 57ff2a55-039c-42f3-bdb9-5fe6b4423e04

📥 Commits

Reviewing files that changed from the base of the PR and between 788fdf0 and ecf0858.

📒 Files selected for processing (10)
  • rollup/cmd/rollup_relayer/app/app.go
  • rollup/internal/config/l2.go
  • rollup/internal/config/relayer.go
  • rollup/internal/controller/relayer/l2_relayer.go
  • rollup/internal/controller/sender/estimategas.go
  • rollup/internal/controller/sender/sender.go
  • rollup/internal/controller/watcher/batch_proposer.go
  • rollup/internal/controller/watcher/bundle_proposer.go
  • rollup/internal/controller/watcher/chunk_proposer.go
  • rollup/internal/orm/bundle.go
💤 Files with no reviewable changes (1)
  • rollup/internal/orm/bundle.go

📝 Walkthrough

Walkthrough

The relayer gains configuration switches for watcher and proposer execution, bundle proposal cooldown tracking, chain-only nonce initialization, explicit gas estimation limits, and revised transaction failure diagnostics.

Changes

Relayer controls and transaction handling

Layer / File(s) Summary
Watcher controls and proposer timing
rollup/internal/config/l2.go, rollup/cmd/rollup_relayer/app/app.go, rollup/internal/controller/watcher/*
L2 watcher execution and chunk, batch, and bundle proposing can be disabled; bundle proposals also observe a wall-clock cooldown.
Sender nonce and gas estimation
rollup/internal/config/relayer.go, rollup/internal/controller/sender/sender.go, rollup/internal/controller/sender/estimategas.go
Sender nonce initialization can use only the chain pending nonce, and gas estimation supplies an explicit non-zero gas cap.
Submission diagnostics and finalize failure handling
rollup/internal/controller/relayer/l2_relayer.go, rollup/internal/orm/bundle.go
Calldata is logged at debug level, and failed bundle finalizations report stranded bundle details after a bundle lookup. The bundle query comment documents ascending index ordering.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: thegaram, georgehao, jonastheis

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is conventional-commit formatted and accurately summarizes the main changes: shadow-fork switches, estimateGas cap, and logging updates.
Description check ✅ Passed The description covers purpose, implementation, and test plan, with only non-critical template items like deployment tag and breaking-change labels omitted.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rollup-shadow-fork-switches

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.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 37.70492% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.44%. Comparing base (788fdf0) to head (ecf0858).

Files with missing lines Patch % Lines
rollup/cmd/rollup_relayer/app/app.go 0.00% 10 Missing ⚠️
...lup/internal/controller/watcher/bundle_proposer.go 57.89% 6 Missing and 2 partials ⚠️
rollup/internal/controller/relayer/l2_relayer.go 58.82% 7 Missing ⚠️
rollup/internal/controller/sender/sender.go 12.50% 5 Missing and 2 partials ⚠️
...llup/internal/controller/watcher/batch_proposer.go 0.00% 2 Missing and 1 partial ⚠️
...llup/internal/controller/watcher/chunk_proposer.go 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1814      +/-   ##
===========================================
- Coverage    35.44%   35.44%   -0.01%     
===========================================
  Files          262      262              
  Lines        22596    22636      +40     
===========================================
+ Hits          8010     8023      +13     
- Misses       13748    13770      +22     
- Partials       838      843       +5     
Flag Coverage Δ
rollup 35.17% <37.70%> (-0.02%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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.

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.

2 participants