Skip to content

starknet_committer: underlying logic of the new read witnesses and commit endpoint#14001

Open
ArielElp wants to merge 1 commit into
ariel/commit_metadatafrom
ariel/read_paths_and_commit_block
Open

starknet_committer: underlying logic of the new read witnesses and commit endpoint#14001
ArielElp wants to merge 1 commit into
ariel/commit_metadatafrom
ariel/read_paths_and_commit_block

Conversation

@ArielElp
Copy link
Copy Markdown
Contributor

@ArielElp ArielElp commented May 7, 2026

No description provided.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Contributor Author

ArielElp commented May 7, 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 force-pushed the ariel/commit_metadata branch from 97f4dda to c42c4a2 Compare May 7, 2026 12:40
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch 2 times, most recently from a48fffb to bd02493 Compare May 14, 2026 08:43
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from bd02493 to a600115 Compare May 18, 2026 11:56
@ArielElp ArielElp force-pushed the ariel/commit_metadata branch from 2892fbe to 573c4db Compare May 18, 2026 11:56
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from a600115 to 65906b7 Compare May 18, 2026 13:52
@ArielElp ArielElp force-pushed the ariel/commit_metadata branch from 573c4db to 0ef9967 Compare May 18, 2026 13:52
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 65906b7 to 4de5b94 Compare May 19, 2026 06:55
@ArielElp ArielElp force-pushed the ariel/commit_metadata branch 2 times, most recently from 2f5189a to d248e3b Compare May 19, 2026 07:08
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 4de5b94 to 58e714d Compare May 19, 2026 07:08
@ArielElp ArielElp marked this pull request as ready for review May 19, 2026 07:08
@ArielElp ArielElp force-pushed the ariel/commit_metadata branch from 334fb68 to b9d7c24 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/commit_metadata branch from b9d7c24 to a11c9cd Compare May 26, 2026 11:42
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 0ef2f36 to 574e6b3 Compare May 26, 2026 11:42
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 and resolved 1 discussion.
Reviewable status: 2 of 5 files reviewed, all discussions resolved (waiting on yoavGrs).


crates/apollo_committer/src/committer.rs line 626 at r6 (raw file):

Previously, yoavGrs wrote…

This is my suggestion - break it with a let in the middle.

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 2 files and all commit messages.
Reviewable status: 4 of 5 files reviewed, all discussions resolved.

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 dismissed @yoavGrs from a discussion.
Reviewable status: 4 of 5 files reviewed, all discussions resolved (waiting on yoavGrs).

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 partially reviewed 4 files and all commit messages.
Reviewable status: 4 of 5 files reviewed, all discussions resolved.

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.

Reviewable status: 4 of 5 files reviewed, all discussions resolved.

@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 574e6b3 to f54eccf Compare May 26, 2026 13:03
@ArielElp ArielElp force-pushed the ariel/commit_metadata branch 2 times, most recently from e18eb18 to 625c60d Compare May 26, 2026 13:11
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from f54eccf to 491609e Compare May 26, 2026 13:11
@ArielElp ArielElp force-pushed the ariel/commit_metadata branch from 625c60d to d46842e Compare May 27, 2026 07:23
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 491609e to 6a5093a Compare May 27, 2026 07:23
@ArielElp ArielElp force-pushed the ariel/read_paths_and_commit_block branch from 6a5093a to b5bb2a9 Compare May 27, 2026 09:45
@ArielElp ArielElp force-pushed the ariel/commit_metadata branch from d46842e to a573e34 Compare May 27, 2026 09:45
Copy link
Copy Markdown
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 5 files and all commit messages, and made 5 comments.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on ArielElp).


crates/apollo_committer/Cargo.toml line 11 at r8 (raw file):

[features]
testing = []
os_input = ["apollo_committer_types/os_input", "starknet_committer/os_input"]

this is already in the os-inputs workflow right?

Code quote:

os_input = ["apollo_committer_types/os_input", "starknet_committer/os_input"]

crates/apollo_committer/src/committer.rs line 511 at r8 (raw file):

            class_hashes.len(),
            contract_addresses.len()
        );

it would be nice to log

  1. state diff "size" (how many diffs in total, classes + storage leaves)
  2. "read set size"
  3. height
    currently you have height + partial read set size (no state diff size or number of storage leaves needed to be read)

Code quote:

        info!(
            "read_paths_and_commit_block: block {height} with {} class hashes, {} contract \
             addresses",
            class_hashes.len(),
            contract_addresses.len()
        );

crates/apollo_committer/src/committer.rs line 532 at r8 (raw file):

            }
            // Flow overview:
            // 1. Fetch patricia paths for the accessed keys

Suggestion:

// 1. Fetch patricia paths for the accessed keys.

crates/apollo_committer/src/committer.rs line 537 at r8 (raw file):

            // 3. Fetch patricia paths for the post-commit tries, via running step 1 against a two
            //    layer storage composed from the underlying storage and the modifications from 2.
            // 4. Merge the two sets of patricia paths and write the result to the storage.

this phase is done in "fact layout" mode, right? if we have two versions of the same node we will want both of them in the result

Code quote:

4. Merge the two sets of patricia paths and write the result to the storage.

crates/apollo_committer/src/committer.rs line 647 at r8 (raw file):

                })
            })
            .transpose()

what's this?

Code quote:

.transpose()

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 5 comments and resolved 1 discussion.
Reviewable status: 4 of 7 files reviewed, 5 unresolved discussions (waiting on dorimedini-starkware and yoavGrs).


crates/apollo_committer/Cargo.toml line 11 at r8 (raw file):

Previously, dorimedini-starkware wrote…

this is already in the os-inputs workflow right?

These are, just added apollo_committer too


crates/apollo_committer/src/committer.rs line 511 at r8 (raw file):

Previously, dorimedini-starkware wrote…

it would be nice to log

  1. state diff "size" (how many diffs in total, classes + storage leaves)
  2. "read set size"
  3. height
    currently you have height + partial read set size (no state diff size or number of storage leaves needed to be read)

Done.


crates/apollo_committer/src/committer.rs line 537 at r8 (raw file):

Previously, dorimedini-starkware wrote…

this phase is done in "fact layout" mode, right? if we have two versions of the same node we will want both of them in the result

yes, it's a merge of two maps from hash to preimage


crates/apollo_committer/src/committer.rs line 647 at r8 (raw file):

Previously, dorimedini-starkware wrote…

what's this?

Option -->Result


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

                accumulator
            },
        );

@dorimedini-starkware @yoavGrs the blockifier's accessed keys don't sit too well here, my signatures are induced from fetch_all_patricia_paths/fetch_patricia_paths, so I need another conversion here. I can either extract this to a function or revert to a different style of AccessedKeys.

Code quote:

        let class_hashes: Vec<_> = accessed_class_hashes.iter().copied().collect();
        let contract_addresses: Vec<_> = accessed_contracts.iter().copied().collect();
        let contract_storage_keys = storage_keys.iter().fold(
            HashMap::<ContractAddress, Vec<StarknetStorageKey>>::new(),
            |mut accumulator, (address, key)| {
                accumulator.entry(*address).or_default().push(StarknetStorageKey(*key));
                accumulator
            },
        );

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, 5 unresolved discussions (waiting on dorimedini-starkware and yoavGrs).


crates/apollo_committer/src/committer.rs line 647 at r8 (raw file):

Previously, ArielElp wrote…

Option -->Result

`Option<Result<T, E>>` → `Result<Option, E>`

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, 5 unresolved discussions (waiting on dorimedini-starkware and yoavGrs).


crates/apollo_committer/src/committer.rs line 647 at r8 (raw file):

Previously, ArielElp wrote…

`Option<Result<T, E>>` → `Result<Option, E>`

`Option<Result<T, E>>` → `Result<Option, E>`

Copy link
Copy Markdown
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 3 files and all commit messages, made 2 comments, and resolved 4 discussions.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on yoavGrs).


crates/apollo_committer/src/committer.rs line 647 at r8 (raw file):

Previously, ArielElp wrote…

`Option<Result<T, E>>` → `Result<Option, E>`

lol
my turn to try
Option<Result<T, E>>Result<Option<T>, E>


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

Previously, ArielElp wrote…

@dorimedini-starkware @yoavGrs the blockifier's accessed keys don't sit too well here, my signatures are induced from fetch_all_patricia_paths/fetch_patricia_paths, so I need another conversion here. I can either extract this to a function or revert to a different style of AccessedKeys.

@yoavGrs is AccessedKeys used anywhere else, other than DB serialization logic? Maybe better to change the types at the source

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


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

Previously, dorimedini-starkware wrote…

@yoavGrs is AccessedKeys used anywhere else, other than DB serialization logic? Maybe better to change the types at the source

It is used in the flow tests.
You can change the type, but a B-tree is sorted and does not allow duplicates.

Copy link
Copy Markdown
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

@dorimedini-starkware made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArielElp and yoavGrs).


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

Previously, yoavGrs wrote…

It is used in the flow tests.
You can change the type, but a B-tree is sorted and does not allow duplicates.

@ArielElp we already talked about using BTrees in the fetch-paths signatures, which will help your sorted-indices struct as well, right?
I suggest leaving the conversions as they are, and migrating to BTrees in a PR at the top of the stack. This will solve it, correct?

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: all files reviewed, 1 unresolved discussion (waiting on dorimedini-starkware and yoavGrs).


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

Previously, dorimedini-starkware wrote…

@ArielElp we already talked about using BTrees in the fetch-paths signatures, which will help your sorted-indices struct as well, right?
I suggest leaving the conversions as they are, and migrating to BTrees in a PR at the top of the stack. This will solve it, correct?

Looks doable, will add a PR.

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 1 discussion.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on ArielElp).

Copy link
Copy Markdown
Collaborator

@dorimedini-starkware dorimedini-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on ArielElp).

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.

4 participants