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

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 behind os_input; no changes to commit, witness merge, or persistence logic.

Overview
Adds os_input-gated timing around the two Patricia witness fetches in read_paths_and_commit_block (pre-commit vs post-commit roots), and moves the end-to-end block timer so it covers those passes as well as commit/write.

starknet_committer gains new Action variants, timers, durations, and a first-pass witness entry count on BlockMeasurement; apollo_committer starts/stops measurements around each fetch_patricia_witnesses call and extends block debug logs with pre/post fetch milliseconds and witness entry totals. Witness size logging uses a new StarknetForestProofs::get_nodes_count() instead of inline counting.

starknet_committer_cli exposes an os_input feature that forwards to starknet_committer/os_input. A TODO notes Prometheus metrics for witness fetch are not added yet.

Reviewed by Cursor Bugbot for commit 0556455. 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
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
Copy link
Copy Markdown
Contributor Author

@ArielElp ArielElp left a comment

Choose a reason for hiding this comment

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

@ArielElp made 2 comments.
Reviewable status: 2 of 7 files reviewed, 3 unresolved discussions (waiting on yoavGrs).


crates/starknet_committer/src/block_committer/commit.rs line 242 at r7 (raw file):

Previously, yoavGrs wrote…

We don't have the number of witnesses?

Yeah, it was a bug, overridden here.

I made some changes; in retrospect, the number of witnesses fetched does not fit in BlockModificationsCount, since the commit_block flow sets all these numbers once. Reintroduced the witness count in BlockMeasurement and added it to the debug log.


crates/starknet_committer_cli/src/utils_test.rs line 20 at r7 (raw file):

Previously, yoavGrs wrote…

Give an interesting value.

Refactored around it.

Comment thread crates/starknet_committer/src/patricia_merkle_tree/types.rs
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 5 files and all commit messages, made 3 comments, and resolved 2 discussions.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on ArielElp).


crates/apollo_committer/src/committer.rs line 682 at r9 (raw file):

#[allow(clippy::as_conversions)]
// TODO: Consider adding fetch witnesses measurements.

You are doing it here, right?

Code quote:

// TODO: Consider adding fetch witnesses measurements.

crates/starknet_committer/src/block_committer/measurements_util.rs line 134 at r9 (raw file):

    pub durations: BlockDurations,
    pub modifications_counts: BlockModificationsCounts,
    pub fetched_witnesses_count: usize,

It was in BlockModificationsCounts.
I see that it's not only about the first pass now.

Suggestion:

#[cfg(feature = "os_input")]
 // Number of witnesses fetched in the first pass (pre-commit).
 pub fetched_witnesses_count: usize,

crates/starknet_committer/src/block_committer/measurements_util.rs line 167 at r9 (raw file):

            Action::FetchWitnessesSecondPass => {
                self.durations.fetch_witnesses_second_pass = duration_in_seconds;
                self.fetched_witnesses_count += entries_count;

The intersection between the witnesses in the first and second pass isn't empty...

Code quote:

 self.fetched_witnesses_count += entries_count;

@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from f63e49c to 6f484b4 Compare May 31, 2026 13:47
@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch from 1010f32 to 2123cd0 Compare May 31, 2026 13:47
Comment thread crates/starknet_committer/src/patricia_merkle_tree/types.rs
Comment thread crates/starknet_committer/src/patricia_merkle_tree/types.rs
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 6f484b4 to e32f923 Compare May 31, 2026 14:41
@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch from 2123cd0 to 99b209d Compare May 31, 2026 14:41
Comment thread crates/starknet_committer/src/patricia_merkle_tree/types.rs
Copy link
Copy Markdown
Contributor Author

@ArielElp ArielElp left a comment

Choose a reason for hiding this comment

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

@ArielElp made 3 comments and resolved 4 discussions.
Reviewable status: 6 of 7 files reviewed, 4 unresolved discussions (waiting on yoavGrs).


crates/apollo_committer/src/committer.rs line 682 at r9 (raw file):

Previously, yoavGrs wrote…

You are doing it here, right?

It only goes to the log, no dedicated metric


crates/starknet_committer/src/block_committer/measurements_util.rs line 134 at r9 (raw file):

Previously, yoavGrs wrote…

It was in BlockModificationsCounts.
I see that it's not only about the first pass now.

Reintroduced


crates/starknet_committer/src/block_committer/measurements_util.rs line 167 at r9 (raw file):

Previously, yoavGrs wrote…

The intersection between the witnesses in the first and second pass isn't empty...

Right... reverting to the previous state (two counts won't be very informative ATM, unless I do something a bit more sophisticated than .len)

@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch from 99b209d to fdd5e5d Compare May 31, 2026 17:03
#[cfg(feature = "os_input")]
Action::FetchWitnessesSecondPass => {
self.durations.fetch_witnesses_second_pass = duration_in_seconds;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Second pass witness count silently discarded in measurement

Low Severity

The FetchWitnessesSecondPass handler in update_after_action records the duration but does not accumulate entries_count into fetched_witnesses_count, unlike FetchWitnessesFirstPass. The caller passes proof_after.len() as the entry count, but it's silently ignored. The log then reports "witness entries" using fetched_witnesses_count, which only reflects the first pass, making the logged metric misleading.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit fdd5e5d. Configure here.

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 made 2 comments and resolved 2 discussions.
Reviewable status: 5 of 7 files reviewed, 3 unresolved discussions (waiting on ArielElp).


crates/starknet_committer/src/block_committer/measurements_util.rs line 134 at r9 (raw file):

Previously, ArielElp wrote…

Reintroduced

With the feature flag


crates/starknet_committer/src/block_committer/measurements_util.rs line 167 at r9 (raw file):

Previously, ArielElp wrote…

Right... reverting to the previous state (two counts won't be very informative ATM, unless I do something a bit more sophisticated than .len)

You can take the length of the union of the witness sets, but I'm fine with taking the first one.

@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch from fdd5e5d to 701d19d Compare June 1, 2026 08:24
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from e32f923 to 48a282a Compare June 1, 2026 08:24
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.

There are 7 total unresolved issues (including 6 from previous reviews).

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 701d19d. Configure here.

Comment thread crates/starknet_committer/src/patricia_merkle_tree/types.rs
@ArielElp ArielElp force-pushed the graphite-base/14189 branch from 48a282a to 0c257d7 Compare June 1, 2026 08:41
@ArielElp ArielElp force-pushed the ariel/fetch_patricia_paths_timers branch from 701d19d to 0556455 Compare June 1, 2026 08:41
@ArielElp ArielElp changed the base branch from graphite-base/14189 to ariel/read_paths_and_commit_block June 1, 2026 08:41
Copy link
Copy Markdown
Contributor Author

@ArielElp ArielElp left a comment

Choose a reason for hiding this comment

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

@ArielElp resolved 3 discussions.
Reviewable status: 4 of 7 files reviewed, 1 unresolved discussion (waiting on yoavGrs).

Copy link
Copy Markdown
Contributor Author

@ArielElp ArielElp left a comment

Choose a reason for hiding this comment

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

@ArielElp made 1 comment.
Reviewable status: 4 of 7 files reviewed, 1 unresolved discussion (waiting on yoavGrs).


crates/starknet_committer/src/block_committer/measurements_util.rs line 134 at r9 (raw file):

Previously, yoavGrs wrote…

With the feature flag

Done.

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 3 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArielElp and dorimedini-starkware).


crates/starknet_committer/src/patricia_merkle_tree/types.rs line 72 at r13 (raw file):

        self.classes_trie_proof.len()
            + self.contracts_trie_proof.nodes.len()
            + self.contracts_trie_proof.leaves.len()

You did both modifications. Does clippy complain if you rename it back to len?

Code quote:

    pub fn get_nodes_count(&self) -> usize {
        self.classes_trie_proof.len()
            + self.contracts_trie_proof.nodes.len()
            + self.contracts_trie_proof.leaves.len()

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