Skip to content
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

feat(permissionless batches): block production without signature #1117

Merged
merged 58 commits into from
Feb 25, 2025

Conversation

jonastheis
Copy link

@jonastheis jonastheis commented Feb 13, 2025

1. Purpose or design rationale of this PR

Replaces #1087 as it is rebased to the latest changes.

This PR enables creating blocks without a valid signature. This is necessary in permissionless mode for anyone to be able to produce blocks without having access to the latest valid key according to Clique or system contract consensus.

It is part of the permissionless batch production toolkit together with #1115 and scroll-tech/scroll#1555

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?

  • Yes

4. Breaking change label

Does this PR have the breaking-change label?

  • This PR is not a breaking change

Summary by CodeRabbit

  • New Features

    • Added a new command-line flag for data availability recovery that lets you produce unsigned blocks after L1 recovery for permissionless batch submission.
    • Enhanced node and miner configurations to adjust block production behavior, including conditional block signing and syncing workflow adjustments.
  • Chores

    • Incremented the patch version to reflect the latest release improvements.

jonastheis and others added 30 commits December 10, 2024 11:24
Copy link

coderabbitai bot commented Feb 13, 2025

Walkthrough

This pull request introduces a new flag, DARecoveryProduceBlocksFlag, to the node configuration to support unsigned block production during data availability recovery. The flag is defined in the command-line flags and read in the node initialization logic. Conditional checks in the backend and miner components adjust the behavior of the syncing pipeline and block signing processes accordingly. Additionally, the patch version was incremented in the versioning file.

Changes

File(s) Change Summary
cmd/geth/main.go, cmd/utils/flags.go Added DARecoveryProduceBlocksFlag to enable unsigned block production during L1 recovery and updated flag parsing.
eth/backend.go Modified initialization to conditionally start the syncing pipeline and adjust miner signing based on the ProduceBlocks configuration.
miner/miner.go, miner/scroll_worker.go Introduced the SigningDisabled field and updated header preparation and block commitment logic to bypass consensus engine signing when disabled.
rollup/da_syncer/syncing_pipeline.go Added ProduceBlocks field to disable the syncing pipeline in DA recovery mode.
params/version.go Incremented VersionPatch from 11 to 12.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Node
    participant EthBackend
    participant SyncPipeline
    participant Miner

    User->>Node: Start node with DARecoveryProduceBlocksFlag
    Node->>EthBackend: Initialize node with config.DA.ProduceBlocks
    alt ProduceBlocks flag NOT set
        EthBackend->>SyncPipeline: Initialize and start syncing pipeline
        SyncPipeline-->>EthBackend: Pipeline initialized
    else ProduceBlocks flag set
        EthBackend->>Miner: Configure miner with SigningDisabled = true
    end
    Miner->>Miner: Adjust header preparation & commit logic based on SigningDisabled
Loading

Possibly related PRs

Suggested labels

bump-version

Poem

I'm a little rabbit in the code,
Hopping through flags on the node road.
New switches bloom and pipelines decide,
Where signing steps back with a playful slide.
With a bump in version, we cheer and delight,
Carrots and code make everything 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 65a0d4e and 874df56.

📒 Files selected for processing (7)
  • cmd/geth/main.go (1 hunks)
  • cmd/utils/flags.go (2 hunks)
  • eth/backend.go (3 hunks)
  • miner/miner.go (1 hunks)
  • miner/scroll_worker.go (2 hunks)
  • params/version.go (1 hunks)
  • rollup/da_syncer/syncing_pipeline.go (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • params/version.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (10)
miner/miner.go (1)

64-64: Clear and concise addition of a configuration option.

The new SigningDisabled field in the Config struct provides a clear way to control block signing behavior. This addition supports the permissionless batch production functionality without disrupting existing code.

cmd/geth/main.go (1)

186-186: Appropriate addition of the new flag to nodeFlags.

Adding the DARecoveryProduceBlocksFlag to the nodeFlags slice makes it available as a command-line option. This is a clean addition that follows the existing pattern and doesn't disrupt the current functionality.

rollup/da_syncer/syncing_pipeline.go (1)

33-33: Well-documented configuration option for pipeline control.

The added ProduceBlocks field with its descriptive comment clearly explains both the purpose and the impact of this setting. It effectively communicates that enabling this option will disable the syncing pipeline when the node starts.

cmd/utils/flags.go (2)

929-932: Clear definition of the command-line flag.

The DARecoveryProduceBlocksFlag is well-defined with a descriptive name and helpful usage text that explains its purpose for permissionless batch submission.


1700-1702: Proper handling of the flag in setDA function.

The implementation correctly checks if the flag is set and assigns its value to the corresponding configuration property. This follows the pattern used for other DA-related flags in this function.

eth/backend.go (3)

232-240: Nice implementation of the conditional syncing pipeline initialization.

The changes correctly prevent the syncing pipeline from starting when producing blocks for permissionless batches, which aligns with the PR objectives.


280-281: Good configuration of miner signing based on permissionless mode.

Setting SigningDisabled based on the ProduceBlocks flag and adjusting the miner initialization condition makes sense for supporting unsigned block production.


640-642: Good defensive programming with null check.

Adding the null check for syncingPipeline prevents potential nil pointer dereferences when the syncing pipeline was not initialized.

miner/scroll_worker.go (2)

505-517: Well-structured conditional block to handle signing disabled mode.

The code correctly handles the case when signing is disabled by:

  1. Setting Difficulty to 1 to ensure new blocks are detected as canonical
  2. Clearing MixDigest, Coinbase, and Nonce fields for unsigned blocks
  3. Skipping engine preparation when signing is disabled

This implementation supports the permissionless batch production scenario effectively.


864-891: Good bypass of sealing process for unsigned blocks.

The implementation correctly:

  1. Uses the block hash directly as the seal hash when signing is disabled
  2. Skips the logging and engine sealing operations for unsigned blocks
  3. Maintains the verification steps to ensure block validity

This approach efficiently enables permissionless block production without compromising block verification.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • 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. (Beta)
  • @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.

@jonastheis jonastheis changed the title rebase #1087 to new base branch feat(permissionless batches): block production without signature Feb 13, 2025
@jonastheis jonastheis marked this pull request as ready for review February 14, 2025 00:05
jonastheis and others added 3 commits February 14, 2025 08:41
…batches-recovery-rebased

 Conflicts:
	params/version.go
	rollup/da_syncer/da/calldata_blob_source.go
	rollup/da_syncer/da/commitV7.go
colinlyguo
colinlyguo previously approved these changes Feb 14, 2025
Base automatically changed from jt/permissionless-batches-recovery-rebased to develop February 25, 2025 14:25
@Thegaram Thegaram dismissed colinlyguo’s stale review February 25, 2025 14:25

The base branch was changed.

@Thegaram Thegaram merged commit 3d3032c into develop Feb 25, 2025
9 checks passed
@Thegaram Thegaram deleted the jt/permissionless-batches-recovery-mine-rebased branch February 25, 2025 14:38
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