Skip to content

Conversation

@ilitteri
Copy link
Contributor

@ilitteri ilitteri commented Mar 27, 2025

Motivation

In a previous PR, the configuration file error handling was updated, and the help messages stopped being helpful. This PR aims to make these error messages useful again and improve their handling.

The current help message does not work:

Error parsing the .toml configuration files: Could not find crates/l2/configs/config.toml
Have you tried copying the provided example? Try:
cp /Users/ivanlitteri/Repositories/lambdaclass/ethrex/crates/l2/configs/*_example.toml /Users/ivanlitteri/Repositories/lambdaclass/ethrex/crates/l2/configs/*.toml

Error: ConfigError(TomlParserError(TomlFileNotFound("config.toml")))
make: *** [deploy-l1] Error 1
➜  l2 git:(main) ✗ cp /Users/ivanlitteri/Repositories/lambdaclass/ethrex/crates/l2/configs/*_example.toml /Users/ivanlitteri/Repositories/lambdaclass/ethrex/crates/l2/configs/*.toml
cp: /Users/ivanlitteri/Repositories/lambdaclass/ethrex/crates/l2/configs/sequencer_config_example.toml is not a directory

Description

  • Add a prefix sequencer_ to the sequencer config file to be consistent with the prover client config file and update its references.
  • Pass ConfigMode to the toml errors to make the help messages helpful again, and implement Debug and Display for this on it.
  • Make the toml parsing error explicit.

@ilitteri ilitteri added the L2 Rollup client label Mar 27, 2025
@ilitteri ilitteri self-assigned this Mar 27, 2025
@ilitteri ilitteri requested a review from a team as a code owner March 27, 2025 19:59
@github-actions
Copy link

github-actions bot commented Mar 27, 2025

Lines of code report

Total lines added: 20
Total lines removed: 0
Total lines changed: 20

Detailed view
+----------------------------------------------+-------+------+
| File                                         | Lines | Diff |
+----------------------------------------------+-------+------+
| ethrex/crates/l2/utils/config/mod.rs         | 126   | +17  |
+----------------------------------------------+-------+------+
| ethrex/crates/l2/utils/config/toml_parser.rs | 283   | +3   |
+----------------------------------------------+-------+------+

Copy link
Contributor

@fborello-lambda fborello-lambda left a comment

Choose a reason for hiding this comment

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

Nice, the error message wasn't clear enough.

"Could not find crates/l2/configs/{0}
Have you tried copying the provided example? Try:
cp {manifest_dir}/configs/*_example.toml {manifest_dir}/configs/*.toml
cp {manifest_dir}/configs/{1}_config_example.toml {manifest_dir}/configs/{1}_config.toml
Copy link
Contributor

Choose a reason for hiding this comment

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

Great!

@ilitteri ilitteri changed the title fix(l2): config error hanlding fix(l2): config error handling Mar 27, 2025
@ilitteri ilitteri enabled auto-merge March 28, 2025 12:53
@ilitteri ilitteri added this pull request to the merge queue Mar 28, 2025
Merged via the queue into main with commit 8a026aa Mar 28, 2025
27 checks passed
@ilitteri ilitteri deleted the fix_config_help branch March 28, 2025 13:36
pedrobergamini pushed a commit to pedrobergamini/ethrex that referenced this pull request Aug 24, 2025
**Motivation**

In a previous PR, the configuration file error handling was updated, and
the help messages stopped being helpful. This PR aims to make these
error messages useful again and improve their handling.

The current help message does not work:

```Shell
Error parsing the .toml configuration files: Could not find crates/l2/configs/config.toml
Have you tried copying the provided example? Try:
cp /Users/ivanlitteri/Repositories/lambdaclass/ethrex/crates/l2/configs/*_example.toml /Users/ivanlitteri/Repositories/lambdaclass/ethrex/crates/l2/configs/*.toml

Error: ConfigError(TomlParserError(TomlFileNotFound("config.toml")))
make: *** [deploy-l1] Error 1
➜  l2 git:(main) ✗ cp /Users/ivanlitteri/Repositories/lambdaclass/ethrex/crates/l2/configs/*_example.toml /Users/ivanlitteri/Repositories/lambdaclass/ethrex/crates/l2/configs/*.toml
cp: /Users/ivanlitteri/Repositories/lambdaclass/ethrex/crates/l2/configs/sequencer_config_example.toml is not a directory
```

**Description**

- Add a prefix `sequencer_` to the sequencer config file to be
consistent with the prover client config file and update its references.
- Pass `ConfigMode` to the `toml` errors to make the help messages
helpful again, and implement `Debug` and `Display` for this on it.
- Make the `toml` parsing error explicit.
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.

4 participants