Skip to content

apollo_committer: test new edge bottom in witnesses#14388

Open
ArielElp wants to merge 1 commit into
graphite-base/14388from
ariel/test_edge_case
Open

apollo_committer: test new edge bottom in witnesses#14388
ArielElp wants to merge 1 commit into
graphite-base/14388from
ariel/test_edge_case

Conversation

@ArielElp

@ArielElp ArielElp commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

ArielElp commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

@ArielElp ArielElp marked this pull request as ready for review June 4, 2026 11:02
@cursor

cursor Bot commented Jun 4, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Test-only change with no production or witness logic modifications.

Overview
Adds a regression test in request_paths_and_commit_block_tests.rs for Patricia witness generation when a class leaf is removed via read_paths_and_commit_block.

The scenario commits three class leaves (left pair A/B and rightmost D), then deletes D while requesting witnesses only for that key. It asserts classes_trie_proof includes the hash of inner node E (the binary parent of A and B)—the bottom of a new edge into an otherwise unchanged subtree.

Supporting imports only: PATRICIA_KEY_UPPER_BOUND_FELT for the rightmost key, plus BinaryData / NodeData to compute E’s expected node hash.

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

@ArielElp ArielElp requested a review from yoavGrs June 4, 2026 11:02

@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 made 2 comments.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on ArielElp).


a discussion (no related file):
Can you reuse utils in crates/starknet_committer/src/forest/deleted_nodes_test.rs?


crates/apollo_committer/src/request_paths_and_commit_block_tests.rs line 484 at r1 (raw file):

        response.patricia_proofs.classes_trie_proof.contains_key(&edge_tree_node_e_hash),
        "missing bottom of a new edge node in a proof",
    );

Use your new storage proof verification?

Code quote:

    assert!(
        response.patricia_proofs.classes_trie_proof.contains_key(&edge_tree_node_e_hash),
        "missing bottom of a new edge node in a proof",
    );

@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 2 comments.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on yoavGrs).


a discussion (no related file):

Previously, yoavGrs wrote…

Can you reuse utils in crates/starknet_committer/src/forest/deleted_nodes_test.rs?

Hhhmm doesn't look like it, in addition to being a bit higher level on ApolloCommitter it's testing different things. I don't really care about the deleted nodes on the right side.


crates/apollo_committer/src/request_paths_and_commit_block_tests.rs line 484 at r1 (raw file):

Previously, yoavGrs wrote…

Use your new storage proof verification?

To what leaf? I think the point here is that this case does not add "full paths" to the proof.

@ArielElp ArielElp force-pushed the ariel/test_revert_flow_with_witnesses branch from 651ab0e to efb1efd Compare June 7, 2026 12:22
@ArielElp ArielElp force-pushed the ariel/test_edge_case branch from 852520b to b8f5eef Compare June 7, 2026 12:22

@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 made 1 comment and resolved 2 discussions.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on ArielElp).


crates/apollo_committer/src/request_paths_and_commit_block_tests.rs line 421 at r1 (raw file):

    let class_hash_a = ClassHash(0_u64.into());
    let class_hash_b = ClassHash(1_u64.into());
    let class_hash_d = ClassHash(PATRICIA_KEY_UPPER_BOUND_FELT - 1_u64);

Please add another case where this key is 3 or 4:

  1. To match the illustration.
  2. In this case, the proof should contain a and b, right?

Code quote:

PATRICIA_KEY_UPPER_BOUND_FELT - 1_u64

@ArielElp ArielElp force-pushed the ariel/test_edge_case branch from b8f5eef to 66c20f8 Compare June 7, 2026 14:39
@ArielElp ArielElp force-pushed the ariel/test_revert_flow_with_witnesses branch from efb1efd to 1a70b65 Compare June 7, 2026 14:39
@graphite-app graphite-app Bot changed the base branch from ariel/test_revert_flow_with_witnesses to graphite-base/14388 June 8, 2026 14:02
@ArielElp ArielElp force-pushed the graphite-base/14388 branch from 1a70b65 to 91077f1 Compare June 8, 2026 14:40
@ArielElp ArielElp force-pushed the ariel/test_edge_case branch from 66c20f8 to 523092c Compare June 8, 2026 14:40

@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 2 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on ArielElp).


crates/apollo_committer/src/request_paths_and_commit_block_tests.rs line 383 at r3 (raw file):

/// 2. Commit block 1 via [crate::committer::Committer::read_paths_and_commit_block], deleting `D`
///    and requesting witnesses only for the deleted key.
/// 3. Assert the returned classes-trie proof contains node `E`.

we actually need A and B here as well, to prove E is binary when converting R to an edge from R to E

Code quote:

Assert the returned classes-trie proof contains node `E`.

crates/apollo_committer/src/request_paths_and_commit_block_tests.rs line 452 at r3 (raw file):

        response.patricia_proofs.classes_trie_proof.contains_key(&edge_tree_node_e_hash),
        "missing bottom of a new edge node in a proof",
    );

also assert leaf_a_hash and leaf_b_hash

Code quote:

    assert!(
        response.patricia_proofs.classes_trie_proof.contains_key(&edge_tree_node_e_hash),
        "missing bottom of a new edge node in a proof",
    );

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