Skip to content

refactor(l2): replace sequencer config toml with CLI flags #2606

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

Merged
merged 75 commits into from
May 10, 2025

Conversation

ilitteri
Copy link
Contributor

@ilitteri ilitteri commented Apr 25, 2025

Motivation

Description

  • Adds CLI options for the sequencer components
  • Extends ethrex l2 init options with SequencerOptions (a struct that contains all the different components' options)
  • Refactors cmd/ethrex/l2.rs
    • Moved the command code to cmd/ethrex/l2/command.rs.
    • Moved the command options to cmd/ethrex/l2/options.rs.
  • Leaves the minimum necessary config in the sequencer_config_example.toml (needed by the deployer).
  • Leaves the minimum necessary logic in the crates/l2/utils/configs/toml_parser.rs module (needed by the deployer and prover).
  • Adds CLI options for the contract deployer bin and the system contracts updater bin (removing the need of a config file).
  • Updates the L2 Makefile.
  • Updates the Docker Compose files.
  • Updates the pr-main_l2 workflow.
  • Updates the L2 integration test.
  • Removes the sequencer_config_example.toml since it is not needed anymore.
  • Refactors the crates/l2/contracts module
    • Renames the crate from ethrex-l2_deployer to ethrex-l2_contracts.
    • Adds a bin module with the bins ethrex_l2_l1_deployer and ethrex_l2_system_contracts_updater.
    • All the SDK-related logic was moved to the SDK lib.
  • Cleans up the logic related to the config and toml parsing since now the only bin relying on the config is the Prover. Everything relative to the sequencer was removed, and now it is "hardcoded" for the Prover.

How to test

If you are in a dev environment, keep working as usual because under the hood, the sequencer initialization is not relying anymore on the sequencer_config.toml.

If you are in a prod environment, run cargo run --release --features l2 -- l2 init --help at the root of the repository to explore the different configuration flags this PR adds.

Caveats

The prover config file is still needed by the prover (tracked in #2576).

Closes #2574

@ilitteri ilitteri added the L2 Rollup client label Apr 25, 2025
@ilitteri ilitteri requested a review from mationorato April 25, 2025 18:57
@ilitteri ilitteri self-assigned this Apr 25, 2025
@ilitteri ilitteri requested a review from a team as a code owner April 25, 2025 18:57
Copy link

github-actions bot commented Apr 25, 2025

Lines of code report

Total lines added: 1582
Total lines removed: 260
Total lines changed: 1842

Detailed view
+------------------------------------------------------------------+-------+------+
| File                                                             | Lines | Diff |
+------------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/initializers.rs                                | 370   | -9   |
+------------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/l2/command.rs                                  | 199   | +199 |
+------------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/l2/mod.rs                                      | 9     | +9   |
+------------------------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/l2/options.rs                                  | 348   | +348 |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/contracts/bin/deployer/cli.rs                   | 230   | +230 |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/contracts/bin/deployer/error.rs                 | 32    | +32  |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/contracts/bin/deployer/main.rs                  | 445   | +445 |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/contracts/bin/system_contracts_updater/cli.rs   | 21    | +21  |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/contracts/bin/system_contracts_updater/error.rs | 13    | +13  |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/contracts/bin/system_contracts_updater/main.rs  | 34    | +34  |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/l2.rs                                           | 8     | +4   |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sdk/src/sdk.rs                                  | 413   | +176 |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/block_producer.rs                     | 114   | +3   |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/configs.rs                            | 47    | +47  |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/errors.rs                             | 209   | +12  |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_committer.rs                       | 506   | +1   |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_proof_sender.rs                    | 163   | -2   |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/l1_watcher.rs                         | 296   | -5   |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/metrics.rs                            | 75    | -6   |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/mod.rs                                | 71    | +6   |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/proof_coordinator.rs                  | 291   | -6   |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/utils/config/mod.rs                             | 83    | -43  |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/utils/config/toml_parser.rs                     | 80    | -189 |
+------------------------------------------------------------------+-------+------+
| ethrex/crates/l2/utils/prover/save_state.rs                      | 426   | +2   |
+------------------------------------------------------------------+-------+------+

@ilitteri ilitteri added this pull request to the merge queue May 9, 2025
@ilitteri ilitteri removed this pull request from the merge queue due to a manual request May 9, 2025
@ilitteri ilitteri enabled auto-merge May 9, 2025 22:06
@ilitteri ilitteri added this pull request to the merge queue May 9, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 9, 2025
@ilitteri ilitteri added this pull request to the merge queue May 9, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 9, 2025
@ilitteri ilitteri added this pull request to the merge queue May 9, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 9, 2025
@ilitteri ilitteri added this pull request to the merge queue May 9, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks May 10, 2025
@ilitteri ilitteri added this pull request to the merge queue May 10, 2025
Merged via the queue into main with commit 938db19 May 10, 2025
31 checks passed
@ilitteri ilitteri deleted the replace_sequencer_config branch May 10, 2025 13:31
fmoletta pushed a commit that referenced this pull request May 15, 2025
**Motivation**

- #2380
- #2574
- #2609

**Description**

- Adds CLI options for the sequencer components
- Extends `ethrex l2 init` options with `SequencerOptions` (a struct
that contains all the different components' options)
- Refactors `cmd/ethrex/l2.rs`
    - Moved the command code to `cmd/ethrex/l2/command.rs`.
    - Moved the command options to `cmd/ethrex/l2/options.rs`.
- Leaves the minimum necessary config in the
`sequencer_config_example.toml` (needed by the deployer).
- Leaves the minimum necessary logic in the
`crates/l2/utils/configs/toml_parser.rs` module (needed by the deployer
and prover).
- Adds CLI options for the contract deployer bin and the system
contracts updater bin (removing the need of a config file).
- Updates the L2 Makefile.
- Updates the Docker Compose files.
- Updates the `pr-main_l2` workflow.
- Updates the L2 integration test.
- Removes the `sequencer_config_example.toml` since it is not needed
anymore.
- Refactors the `crates/l2/contracts` module
- Renames the crate from `ethrex-l2_deployer` to `ethrex-l2_contracts`.
- Adds a `bin` module with the bins `ethrex_l2_l1_deployer` and
`ethrex_l2_system_contracts_updater`.
    - All the SDK-related logic was moved to the SDK lib.
- Cleans up the logic related to the config and toml parsing since now
the only bin relying on the config is the Prover. Everything relative to
the sequencer was removed, and now it is "hardcoded" for the Prover.

**How to test**

If you are in a dev environment, keep working as usual because under the
hood, the sequencer initialization is not relying anymore on the
`sequencer_config.toml`.

If you are in a prod environment, run `cargo run --release --features l2
-- l2 init --help` at the root of the repository to explore the
different configuration flags this PR adds.

**Caveats**

The prover config file is still needed by the prover (tracked in
#2576).

Closes #2574

---------

Co-authored-by: Javier Rodríguez Chatruc <49622509+jrchatruc@users.noreply.github.com>
Co-authored-by: Manuel Iñaki Bilbao <manuel.bilbao@lambdaclass.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L2 Rollup client
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

L2: Replace sequencer config workflow
5 participants