Skip to content

starknet_committer,apollo_committer: add timers for fetch patricia paths#14189

Open
ArielElp wants to merge 1 commit into
ariel/read_paths_and_commit_blockfrom
ariel/fetch_patricia_paths_timers
Open

starknet_committer,apollo_committer: add timers for fetch patricia paths#14189
ArielElp wants to merge 1 commit into
ariel/read_paths_and_commit_blockfrom
ariel/fetch_patricia_paths_timers

Conversation

@ArielElp
Copy link
Copy Markdown
Contributor

No description provided.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Contributor Author

ArielElp commented May 25, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ArielElp ArielElp marked this pull request as ready for review May 25, 2026 13:22
@cursor
Copy link
Copy Markdown

cursor Bot commented May 25, 2026

PR Summary

Low Risk
Observability-only changes around witness path collection; no commit logic or persistence behavior changes beyond how witness counts are aggregated for logging/measurements.

Overview
Adds per-phase timing for Patricia witness collection in the OS-input commit path (read_paths_and_commit_block), keyed by global root before and after state application.

The measurement layer gains Action::FetchPatriciaPaths(HashOutput) with per-root timers and FetchPatriciaPathsMeasurement entries on BlockMeasurement. Apollo committer starts/stops these around pre- and post-commit fetch_patricia_witnesses calls and uses StarknetForestProofs::len() for witness counts in logs and stop measurements. Existing Prometheus update_metrics still ignores the new field (..).

Risk: Low—observability-only on the commit hot path; witness log counts now use len() (classes/contract nodes + storage proof nodes, not contract trie leaves).

Reviewed by Cursor Bugbot for commit b3e1cb3. Bugbot is set up for automated code reviews on this repo. Configure here.

@ArielElp ArielElp requested a review from yoavGrs May 25, 2026 13:22
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e8159c4. Configure here.

Comment thread crates/starknet_committer/src/patricia_merkle_tree/types.rs
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 1f931cb to 8f9e24b Compare May 25, 2026 13:32
@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch 2 times, most recently from 535b5e5 to 8508cca Compare May 25, 2026 13:35
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 8f9e24b to cddd859 Compare May 25, 2026 13:35
@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch from 8508cca to d204c67 Compare May 25, 2026 13:45
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from cddd859 to a660497 Compare May 25, 2026 13:45
@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch from d204c67 to b7d225e Compare May 25, 2026 13:58
@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch from b7d225e to bc61fc5 Compare May 25, 2026 14:13
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 00bf9c8 to 9d6106e Compare May 25, 2026 14:13
Copy link
Copy Markdown
Contributor

@yoavGrs yoavGrs left a comment

Choose a reason for hiding this comment

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

@yoavGrs reviewed 1 file and all commit messages, and made 5 comments.
Reviewable status: 1 of 3 files reviewed, 5 unresolved discussions (waiting on ArielElp).


crates/apollo_committer/src/committer.rs line 560 at r2 (raw file):

                    .ok();

                block_measurements.start_measurement(Action::EndToEnd);

The end-to-end measurement should include the new actions.

Code quote:

block_measurements.start_measurement(Action::EndToEnd);

crates/apollo_committer/src/committer.rs line 659 at r2 (raw file):

fn update_metrics(
    height: BlockNumber,
    BlockMeasurement { n_reads, n_writes, durations, modifications_counts, .. }: &BlockMeasurement,

And add a todo to consider including it in the metrics.

Suggestion:

, _fetch_patricia_paths_measurements }

crates/starknet_committer/src/block_committer/measurements_util.rs line 16 at r2 (raw file):

    Compute,
    Write,
    FetchPatriciaPaths(HashOutput),

Gate it?

Code quote:

FetchPatriciaPaths(HashOutput),

crates/starknet_committer/src/block_committer/measurements_util.rs line 25 at r2 (raw file):

    pub compute_timer: Option<Instant>,
    pub writer_timer: Option<Instant>,
    pub fetch_patricia_paths_timers: HashMap<HashOutput, Option<Instant>>,

If you save the timer by hash, how do you know what is the first read and what is the second? The hash itself is not interesting.

Keep it simple with two new timers?

Code quote:

pub fetch_patricia_paths_timers: HashMap<HashOutput, Option<Instant>>,

crates/starknet_committer/src/block_committer/measurements_util.rs line 121 at r2 (raw file):

    pub root: HashOutput,
    pub duration: f64,
    pub n_entries: usize,

There are structs for durations (BlockDurations) and for counts (BlockModificationsCounts).

Code quote:

    pub duration: f64,
    pub n_entries: usize,

@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch 2 times, most recently from 87e4d8a to 95ca976 Compare May 26, 2026 10:48
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 38ad4df to 0ef2f36 Compare May 26, 2026 10:48
@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch from 95ca976 to b3e1cb3 Compare May 26, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants