Skip to content

Conversation

@MegaRedHand
Copy link
Collaborator

@MegaRedHand MegaRedHand commented Oct 21, 2025

Motivation

When spinning up localnets made up only of ethrex nodes, we can't use gas limits apart from the default one of 30M. We want to be able to set it through a CLI flag in those cases.

Description

This PR adds a flag for setting the gas limit: --builder.gas-limit. It also renames the flag --block-producer.extra-data to --builder.extra-data.

Closes #4482

@Copilot Copilot AI review requested due to automatic review settings October 21, 2025 14:20
@MegaRedHand MegaRedHand requested a review from a team as a code owner October 21, 2025 14:20
@github-actions github-actions bot added the L1 Ethereum client label Oct 21, 2025
Copy link
Contributor

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 adds CLI support for configuring the target gas limit in block production, addressing the limitation where localnets with only ethrex nodes were restricted to the default 30M gas limit.

  • Adds a new --block-producer.gas-limit CLI flag to allow custom gas limit configuration
  • Refactors init_rpc_api to accept gas limit and extra data from the main options object instead of as separate parameters
  • Updates lint annotation from allow to expect for the too_many_arguments clippy warning

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cmd/ethrex/cli.rs Adds new gas_limit CLI option field with appropriate flag configuration and default value
cmd/ethrex/initializers.rs Refactors function signature to use options object for gas limit and extra data, removes hardcoded None value

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

github-actions bot commented Oct 21, 2025

Lines of code report

Total lines added: 9
Total lines removed: 5
Total lines changed: 14

Detailed view
+-------------------------------------+-------+------+
| File                                | Lines | Diff |
+-------------------------------------+-------+------+
| ethrex/cmd/ethrex/cli.rs            | 579   | +9   |
+-------------------------------------+-------+------+
| ethrex/cmd/ethrex/initializers.rs   | 462   | -4   |
+-------------------------------------+-------+------+
| ethrex/crates/networking/rpc/rpc.rs | 811   | -1   |
+-------------------------------------+-------+------+

pub extra_data: String,
#[arg(
long = "block-producer.gas-limit",
default_value_t = DEFAULT_BUILDER_GAS_CEIL,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand this? Isn't the default gas ceil different depending on the fork? I understand if you want to overwrite it but, isnt the default different for each fork?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No. The default gas limit is set by each client independently of the network. For example, geth currently has a default of 60M:

https://github.com/ethereum/go-ethereum/blob/6608a2aafd3603afe59f95fa7b2a8ec00b8eaa19/miner/miner.go#L54-L55

I think we should bump this default to 60M, but I didn't change that in this PR since it's important enough to merit its own PR and discussion.

@github-project-automation github-project-automation bot moved this to In Review in ethrex_l1 Oct 22, 2025
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
Copy link
Contributor

Choose a reason for hiding this comment

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

:agite:

@ilitteri ilitteri added this pull request to the merge queue Oct 22, 2025
@MegaRedHand MegaRedHand removed this pull request from the merge queue due to a manual request Oct 22, 2025
@MegaRedHand MegaRedHand changed the title feat(l1): allow setting a target gas limit through CLI feat(l1)!: allow setting a target gas limit through CLI Oct 22, 2025
@github-actions github-actions bot removed the L1 Ethereum client label Oct 22, 2025
@MegaRedHand MegaRedHand added this pull request to the merge queue Oct 22, 2025
Merged via the queue into main with commit 307d0ed Oct 22, 2025
43 checks passed
@MegaRedHand MegaRedHand deleted the set-gas-limit branch October 22, 2025 16:08
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Allow configuring a desired gas limit on the block builder

4 participants