Skip to content

starknet_os_flow_tests: fuzz test panic scenario#12967

Merged
dorimedini-starkware merged 1 commit intomain-v0.14.2from
03-01-starknet_os_flow_tests_fuzz_test_panic_scenario
Mar 9, 2026
Merged

starknet_os_flow_tests: fuzz test panic scenario#12967
dorimedini-starkware merged 1 commit intomain-v0.14.2from
03-01-starknet_os_flow_tests_fuzz_test_panic_scenario

Conversation

@dorimedini-starkware
Copy link
Collaborator

@dorimedini-starkware dorimedini-starkware commented Mar 2, 2026

Note

Low Risk
Changes are confined to blockifier_test_utils fuzz-test contracts and regenerated compiled fixtures; they shouldn’t affect production logic, but can alter flow-test expectations if the new panic/index semantics are incorrect.

Overview
Adds a new SCENARIO_PANIC to the fuzz-revert feature contracts so the flow tests can exercise uncatchable panics (Cairo0) and explicit panic_with_felt252 behavior (Cairo1).

For Cairo1, this introduces orchestrator get_index/set_index APIs plus shared internal helpers (orchestrator() and handle_error_catch) so failed call_contract/library_call scenarios can optionally unwrap or, when caught, restore the orchestrator’s scenario index that would otherwise be reverted by the inner panic.

Regenerates the corresponding compiled Cairo0/Cairo1 artifacts (*.json/*.casm.json) to reflect the new scenario and control-flow changes.

Written by Cursor Bugbot for commit 07749a0. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator Author

dorimedini-starkware commented Mar 2, 2026

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

@dorimedini-starkware dorimedini-starkware force-pushed the 03-01-starknet_os_flow_tests_fuzz_test_enter_exit_call branch from 01da34e to 5c0e455 Compare March 2, 2026 18:36
@dorimedini-starkware dorimedini-starkware force-pushed the 03-01-starknet_os_flow_tests_fuzz_test_panic_scenario branch 2 times, most recently from 16a121d to 87749de Compare March 2, 2026 19:19
@dorimedini-starkware dorimedini-starkware force-pushed the 03-01-starknet_os_flow_tests_fuzz_test_enter_exit_call branch 2 times, most recently from 47c6516 to cbf8e66 Compare March 3, 2026 11:10
@dorimedini-starkware dorimedini-starkware force-pushed the 03-01-starknet_os_flow_tests_fuzz_test_panic_scenario branch 2 times, most recently from 6d20d2b to cd09b3e Compare March 3, 2026 20:52
@dorimedini-starkware dorimedini-starkware force-pushed the 03-01-starknet_os_flow_tests_fuzz_test_enter_exit_call branch from cbf8e66 to b08c35d Compare March 3, 2026 20:52
@dorimedini-starkware dorimedini-starkware force-pushed the 03-01-starknet_os_flow_tests_fuzz_test_panic_scenario branch from cd09b3e to d3e3c0b Compare March 4, 2026 07:39
Copy link
Collaborator

@Yoni-Starkware Yoni-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:

@Yoni-Starkware reviewed 13 files and all commit messages, and made 4 comments.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on dorimedini-starkware).


crates/blockifier_test_utils/resources/feature_contracts/cairo1/fuzz_revert.cairo line 83 at r2 (raw file):

        if scenario == SCENARIO_CALL {
            let contract_address: ContractAddress = orchestrator.pop_front().try_into().unwrap();
            let should_unwrap = orchestrator.pop_front();

cast to bool

Code quote:

let should_unwrap = orchestrator.pop_front();

crates/blockifier_test_utils/resources/feature_contracts/cairo1/fuzz_revert.cairo line 100 at r2 (raw file):

                class_hash, FUZZ_TEST_SELECTOR, array![].span()
            );
            if should_unwrap_with != 0 {

Be consistent

Suggestion:

should_unwrap

crates/blockifier_test_utils/resources/feature_contracts/cairo1/fuzz_revert.cairo line 104 at r2 (raw file):

            } else {
                self.handle_error_catch(orchestrator, result);
            }

Move inside handle_error_catch?

Code quote:

            if should_unwrap_with != 0 {
                result.unwrap_syscall();
            } else {
                self.handle_error_catch(orchestrator, result);
            }

@dorimedini-starkware dorimedini-starkware force-pushed the 03-01-starknet_os_flow_tests_fuzz_test_panic_scenario branch from 27bf044 to c7f3a0b Compare March 9, 2026 13:31
Copy link
Collaborator Author

@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 resolved 3 discussions.
Reviewable status: 9 of 13 files reviewed, all discussions resolved (waiting on Yoni-Starkware).

@dorimedini-starkware dorimedini-starkware force-pushed the 03-01-starknet_os_flow_tests_fuzz_test_panic_scenario branch from c7f3a0b to bb590df Compare March 9, 2026 14:49
@dorimedini-starkware dorimedini-starkware changed the base branch from graphite-base/12967 to main-v0.14.2 March 9, 2026 14:49
@dorimedini-starkware dorimedini-starkware force-pushed the 03-01-starknet_os_flow_tests_fuzz_test_panic_scenario branch from bb590df to 07749a0 Compare March 9, 2026 14:56
Copy link
Collaborator Author

@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 8 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on dorimedini-starkware).

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.

3 participants