Skip to content

chore(l1): include Merkle step in metrics logs #3630

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Oppen
Copy link
Contributor

@Oppen Oppen commented Jul 14, 2025

In preparation for performance analysis tooling, we need to include
Merkle-tree specific measures.
Rigorously speaking, this includes most of the data preparation before
committing to the DB. The code assumes Merkle-tree operations to be the
bottleneck there.

The notebook part will be handled in a separate PR based on this branch,
so we can keep the logic in it simpler by only handling one version of
the logs at a time. It also should make it easier to review.

Based on #3274
Coauthored-by: @Arkenan

Part of: #3331

@Copilot Copilot AI review requested due to automatic review settings July 14, 2025 17:45
@Oppen Oppen requested a review from a team as a code owner July 14, 2025 17:45
@github-actions github-actions bot added the L1 Ethereum client label Jul 14, 2025
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

Adds Merkle-tree timing to block processing logs and exposes the new AccountUpdatesList type for storage operations. Key changes:

  • Export AccountUpdatesList in the storage crate.
  • Refactored store_block to accept a pre-computed AccountUpdatesList and moved Merkle-tree application outside for timing.
  • Enhanced print_add_block_logs to include a Merkle step and percentage breakdown in the metrics log.

Reviewed Changes

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

File Description
crates/storage/lib.rs Added AccountUpdatesList to the public exports.
crates/blockchain/blockchain.rs Propagates AccountUpdatesList, captures Merkle timing, and updates log formatting with percentage breakdown.
Comments suppressed due to low confidence (2)

crates/blockchain/blockchain.rs:423

  • The log string prints Gas Used: {:.3} ({:.0}%) without a unit on the first value. It would be clearer to include the unit (e.g., Ggas) next to that number.
                "[METRIC] BLOCK EXECUTION THROUGHPUT ({}): {:.3} Ggas/s TIME SPENT: {:.0} ms. Gas Used: {:.3} ({:.0}%), #Txs: {}.",

crates/blockchain/blockchain.rs:403

  • The new print_add_block_logs method and its formatting logic aren't covered by unit tests. Consider adding tests to verify the output string and percentage calculations.
    fn print_add_block_logs(

Comment on lines 432 to 441
fn percentage(init: Instant, end: Instant, total: f64) -> f64 {
(end.duration_since(init).as_millis() as f64 / total * 100.0).round()
}

let extra_log = if as_gigas > 0.0 {
format!(
" exec/Ggas: {execution_time_per_gigagas} ms ({execution_fraction}%), st/Ggas: {storage_time_per_gigagas} ms ({storage_fraction}%)",
" exec: {}% merkle: {}% store: {}%",
percentage(since, executed, interval),
percentage(executed, merkelized, interval),
percentage(merkelized, stored, interval)
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

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

[nitpick] This nested percentage function returns an f64 and lives inside the logging method. Consider returning an integer type (e.g., u64) for rounded percentages and moving it out to improve readability.

Copilot uses AI. Check for mistakes.

Copy link

github-actions bot commented Jul 14, 2025

Lines of code report

Total lines added: 13
Total lines removed: 0
Total lines changed: 13

Detailed view
+----------------------------------------------+-------+------+
| File                                         | Lines | Diff |
+----------------------------------------------+-------+------+
| ethrex/crates/blockchain/blockchain.rs       | 769   | +6   |
+----------------------------------------------+-------+------+
| ethrex/crates/l2/sequencer/block_producer.rs | 195   | +6   |
+----------------------------------------------+-------+------+
| ethrex/crates/storage/lib.rs                 | 12    | +1   |
+----------------------------------------------+-------+------+

@Oppen Oppen force-pushed the log_merklization_time branch 2 times, most recently from 55d699d to 45c01a2 Compare July 14, 2025 18:01
In preparation for performance analysis tooling, we need to include
Merkle-tree specific measures.
Rigorously speaking, this includes most of the data preparation before
committing to the DB. The code assumes Merkle-tree operations to be the
bottleneck there.

Based on #3274
Coauthored-by: @Arkenan
@Oppen Oppen force-pushed the log_merklization_time branch from 45c01a2 to 0d2cb3e Compare July 14, 2025 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L1 Ethereum client
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant