Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(starknet_os): split Hint to OsHint and syscall + test syscall equivalence with blockifier #4038

Conversation

TzahiTaub
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Feb 9, 2025

Artifacts upload workflows:

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

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

@TzahiTaub TzahiTaub marked this pull request as ready for review February 9, 2025 13:00
@TzahiTaub TzahiTaub force-pushed the 02-09-feat_starknet_os_split_hint_to_oshint_and_syscall_test_syscall_equivalence_with_blockifier branch from fb91f70 to c477fc8 Compare February 9, 2025 13:11
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.

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @TzahiTaub)


crates/starknet_os/src/hints/enum_definition.rs line 198 at r1 (raw file):

define_hint_enum!(
    Syscall,

let's be clear here; especially since in Cairo1 there are many syscalls but only one hint

Suggestion:

SyscallHint

crates/starknet_os/src/hints/enum_definition_test.rs line 24 at r1 (raw file):

    let ambiguous_strings =
        hint_strings_set.intersection(&hint_extension_strings_set).collect::<Vec<_>>();
    assert!(ambiguous_strings.is_empty(), "Ambiguous hint strings: {ambiguous_strings:?}");

you are now missing coverage for uniqueness here - add the Syscall enum.
note that now the ambiguous_strings computation will be a union of three pairwise-intersections...

Code quote:

    let hint_strings = OsHint::iter().map(|hint| hint.to_str()).collect::<Vec<_>>();
    let hint_extension_strings =
        HintExtension::iter().map(|hint| hint.to_str()).collect::<Vec<_>>();
    let hint_strings_set: HashSet<&&str> = HashSet::from_iter(hint_strings.iter());
    let hint_extension_strings_set = HashSet::from_iter(hint_extension_strings.iter());
    assert_eq!(hint_strings.len(), hint_strings_set.len(), "Duplicate hint strings.");
    assert_eq!(
        hint_extension_strings.len(),
        hint_extension_strings_set.len(),
        "Duplicate hint extension strings."
    );
    let ambiguous_strings =
        hint_strings_set.intersection(&hint_extension_strings_set).collect::<Vec<_>>();
    assert!(ambiguous_strings.is_empty(), "Ambiguous hint strings: {ambiguous_strings:?}");

@TzahiTaub TzahiTaub force-pushed the 02-09-feat_starknet_os_split_hint_to_oshint_and_syscall_test_syscall_equivalence_with_blockifier branch from c477fc8 to a89711e Compare February 9, 2025 15:27
Copy link
Contributor Author

@TzahiTaub TzahiTaub left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @dorimedini-starkware)


crates/starknet_os/src/hints/enum_definition.rs line 198 at r1 (raw file):

Previously, dorimedini-starkware wrote…

let's be clear here; especially since in Cairo1 there are many syscalls but only one hint

Done.


crates/starknet_os/src/hints/enum_definition_test.rs line 24 at r1 (raw file):

Previously, dorimedini-starkware wrote…

you are now missing coverage for uniqueness here - add the Syscall enum.
note that now the ambiguous_strings computation will be a union of three pairwise-intersections...

Got a bit tangled with it.

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.

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @TzahiTaub)


crates/starknet_os/src/hints/enum_definition_test.rs line 32 at r2 (raw file):

    let first_intersection =
        hint_strings_set.intersection(&hint_extension_strings_set).cloned().collect::<HashSet<_>>();
    let mut ambiguous_strings = first_intersection.intersection(&syscall_hint_strings_set);

umm... if there is a duplicate string in hint_strings_set and hint_extension_strings_set, but not in syscall_hint_strings_set, then you won't find it... right?

Code quote:

    let first_intersection =
        hint_strings_set.intersection(&hint_extension_strings_set).cloned().collect::<HashSet<_>>();
    let mut ambiguous_strings = first_intersection.intersection(&syscall_hint_strings_set);

@TzahiTaub TzahiTaub force-pushed the 02-09-feat_starknet_os_split_hint_to_oshint_and_syscall_test_syscall_equivalence_with_blockifier branch from a89711e to f090765 Compare February 9, 2025 15:57
Copy link
Contributor Author

@TzahiTaub TzahiTaub left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 3 files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware)


crates/starknet_os/src/hints/enum_definition_test.rs line 32 at r2 (raw file):

Previously, dorimedini-starkware wrote…

umm... if there is a duplicate string in hint_strings_set and hint_extension_strings_set, but not in syscall_hint_strings_set, then you won't find it... right?

Yes, but what are the chances?
BTW, the new variation found an error in the above syscall_hints definition...

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:

Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @TzahiTaub)

@TzahiTaub TzahiTaub added this pull request to the merge queue Feb 9, 2025
Merged via the queue into main with commit 54470ee Feb 9, 2025
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 11, 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.

3 participants