Skip to content

feat(worker): disable l1 message skipping #1205

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 1 commit into
base: develop
Choose a base branch
from

Conversation

Thegaram
Copy link

@Thegaram Thegaram commented Jun 11, 2025

1. Purpose or design rationale of this PR

CCC is disabled, so it won't lead to skipping.

There are other error conditions that might lead to skipping L1 messages. To the best of our knowledge, these are all impossible. But if we do encounter such an error, we should avoid corrupting the chain by skipping an L1 message.

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:

  • feat: A new feature

3. Deployment tag versioning

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

  • This PR doesn't involve a new deployment, git tag, docker image tag, and it doesn't affect traces
  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change
  • Yes

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling for L1 message transactions to prevent automatic skipping of failing transactions. Now, processing stops and an error is logged if a failure occurs, ensuring better reliability and transparency during block building.

@Thegaram Thegaram requested review from georgehao and colinlyguo June 11, 2025 15:55
Copy link

coderabbitai bot commented Jun 11, 2025

Walkthrough

The error handling for L1 message transactions in the worker has been updated. Now, when an error occurs during processing, the system logs the error and stops including further L1 messages, rather than skipping or advancing past the problematic transaction. Automatic skipping of failing L1 messages has been disabled.

Changes

File(s) Change Summary
miner/scroll_worker.go Modified error handling for L1 message transactions: errors now halt further L1 inclusion and are logged; skipping logic in onTxFailing is disabled.

Suggested labels

bump-version

Suggested reviewers

  • jonastheis
  • colinlyguo

Poem

A hiccup in the message queue,
No longer do we simply skip through.
Now we log, we halt, we pause,
Giving errors their due cause.
The rabbit nods, "No more leap!"
For careful code is what we keep. 🐇

✨ 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: 0

🧹 Nitpick comments (1)
miner/scroll_worker.go (1)

1066-1069: Remove now-dead skip-path for L1 messages

The comment correctly states that skipping is disabled, but the surrounding
else-if ladder still contains the empty branch, which is easy to misread as an
oversight. Dropping the branch (or gating it behind a // deprecated build tag)
tightens the control-flow and avoids future re-introductions.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cf3d22e and 1fa12c3.

📒 Files selected for processing (1)
  • miner/scroll_worker.go (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: test
  • GitHub Check: check
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
miner/scroll_worker.go (1)

798-803: Silent drop of failing L1 message can stall the L1 queue indefinitely

When processTxn returns an error for an L1MessageTx, the code now logs and immediately
returns (false, nil), leaving:

  1. w.current.nextL1MsgIndex unchanged – the same failing message will be fetched again next
    block and hit the exact same error.
  2. The offending tx still in txs (no Pop/Shift), so any subsequent L1-messages in the same
    slice are never examined this block.

This achieves the “do not skip” objective, but also means a single permanently-failing message
(e.g. malformed calldata) can block the entire L1 queue forever, effectively halting L1 → L2
ingestion.

Please double-check that every error reaching this point is transient (e.g. state-dependent
gas overflow) and that you have operational alerts/metrics to detect prolonged stagnation of
nextL1MsgIndex.
If some errors are unrecoverable, consider:

+// after N consecutive failures we can escalate / circuit-break
+if l1FailureCounter > maxRetries {
+    return false, fmt.Errorf("L1 message %d keeps failing: %w", tx.AsL1MessageTx().QueueIndex, err)
+}

or persisting the failure in DB with rawdb.WriteSkippedTransaction but without advancing the
index, so that manual intervention is still possible.

w.current.nextL1MsgIndex = queueIndex + 1
l1SkippedCounter.Inc(1)
// previously we would skip this transaction here,
// but now skipping is disabled.
Copy link
Member

Choose a reason for hiding this comment

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

Could add an error log such as "Unexpected case..." and print basic info of this L1 message.

Copy link
Author

@Thegaram Thegaram Jun 11, 2025

Choose a reason for hiding this comment

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

The other error log added in this PR will be printed after the call to this function. Or maybe I can move that error here.

@@ -796,7 +796,10 @@ func (w *worker) processTxns(txs types.OrderedTransactionSet) (bool, error) {
}

if tx.IsL1MessageTx() {
txs.Shift()
Copy link
Member

@georgehao georgehao Jun 11, 2025

Choose a reason for hiding this comment

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

if remove this, will ErrUnexpectedL1MessageIndex stop the L1 message to insert ?

Copy link
Member

Choose a reason for hiding this comment

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

I think tx.Shift() shouldn't be removed.

Copy link
Author

Choose a reason for hiding this comment

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

Calling Shift in case of an error means that we skipped the transaction and continue with the next one, which we should not do.

Instead, we'll be stuck at the erroring transaction, and we must fix that error before we continue processing L1 messages.

Copy link
Member

Choose a reason for hiding this comment

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

understand. But I'm curious why it can be skipped to next before, but now we need to fix it immediately

Copy link
Author

Choose a reason for hiding this comment

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

Now that we disalbed ccc, this (skipping) should never happen. But if it does, it's better if we still produce a valid chain, i.e. stop processing L1 messages instead of skipping them.

Copy link
Member

Choose a reason for hiding this comment

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

if tx.IsL1MessageTx() && tx.AsL1MessageTx().QueueIndex != w.current.nextL1MsgIndex {
// Continue, we might still be able to include some L2 messages
return false, ErrUnexpectedL1MessageIndex
}

I think this error doesn't related to CCC

@Thegaram Thegaram requested a review from Copilot June 14, 2025 19:23
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR disables automatic skipping of L1 message transactions during block building to prevent chain corruption if unexpected errors occur.

  • Removed the txs.Shift() skip in processTxns and replaced it with an error log and early block finalization.
  • Stripped out the skipping logic in onTxFailing for L1 messages, leaving a placeholder comment.
Comments suppressed due to low confidence (2)

miner/scroll_worker.go:802

  • Consider adding a unit or integration test to verify that when an L1 message transaction fails, processTxns returns (false, nil) and halts further L1 processing without skipping.
return false, nil

miner/scroll_worker.go:799

  • The variable err is not defined in this scope, which will cause a compilation error. You should use the error returned by the L1 message processing call or capture it into a variable before logging.
log.Error("Encountered error while processing L1MessageTx", "err", err, "blockNumber", w.current.header.Number, "queueIndex", tx.AsL1MessageTx().QueueIndex)

w.current.nextL1MsgIndex = queueIndex + 1
l1SkippedCounter.Inc(1)
// previously we would skip this transaction here,
// but now skipping is disabled.
Copy link
Preview

Copilot AI Jun 14, 2025

Choose a reason for hiding this comment

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

[nitpick] With skipping disabled, it would be helpful to log the failure of an L1 message here so that developers can trace why the block building halted.

Suggested change
// but now skipping is disabled.
// but now skipping is disabled.
log.Warn("L1 message transaction failed without skipping", "tx", tx.Hash().String(), "error", err.Error())

Copilot uses AI. Check for mistakes.

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.

3 participants