Skip to content

Conversation

@ArielElp
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

ArielElp commented Dec 10, 2025

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

@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from 021132a to 466fffe Compare December 10, 2025 11:26
@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from 466fffe to b4ed9c6 Compare December 10, 2025 13:16
@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from b4ed9c6 to c700f80 Compare December 10, 2025 14:20
@ArielElp ArielElp force-pushed the abstract_node_data branch 2 times, most recently from c7ceea5 to f9be917 Compare December 10, 2025 15:06
@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from c700f80 to 745b6d9 Compare December 10, 2025 15:06
@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from 745b6d9 to d1214e3 Compare December 10, 2025 15:35
@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from d1214e3 to a4c64e9 Compare December 10, 2025 15:41
@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from a4c64e9 to ad38e50 Compare December 10, 2025 15:53
@ArielElp ArielElp changed the base branch from abstract_node_data to graphite-base/10680 December 10, 2025 19:46
@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from ad38e50 to b24fb64 Compare December 10, 2025 19:58
@ArielElp ArielElp force-pushed the graphite-base/10680 branch from e1719c0 to 68f6987 Compare December 10, 2025 19:58
@ArielElp ArielElp changed the base branch from graphite-base/10680 to abstract_node_data December 10, 2025 19:58
@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from b24fb64 to 71c316b Compare December 11, 2025 06:51
Copy link
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, made 2 comments, and resolved 4 discussions.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArielElp and @nimrod-starkware).


crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 273 at r9 (raw file):

Previously, ArielElp wrote…

Diverged even further, ptal at handle_unmodified_subtree

I missed the meaning of the call to get_bottom_subtree.
I guess this function is non-trivial and involves heavy computation as well.


crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 262 at r12 (raw file):

    if let NodeData::Edge(EdgeData { bottom_data, path_to_bottom }) = filled_root.data {
        // Even if a subtree rooted at an edge node is umodified, we still need an

Suggestion:

unmodified

Copy link
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 and resolved 1 discussion.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @ArielElp and @nimrod-starkware).


crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 262 at r12 (raw file):

    if let NodeData::Edge(EdgeData { bottom_data, path_to_bottom }) = filled_root.data {
        // Even if a subtree rooted at an edge node is umodified, we still need an

Edge case :)

Copy link
Contributor

@nimrod-starkware nimrod-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

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

Copy link
Contributor

@nimrod-starkware nimrod-starkware left a comment

Choose a reason for hiding this comment

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

please open py side

@nimrod-starkware made 1 comment.
Reviewable status: 13 of 14 files reviewed, 2 unresolved discussions (waiting on @ArielElp, @dorimedini-starkware, and @yoavGrs).

Copy link
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.

yes, py side please :)

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


crates/starknet_committer/src/db/facts_db/db.rs line 46 at r13 (raw file):

use crate::patricia_merkle_tree::types::CompiledClassHash;

pub struct FactsNodeLayout {}

docstring describing the storage scheme in high-level?
or is there a more natural location for this doc?

Code quote:

pub struct FactsNodeLayout {}

crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 64 at r13 (raw file):

    L: Leaf,
    Layout: NodeLayout<'a, L>,
    FilledNode<L, Layout::NodeData>: DBObject<DeserializeContext = Layout::DeserializationContext>,

hmmmm don't you have

impl<L: Leaf, Layout: NodeLayout> DBObject<DeserializeContext = Layout::DeserializationContext> for FilledNode<L, Layout::NodeData>

that prevents the need for this bound?

Code quote:

FilledNode<L, Layout::NodeData>: DBObject<DeserializeContext = Layout::DeserializationContext>

crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 70 at r13 (raw file):

    let should_fetch_modified_leaves =
        config.compare_modified_leaves() || previous_leaves.is_some();
    while !current_subtrees.is_empty() {

this swap is technically a logic change that should be in a separate PR, because I had to scan to make sure that previous_leaves is not mutated inside the loop. I see it isn't, so ok, but try to keep this in mind when creating PRs

Code quote:

    let should_fetch_modified_leaves =
        config.compare_modified_leaves() || previous_leaves.is_some();
    while !current_subtrees.is_empty() {

crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 254 at r13 (raw file):

    subtree: SubTree,
) where
    SubTree::NodeData: Copy,

please be explicit when a copy is needed

Suggestion:

SubTree::NodeData: Clone,

crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 282 at r13 (raw file):

            .nodes
            .insert(root_index, OriginalSkeletonNode::UnmodifiedSubTree(filled_root.hash));
    }
  1. please use an explicit match on the three options of filled_root.data, instead of if let .. else
  2. previously, an unmodified leaf just triggered a warning; now, you seem to be pushing it to the skeleton tree. why?

Code quote:

    if let NodeData::Edge(EdgeData { bottom_data, path_to_bottom }) = filled_root.data {
        // Even if a subtree rooted at an edge node is unmodified, we still need an
        // `OriginalSkeletonNode::Edge` node in the skeleton in case we need to manipulate it later
        // (e.g. unify the edge node with an ancestor edge node).
        skeleton_tree.nodes.insert(root_index, OriginalSkeletonNode::Edge(path_to_bottom));
        match SubTree::should_traverse_unmodified_child(bottom_data) {
            UnmodifiedChildTraversal::Traverse => {
                let (bottom_subtree, _) = subtree.get_bottom_subtree(&path_to_bottom, bottom_data);
                next_subtrees.push(bottom_subtree);
            }
            UnmodifiedChildTraversal::Skip(unmodified_child_hash) => {
                skeleton_tree.nodes.insert(
                    path_to_bottom.bottom_index(root_index),
                    OriginalSkeletonNode::UnmodifiedSubTree(unmodified_child_hash),
                );
            }
        }
    } else {
        skeleton_tree
            .nodes
            .insert(root_index, OriginalSkeletonNode::UnmodifiedSubTree(filled_root.hash));
    }

crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 295 at r13 (raw file):

) {
    let is_leaf = subtree.is_leaf();
    let is_modified = !subtree.is_unmodified();

are either of these used more than once? seems like a redundant definition

Code quote:

    let is_leaf = subtree.is_leaf();
    let is_modified = !subtree.is_unmodified();

crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 309 at r13 (raw file):

        }
        return;
    }

this entire block of logic is basically equivalent to the if we had before - please revert the "unrolling" so it's easier to see the diff

Suggestion:

    let is_modified = !subtree.is_unmodified();
    if !subtree.is_leaf() || (should_fetch_modified_leaves && is_modified) {
        next_subtrees.push(subtree);
    } else if !is_modified {
        match SubTree..
    }

Copy link
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 6 comments and resolved 2 discussions.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @dorimedini-starkware).


crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 64 at r13 (raw file):

Previously, dorimedini-starkware wrote…

hmmmm don't you have

impl<L: Leaf, Layout: NodeLayout> DBObject<DeserializeContext = Layout::DeserializationContext> for FilledNode<L, Layout::NodeData>

that prevents the need for this bound?

There is a constraint on the layout trait, hence using it requires satisfying the constraint here.

FWIW, the FilledTree part of the stack adds an associated NodeDbObject: DbObject to the layout trait, so these requirements may be unnecessary then.


crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 254 at r13 (raw file):

Previously, dorimedini-starkware wrote…

please be explicit when a copy is needed

WDYM?

Clone indeed allows more freedom, but in practice our types here are () and HashOutput, both copyable. If I require Clone, then bottom_data will need to be cloned in:

match SubTree::should_traverse_unmodified_child(bottom_data.clone()) {

crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 282 at r13 (raw file):

Previously, dorimedini-starkware wrote…
  1. please use an explicit match on the three options of filled_root.data, instead of if let .. else
  2. previously, an unmodified leaf just triggered a warning; now, you seem to be pushing it to the skeleton tree. why?
  1. Done
  2. This is related to the last case of handle_child_subtree.

Before: an unmodified leaf was always added to the skeleton upon encountering its parent, it was never traversed itself (hence the "unexpected" warning)
Now: when we traverse unmodified children, we will go through this leaf in the main loop, so it's no longer unexpected.


crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 295 at r13 (raw file):

Previously, dorimedini-starkware wrote…

are either of these used more than once? seems like a redundant definition

No, they're there for clarity

is_modified was Yoav's suggestion IIRC to make the control flow more clear. IMO it does make it more clear (no "not unmodified" in the if condition).

is_leaf is less important so removed


crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 309 at r13 (raw file):

Previously, dorimedini-starkware wrote…

this entire block of logic is basically equivalent to the if we had before - please revert the "unrolling" so it's easier to see the diff

Slight pushback: I think the control flow is much clearer now

Internal --> traverse
Modified --> if should_fetch_modified_leaves then traverse
Unmodified --> new logic


crates/starknet_committer/src/db/facts_db/db.rs line 46 at r13 (raw file):

Previously, dorimedini-starkware wrote…

docstring describing the storage scheme in high-level?
or is there a more natural location for this doc?

Done, this is probably the most reasonable place

Copy link
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.

python side successful
https://github.com/starkware-industries/starkware/pull/39782

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

@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from f08a6b1 to 7851196 Compare December 23, 2025 13:00
Copy link
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.

WOOP!

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


crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 254 at r13 (raw file):

Previously, ArielElp wrote…

WDYM?

Clone indeed allows more freedom, but in practice our types here are () and HashOutput, both copyable. If I require Clone, then bottom_data will need to be cloned in:

match SubTree::should_traverse_unmodified_child(bottom_data.clone()) {

that's good IMO, it's the same just explicit; when data is copied I'd like to know


crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 309 at r13 (raw file):

Previously, ArielElp wrote…

Slight pushback: I think the control flow is much clearer now

Internal --> traverse
Modified --> if should_fetch_modified_leaves then traverse
Unmodified --> new logic

kibalti

@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from 7851196 to 97e5941 Compare December 23, 2025 15:26
Copy link
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: 12 of 14 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware and @yoavGrs).


crates/starknet_committer/src/db/facts_db/create_facts_tree.rs line 254 at r13 (raw file):

Previously, dorimedini-starkware wrote…

that's good IMO, it's the same just explicit; when data is copied I'd like to know

Done, note that I also changed the constraint in the layout so there are a couple more clones in this file.

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

Copy link
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.

:lgtm:

@dorimedini-starkware made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ArielElp).

@ArielElp ArielElp force-pushed the ariel/abstract_fetch_nodes branch from 97e5941 to a49bbd1 Compare December 24, 2025 08:50
Copy link
Contributor

@nimrod-starkware nimrod-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

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

Copy link
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 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 Dec 24, 2025
Merged via the queue into main-v0.14.1-committer with commit 8db2e84 Dec 24, 2025
18 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants