Skip to content

Conversation

mpaulucci
Copy link
Collaborator

Motivation
Logging in general, and specifically in the import subcommand is quite messy.

Description

  • Improves the logging phrasing
  • Instead of logging for each block, logs a summary every 10 seconds
  • Logs the total time that it took.
  • Some misc log additions and downgrades

This is how it looks:

2025-08-28T17:27:12.121079Z  INFO ethrex_storage::store: Opening storage engine engine=Libmdbx path=/Users/mpaulucci/Library/Application-Support/ethrex
2025-08-28T17:27:12.158692Z  INFO ethrex_storage::store: Storing genesis block hash=0xbbe3…971b
2025-08-28T17:27:12.159567Z  INFO ethrex::initializers: Initiating blockchain evm=levm
2025-08-28T17:27:12.159726Z  INFO ethrex::cli: Importing blocks from file path=./hoodi-1k.rlp
2025-08-28T17:27:22.415021Z  INFO ethrex::cli: Import progress processed=151 total=1000 percent=15.1
2025-08-28T17:27:32.602179Z  INFO ethrex::cli: Import progress processed=180 total=1000 percent=18.0

@mpaulucci mpaulucci requested a review from a team as a code owner August 28, 2025 17:36
@github-actions github-actions bot added the L1 Ethereum client label Aug 28, 2025
@mpaulucci mpaulucci changed the title chore(l1): Improve logging on the import subcommand. chore(l1): improve logging on the import subcommand. Aug 28, 2025
Copy link

github-actions bot commented Aug 28, 2025

Lines of code report

Total lines added: 31
Total lines removed: 4
Total lines changed: 35

Detailed view
+--------------------------------------------------+-------+------+
| File                                             | Lines | Diff |
+--------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/bench/build_block_benchmark.rs | 248   | +1   |
+--------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/cli.rs                         | 516   | +17  |
+--------------------------------------------------+-------+------+
| ethrex/cmd/ethrex/initializers.rs                | 376   | +1   |
+--------------------------------------------------+-------+------+
| ethrex/crates/blockchain/blockchain.rs           | 806   | +12  |
+--------------------------------------------------+-------+------+
| ethrex/crates/storage/store.rs                   | 1453  | -4   |
+--------------------------------------------------+-------+------+

@@ -1,6 +1,6 @@
participants:
- el_type: ethrex
el_image: ethrex:latest
el_image: ethrex:local
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unrelated to the PR but it is such a small fix that I added it

@Copilot Copilot AI review requested due to automatic review settings August 29, 2025 16:33
Copy link
Contributor

@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 improves logging in the import subcommand and throughout the application by making log messages more structured, informative, and less verbose. The changes focus on reducing log noise during block processing while providing better progress tracking and performance insights.

  • Enhanced import progress logging with 10-second interval summaries instead of per-block logs
  • Restructured log messages to use structured logging with field names
  • Added performance logging controls to reduce noise in test environments

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cmd/ethrex/cli.rs Added progress tracking with 10-second intervals and completion timing for import/export operations
crates/blockchain/blockchain.rs Added perf_logs_enabled flag to control performance logging output
crates/storage/store.rs Improved log messages with structured fields and appropriate log levels
cmd/ethrex/initializers.rs Updated blockchain initialization to support performance logging control
cmd/ethrex/l2/initializers.rs Added performance logging parameter and improved config storage logging
tooling/ef_tests/blockchain/test_runner.rs Updated blockchain constructor call with new performance logging parameter
cmd/ethrex/bench/build_block_benchmark.rs Updated blockchain constructor call for benchmark tests
fixtures/network/hoodi.yaml Changed Docker image reference from latest to local

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

@mpaulucci mpaulucci force-pushed the improve-import-logs branch from 14579d5 to 839e1cf Compare August 29, 2025 16:40
Copy link
Contributor

@SDartayet SDartayet left a comment

Choose a reason for hiding this comment

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

LGTM!

@mpaulucci mpaulucci moved this to In Review in ethrex_l1 Sep 1, 2025
@mpaulucci mpaulucci added this pull request to the merge queue Sep 1, 2025
Merged via the queue into main with commit cbef92e Sep 1, 2025
55 of 74 checks passed
@mpaulucci mpaulucci deleted the improve-import-logs branch September 1, 2025 14:06
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Sep 1, 2025
emirongrr pushed a commit to emirongrr/ethrex that referenced this pull request Sep 3, 2025
)

**Motivation**
Logging in general, and specifically in the `import` subcommand is quite
messy.

**Description**
- Improves the logging phrasing
- Instead of logging for each block, logs a summary every 10 seconds
- Logs the total time that it took.
- Some misc log additions and downgrades

This is how it looks:
```
2025-08-28T17:27:12.121079Z  INFO ethrex_storage::store: Opening storage engine engine=Libmdbx path=/Users/mpaulucci/Library/Application-Support/ethrex
2025-08-28T17:27:12.158692Z  INFO ethrex_storage::store: Storing genesis block hash=0xbbe3…971b
2025-08-28T17:27:12.159567Z  INFO ethrex::initializers: Initiating blockchain evm=levm
2025-08-28T17:27:12.159726Z  INFO ethrex::cli: Importing blocks from file path=./hoodi-1k.rlp
2025-08-28T17:27:22.415021Z  INFO ethrex::cli: Import progress processed=151 total=1000 percent=15.1
2025-08-28T17:27:32.602179Z  INFO ethrex::cli: Import progress processed=180 total=1000 percent=18.0
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L1 Ethereum client
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants