-
Notifications
You must be signed in to change notification settings - Fork 35
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
Artifacts upload workflows: |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
fb91f70
to
c477fc8
Compare
There was a problem hiding this 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:?}");
c477fc8
to
a89711e
Compare
There was a problem hiding this 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 theambiguous_strings
computation will be a union of three pairwise-intersections...
Got a bit tangled with it.
There was a problem hiding this 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);
…uivalence with blockifier
a89711e
to
f090765
Compare
There was a problem hiding this 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
andhint_extension_strings_set
, but not insyscall_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...
There was a problem hiding this 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 r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @TzahiTaub)
No description provided.