Skip to content

apollo_committer: add request_paths_and_commit_block tests#14208

Open
ArielElp wants to merge 1 commit into
ariel/revert_logicfrom
ariel/test_revert_flow_with_witnesses
Open

apollo_committer: add request_paths_and_commit_block tests#14208
ArielElp wants to merge 1 commit into
ariel/revert_logicfrom
ariel/test_revert_flow_with_witnesses

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 27, 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/test_revert_flow_with_witnesses branch from e720964 to 9c253a8 Compare May 27, 2026 09:45
@ArielElp ArielElp marked this pull request as ready for review May 27, 2026 11:05
@cursor
Copy link
Copy Markdown

cursor Bot commented May 27, 2026

PR Summary

Low Risk
Test-only changes and a gated IndexDb helper; no production committer or storage behavior changes.

Overview
Adds integration tests for read_paths_and_commit_block behind the os_input feature, wired from committer_test.rs into a new request_paths_and_commit_block_tests module.

The happy-path test commits a rich state diff with accessed vs unaccessed keys, checks returned Patricia proofs by re-fetching paths from witness preimages (classes, contracts, per-contract storage), then strips live trie nodes and replays the same request to assert idempotent global root and proofs from persisted witnesses. A second test covers revert_block clearing the witnesses digest and stored Patricia payload for that height.

Test-only support: dev-deps on starknet_committer (os_input, testing) and starknet_patricia; IndexDb::clear_patricia_trie_nodes_for_test retains metadata and witness keys while dropping Patricia node entries so replay cannot rely on trie storage.

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

@ArielElp ArielElp requested a review from yoavGrs May 27, 2026 11:17
@ArielElp ArielElp force-pushed the ariel/test_revert_flow_with_witnesses branch from 9c253a8 to 8a3d6fb Compare May 27, 2026 11:52
@ArielElp ArielElp force-pushed the ariel/revert_logic branch from 0a150fa to dcafcad Compare May 27, 2026 11:52
@ArielElp ArielElp force-pushed the ariel/test_revert_flow_with_witnesses branch from 8a3d6fb to b0c6beb Compare May 27, 2026 12:00
@ArielElp ArielElp force-pushed the ariel/revert_logic branch from dcafcad to 10d77f4 Compare May 27, 2026 12:00
@ArielElp ArielElp force-pushed the ariel/test_revert_flow_with_witnesses branch from b0c6beb to b87f87a Compare May 27, 2026 12:20
@ArielElp ArielElp force-pushed the ariel/revert_logic branch from 10d77f4 to bcf65f0 Compare May 27, 2026 12:20
@ArielElp ArielElp force-pushed the ariel/revert_logic branch from bcf65f0 to eb321de Compare May 27, 2026 12:24
@ArielElp ArielElp force-pushed the ariel/test_revert_flow_with_witnesses branch from b87f87a to 14140cc Compare May 27, 2026 12:24
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 3 files and made 5 comments.
Reviewable status: 1 of 5 files reviewed, 5 unresolved discussions (waiting on ArielElp).


a discussion (no related file):
Please split it into settings (block structure) and logic (verify functions) PRs.


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

}

fn accessed_keys() -> AccessedKeys {

Do the naming clearer - what are the block 0 settings, and what are the general constants.

Code quote:

fn accessed_keys()

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

            accessed_contract_2(),
            HashMap::from([(accessed_storage_key_2(), StarknetStorageValue(200_u128.into()))]),
        ),

Share the values with block_0_state_diff.
For testing theaccessed_storage_leaves, they should be connected to the committer input.

Code quote:

        (
            accessed_contract_1(),
            HashMap::from([(accessed_storage_key_1(), StarknetStorageValue(100_u128.into()))]),
        ),
        (
            accessed_contract_2(),
            HashMap::from([(accessed_storage_key_2(), StarknetStorageValue(200_u128.into()))]),
        ),

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

            contract_1 => indexmap! {
                accessed_storage_key_1().0 => 100_u128.into(),
                UNACCESSED_STORAGE_KEY.into() => 300_u128.into(),

The story of block 0 is broken - unacessed key in the state diff.

Code quote:

                accessed_storage_key_1().0 => 100_u128.into(),
                UNACCESSED_STORAGE_KEY.into() => 300_u128.into(),

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

        let mut storage = MapStorage(storage_map.clone());
        let sorted_leaf_indices = SortedLeafIndices::new(leaf_indices);
        let fetched = fetch_patricia_paths::<L, FactsNodeLayout>(

This needs some explanation. Just to make sure I understand, are you verifying that fetch_patricia_paths for indexes returns the same result for the facts layout?

If that's the core of the test, consider converting it to a more focused unit test.

Code quote:

fetch_patricia_paths::<L, FactsNodeLayout>

@ArielElp ArielElp force-pushed the ariel/test_revert_flow_with_witnesses branch from 14140cc to 7acc60b Compare May 27, 2026 14:31
@ArielElp ArielElp force-pushed the ariel/revert_logic branch from eb321de to 70a879c Compare May 27, 2026 14:31
@ArielElp ArielElp force-pushed the ariel/test_revert_flow_with_witnesses branch from 7acc60b to 473b445 Compare May 27, 2026 15:31
@ArielElp ArielElp force-pushed the ariel/revert_logic branch from 70a879c to 10f2f7d Compare May 27, 2026 15:31
@ArielElp ArielElp force-pushed the ariel/test_revert_flow_with_witnesses branch from 473b445 to 20c303b Compare May 27, 2026 15:47
@ArielElp ArielElp force-pushed the ariel/revert_logic branch from 10f2f7d to 061ae00 Compare May 27, 2026 15:47
@ArielElp ArielElp force-pushed the ariel/revert_logic branch from 061ae00 to f9899db Compare May 27, 2026 16:20
@ArielElp ArielElp force-pushed the ariel/test_revert_flow_with_witnesses branch from 20c303b to 4a2b243 Compare May 27, 2026 16:20
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