Skip to content

starknet_committer: fetch patricia paths concurrently#14283

Merged
ArielElp merged 1 commit into
mainfrom
ariel/fetch_storage_witnesses_concurrently
Jun 8, 2026
Merged

starknet_committer: fetch patricia paths concurrently#14283
ArielElp merged 1 commit into
mainfrom
ariel/fetch_storage_witnesses_concurrently

Conversation

@ArielElp

@ArielElp ArielElp commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

@ArielElp ArielElp force-pushed the ariel/split_read_paths_to_sequential_and_concurrent branch from 9c26b8a to a4fcb4e Compare June 1, 2026 08:41
@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 5bf8dad to 2aae8b5 Compare June 1, 2026 08:41
@ArielElp ArielElp marked this pull request as ready for review June 1, 2026 11:35
@cursor

cursor Bot commented Jun 1, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes the block committer’s Patricia proof read path (witness data for commitments); logic is intended to be equivalent between sequential and concurrent modes, but concurrency in storage reads can surface ordering or storage-layer edge cases.

Overview
Patricia witness collection for contract storage tries now goes through fetch_contract_storage_paths, which uses GatherableStorage::gather to fetch per-contract storage proofs in parallel when the DB layer supports it, and falls back to the same sequential loop otherwise.

fetch_all_patricia_paths is refactored: classes/contracts paths are fetched in fetch_classes_and_contracts_patricia_paths, storage proofs are delegated to trie traversal, and the final StarknetForestProofs value is assembled via a new StarknetForestProofs::build helper (moving leaf NodeIndexContractAddress conversion out of tree.rs). #[allow(dead_code)] is removed from the storage-path fetch helpers now that they are wired in.

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

@ArielElp ArielElp requested a review from yoavGrs June 1, 2026 12:40
@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 2aae8b5 to 98f02f2 Compare June 2, 2026 11:57
@ArielElp ArielElp force-pushed the ariel/split_read_paths_to_sequential_and_concurrent branch from a4fcb4e to 2cabcf1 Compare June 2, 2026 11:57
@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 98f02f2 to a0bcaf0 Compare June 2, 2026 12:08
@ArielElp ArielElp force-pushed the ariel/split_read_paths_to_sequential_and_concurrent branch 2 times, most recently from 98cfa3b to f629d46 Compare June 2, 2026 13:54
@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from a0bcaf0 to 9d1f3ef Compare June 2, 2026 13:54
@ArielElp ArielElp force-pushed the ariel/split_read_paths_to_sequential_and_concurrent branch from f629d46 to 6475f21 Compare June 2, 2026 16:02
@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 9d1f3ef to 43195e6 Compare June 2, 2026 16:02
@ArielElp ArielElp force-pushed the ariel/split_read_paths_to_sequential_and_concurrent branch from 6475f21 to 7b965ad Compare June 2, 2026 17:21
@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 43195e6 to 2feeb16 Compare June 2, 2026 17:21
@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 693fb7e to 135a50b Compare June 3, 2026 15:17
@ArielElp ArielElp force-pushed the ariel/split_read_paths_to_sequential_and_concurrent branch from d2b2be9 to b1d7747 Compare June 3, 2026 15:52
@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 135a50b to 738a1da Compare June 3, 2026 15:52

@yoavGrs yoavGrs left a comment

Copy link
Copy Markdown
Contributor

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

@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 738a1da to 8c279e8 Compare June 7, 2026 07:57
@ArielElp ArielElp force-pushed the ariel/split_read_paths_to_sequential_and_concurrent branch from b1d7747 to 101a813 Compare June 7, 2026 07:57

@dorimedini-starkware dorimedini-starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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


crates/starknet_committer/src/patricia_merkle_tree/tree.rs line 255 at r2 (raw file):

        contracts_trie_storage_proofs,
    }
}

non-blocking, but seems like this would look better as StarknetForestProofs::build(..). this is just a data conversion method so not important

Code quote:

fn build_starknet_forest_proofs<Layout>(
    classes_trie_proof: PreimageMap,
    contracts_proof_nodes: PreimageMap,
    contract_leaves: HashMap<NodeIndex, Layout::ContractStateDbLeaf>,
    contracts_trie_storage_proofs: HashMap<ContractAddress, PreimageMap>,
) -> StarknetForestProofs
where
    Layout: DbLayout,
    Layout::ContractStateDbLeaf: Into<ContractState>,
{
    // Convert contract_leaves_data keys from NodeIndex to ContractAddress.
    let contract_leaves_data: HashMap<ContractAddress, ContractState> = contract_leaves
        .into_iter()
        .map(|(idx, contract_state_leaf)| {
            (
        
                try_node_index_into_contract_address(&idx).unwrap_or_else(|_| {
                    panic!(
                        "Converting leaf NodeIndex to ContractAddress should succeed; failed to \
                         convert {idx:?}."
                    )
                }),
                contract_state_leaf.into(),
            )
        })
        .collect();

    StarknetForestProofs {
        classes_trie_proof,
        contracts_trie_proof: ContractsTrieProof {
            nodes: contracts_proof_nodes,
            leaves: contract_leaves_data,
        },
        contracts_trie_storage_proofs,
    }
}

@ArielElp ArielElp force-pushed the ariel/split_read_paths_to_sequential_and_concurrent branch from 101a813 to 376f97c Compare June 7, 2026 12:09
@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 8c279e8 to aa41958 Compare June 7, 2026 12:09

@dorimedini-starkware dorimedini-starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 2 files and all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArielElp).

@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from aa41958 to 72fa99e Compare June 7, 2026 12:17
@ArielElp ArielElp force-pushed the ariel/split_read_paths_to_sequential_and_concurrent branch from 376f97c to 8f1abbf Compare June 7, 2026 12:17

@dorimedini-starkware dorimedini-starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 1 file and all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArielElp).

@graphite-app graphite-app Bot changed the base branch from ariel/split_read_paths_to_sequential_and_concurrent to graphite-base/14283 June 8, 2026 12:40
@ArielElp

ArielElp commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@dorimedini-starkware Good call — moved the conversion logic to StarknetForestProofs::build in types.rs and updated the call site in tree.rs.

@ArielElp ArielElp left a comment

Copy link
Copy Markdown
Contributor Author

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


crates/starknet_committer/src/patricia_merkle_tree/tree.rs line 255 at r2 (raw file):

Previously, dorimedini-starkware wrote…

non-blocking, but seems like this would look better as StarknetForestProofs::build(..). this is just a data conversion method so not important

Done

@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 72fa99e to 5cd04c2 Compare June 8, 2026 12:49
@ArielElp ArielElp force-pushed the graphite-base/14283 branch from 8f1abbf to 3cbe5fb Compare June 8, 2026 12:49
@ArielElp ArielElp changed the base branch from graphite-base/14283 to ariel/split_read_paths_to_sequential_and_concurrent June 8, 2026 12:49

@dorimedini-starkware dorimedini-starkware left a comment

Copy link
Copy Markdown
Collaborator

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

@ArielElp ArielElp changed the base branch from ariel/split_read_paths_to_sequential_and_concurrent to graphite-base/14283 June 8, 2026 13:05
@ArielElp ArielElp force-pushed the graphite-base/14283 branch from 3cbe5fb to 39fe75d Compare June 8, 2026 14:09
@ArielElp ArielElp force-pushed the ariel/fetch_storage_witnesses_concurrently branch from 5cd04c2 to da2c6d9 Compare June 8, 2026 14:09
@ArielElp ArielElp changed the base branch from graphite-base/14283 to main June 8, 2026 14:09

@dorimedini-starkware dorimedini-starkware left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@dorimedini-starkware reviewed 1 file and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on ArielElp).

@ArielElp ArielElp added this pull request to the merge queue Jun 8, 2026
Merged via the queue into main with commit 4ce4b63 Jun 8, 2026
45 of 77 checks passed
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