Skip to content

refactor(l1): improve snap sync logging with table format#5977

Merged
pablodeymo merged 18 commits intomainfrom
improve-snap-sync-logging-table-format
Jan 22, 2026
Merged

refactor(l1): improve snap sync logging with table format#5977
pablodeymo merged 18 commits intomainfrom
improve-snap-sync-logging-table-format

Conversation

@pablodeymo
Copy link
Contributor

@pablodeymo pablodeymo commented Jan 21, 2026

Motivation

The current snap sync logs are verbose and hard to scan at a glance:

P2P Snap Sync | elapsed 01h 10m 53s 04ms | peers 13 | step Requesting Storage Ranges | head 2f966c...
  headers : 2072429/2072429 (100.00%), remaining 0
  accounts: downloaded 19140475 @ 00h 02m 29s 00ms | inserted 19140475 (100.0%) in 00h 00m 23s 00ms | pending 0
  storage : downloaded 143517386 @ 00h 43m 30s 02ms | inserted 0 (0.0%) in 00h 00m 00s 00ms
  healing : accounts 2106, storages 0, elapsed 00h 00m 00s 00ms, throttle Peers
  bytecodes: downloaded 0 in 00h 00m 00s 00ms

Additionally, frequent engine API logs pollute the console during sync.

Description

Replace with a clean table format that's easier to read:

───────────────────────────────────────────────────────────────────────
 SNAP SYNC │ 01:10:53 │ 13 peers │ Requesting Storage Ranges │ 2f966c
───────────────────────────────────────────────────────────────────────
 Headers Downloaded          2072429       100.0%
 Headers Inserted                  -
 Accounts Downloaded        19140475
 Accounts Inserted          19140475
 Storage Downloaded        143517386
 Storage Inserted                  0
 Bytecodes Downloaded              0
 Bytecodes Inserted                -
───────────────────────────────────────────────────────────────────────
 Healing: 2106 accounts │ 0 storages
───────────────────────────────────────────────────────────────────────

Changes:

  • Single-column layout with 8 rows (one per metric) instead of 4 rows with 2 columns
  • Progress percentage shown only for Headers Downloaded
  • Simplified time format (01:10:53 vs 01h 10m 53s 04ms)
  • Removed per-component timing clutter (download/insert times)
  • Removed redundant metrics (pending counts, remaining headers)
  • Increased refresh interval from 10s to 30s to reduce log noise
  • Changed engine API logs from INFO to DEBUG level:
    • "Received new engine request" (Blobs V1/V2/V3)
    • "Received new payload"
    • "New fork choice update"

Result: Cleaner, more scannable output with less console noise.

How to Test

  1. Run a node with snap sync enabled
  2. Observe the new table format in logs every 30 seconds
  3. Verify engine API messages only appear at DEBUG level

Replace verbose multi-line logging with a clean, scannable table format
featuring visual progress bars, aligned columns, and simplified time
display (HH:MM:SS). Removes redundant timing details per component while
keeping essential metrics: downloaded/inserted counts and progress percentage.
@pablodeymo pablodeymo requested a review from a team as a code owner January 21, 2026 21:24
Copilot AI review requested due to automatic review settings January 21, 2026 21:24
@github-actions github-actions bot added the L1 Ethereum client label Jan 21, 2026
@github-actions
Copy link

github-actions bot commented Jan 21, 2026

Lines of code report

Total lines added: 3
Total lines removed: 80
Total lines changed: 83

Detailed view
+-----------------------------------------+-------+------+
| File                                    | Lines | Diff |
+-----------------------------------------+-------+------+
| ethrex/crates/networking/p2p/network.rs | 282   | -80  |
+-----------------------------------------+-------+------+
| ethrex/crates/networking/p2p/sync.rs    | 1378  | +3   |
+-----------------------------------------+-------+------+

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 refactors the snap sync logging to use a cleaner table format with visual progress bars, replacing the previous verbose multi-line format with aligned columns and simplified time display.

Changes:

  • Replaced verbose log format with table-based display using Unicode box-drawing characters
  • Added visual progress bars using block characters (█) for instant progress recognition
  • Simplified time format from HH:MM:SS:MS to HH:MM:SS and removed per-component timing metrics

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@pablodeymo pablodeymo marked this pull request as draft January 21, 2026 22:10
@ethrex-project-sync ethrex-project-sync bot moved this to In Progress in ethrex_l1 Jan 21, 2026
Change the snap sync progress table from 4 rows with 2 columns (Downloaded/Inserted)
to 8 rows with a single data column. Remove progress bars, keeping only the percentage
for Headers Downloaded. This makes the output easier to read and parse.
Reduce console noise by lowering log level for frequent engine API messages:
- Received new engine request (Blobs V1/V2/V3)
- Received new payload
- New fork choice update
…er retrieved", "All downloaded headers are unique", "Received unexpected message from peer" and "Timeout while waiting for sync head from peer" moved to DEBUG
@pablodeymo pablodeymo marked this pull request as ready for review January 22, 2026 19:46
@ethrex-project-sync ethrex-project-sync bot moved this from In Progress to In Review in ethrex_l1 Jan 22, 2026
Copy link
Contributor

@tomip01 tomip01 left a comment

Choose a reason for hiding this comment

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

one nit

Comment on lines +277 to +284
1. Headers Downloaded {headers_downloaded:>13} {headers_percentage:>5.1}% {headers_per_second} headers/s
2. Accounts Downloaded {account_leaves_downloaded:>13} {accounts_per_second} accounts/s
3. Accounts Inserted {account_leaves_inserted:>13}
4. Storage Downloaded {storage_leaves_downloaded:>13} {storage_per_second} storage slots/s
5. Storage Inserted {storage_leaves_inserted:>13}
6. Healing: {healed_accounts} accounts
7. Healing: {healed_storages} storages
8. Bytecodes Downloaded {bytecodes_downloaded:>13} {bytecodes_per_second} bytecodes/s
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a nit, but with this formatting we get:

1. Headers Downloaded      1791878       85.9%       9685 headers/s
2. Accounts Downloaded           0                   0 accounts/s
...

Could we make it look like this (aligning the unit names)?

1. Headers Downloaded      1791878       85.9%       9685 headers/s
2. Accounts Downloaded           0                   0    accounts/s
...

@pablodeymo pablodeymo added this pull request to the merge queue Jan 22, 2026
Comment on lines +5 to +7
### 2026-01-21

- Improve snap sync logging with table format and visual progress bars [#5977](https://github.com/lambdaclass/ethrex/pull/5977)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this actually affect performance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it's just visual modification (that is displayed every 30 secs).

Merged via the queue into main with commit 1cf2377 Jan 22, 2026
56 checks passed
@pablodeymo pablodeymo deleted the improve-snap-sync-logging-table-format branch January 22, 2026 22:59
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Jan 22, 2026
Oppen pushed a commit that referenced this pull request Jan 27, 2026
## Motivation

The current snap sync logs are verbose and hard to scan at a glance:

```
P2P Snap Sync | elapsed 01h 10m 53s 04ms | peers 13 | step Requesting Storage Ranges | head 2f966c...
  headers : 2072429/2072429 (100.00%), remaining 0
  accounts: downloaded 19140475 @ 00h 02m 29s 00ms | inserted 19140475 (100.0%) in 00h 00m 23s 00ms | pending 0
  storage : downloaded 143517386 @ 00h 43m 30s 02ms | inserted 0 (0.0%) in 00h 00m 00s 00ms
  healing : accounts 2106, storages 0, elapsed 00h 00m 00s 00ms, throttle Peers
  bytecodes: downloaded 0 in 00h 00m 00s 00ms
```

Additionally, frequent engine API logs pollute the console during sync.

## Description

Replace with a clean table format that's easier to read:

```
───────────────────────────────────────────────────────────────────────
 SNAP SYNC │ 01:10:53 │ 13 peers │ Requesting Storage Ranges │ 2f966c
───────────────────────────────────────────────────────────────────────
 Headers Downloaded          2072429       100.0%
 Headers Inserted                  -
 Accounts Downloaded        19140475
 Accounts Inserted          19140475
 Storage Downloaded        143517386
 Storage Inserted                  0
 Bytecodes Downloaded              0
 Bytecodes Inserted                -
───────────────────────────────────────────────────────────────────────
 Healing: 2106 accounts │ 0 storages
───────────────────────────────────────────────────────────────────────
```

**Changes:**
- Single-column layout with 8 rows (one per metric) instead of 4 rows
with 2 columns
- Progress percentage shown only for Headers Downloaded
- Simplified time format (`01:10:53` vs `01h 10m 53s 04ms`)
- Removed per-component timing clutter (download/insert times)
- Removed redundant metrics (pending counts, remaining headers)
- Increased refresh interval from 10s to 30s to reduce log noise
- Changed engine API logs from INFO to DEBUG level:
  - "Received new engine request" (Blobs V1/V2/V3)
  - "Received new payload"
  - "New fork choice update"

**Result:** Cleaner, more scannable output with less console noise.

## How to Test

1. Run a node with snap sync enabled
2. Observe the new table format in logs every 30 seconds
3. Verify engine API messages only appear at DEBUG level

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pablodeymo added a commit that referenced this pull request Jan 27, 2026
Resolve conflicts from #5977 and #6018 merge to main:
- Keep modular sync structure (sync.rs delegates to full.rs and snap_sync.rs)
- Keep snap client code in snap/client.rs (removed from peer_handler.rs)
- Add InsertingAccountRanges metric from #6018 to snap_sync.rs
- Remove unused info import from peer_handler.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants