-
Notifications
You must be signed in to change notification settings - Fork 58
feat(starknet_os): implement load deprecated class inner hint #5108
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): implement load deprecated class inner hint #5108
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
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: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @yoavGrs)
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 50 at r2 (raw file):
pub(crate) fn load_deprecated_class_inner<S: StateReader>( HintArgs { hint_processor, vm, exec_scopes, ids_data, ap_tracking, .. }: HintArgs<'_, S>,
Suggestion:
hint_processor, vm, exec_scopes, ids_data, ap_tracking, constants, ..
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 53 at r2 (raw file):
) -> OsHintResult { let deprecated_class_iter = exec_scopes .get_mut_ref::<IntoIter<Felt, ContractClass>>(Scope::CompiledClassFacts.into())?;
right?
Suggestion:
ClassHash
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 59 at r2 (raw file):
exec_scopes.insert_value(Scope::CompiledClassHash.into(), class_hash); // TODO(Rotem): see if we can avoid cloning here. exec_scopes.insert_value(Scope::CompiledClass.into(), deprecated_class.clone());
Please look at the cairo code and see if that insertion is needed. I suspect that only this hint needs the var compiled_class
to use it as an arg for get\_deprecated\_contract\_class\_struct
Code quote:
exec_scopes.insert_value(Scope::CompiledClass.into(), deprecated_class.clone());
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 63 at r2 (raw file):
let dep_class_base = vm.add_memory_segment(); let dep_class_version: &str = Const::DeprecatedCompiledClassVersion.into(); let constants = HashMap::from([(String::from(dep_class_version), Felt::from(0))]);
you should use the constants var in HintArgs
:)
Code quote:
let dep_class_version: &str = Const::DeprecatedCompiledClassVersion.into();
let constants = HashMap::from([(String::from(dep_class_version), Felt::from(0))]);
48b17bb
to
ba6bdd6
Compare
482e397
to
b688aad
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: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @nimrod-starkware and @yoavGrs)
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 53 at r2 (raw file):
Previously, nimrod-starkware wrote…
right?
Done.
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 59 at r2 (raw file):
Previously, nimrod-starkware wrote…
Please look at the cairo code and see if that insertion is needed. I suspect that only this hint needs the var
compiled_class
to use it as an arg forget\_deprecated\_contract\_class\_struct
It is used in the hint load_deprecated_class
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 63 at r2 (raw file):
Previously, nimrod-starkware wrote…
you should use the constants var in
HintArgs
:)
Done.
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 50 at r2 (raw file):
pub(crate) fn load_deprecated_class_inner<S: StateReader>( HintArgs { hint_processor, vm, exec_scopes, ids_data, ap_tracking, .. }: HintArgs<'_, S>,
Done.
ba6bdd6
to
02b172b
Compare
b688aad
to
33638e3
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 1 of 1 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @yoavGrs)
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: all files reviewed, 2 unresolved discussions (waiting on @rotem-starkware)
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 54 at r3 (raw file):
.get_mut_ref::<IntoIter<Felt252, GenericDeprecatedCompiledClass>>(vars::scopes::COMPILED_CLASS_FACTS)?; let (class_hash, deprecated_class) = deprecated_class_iter.next().unwrap();
Return Err
. Something like OsHintError::EndOfIterator(deprecated_class)
?
Code quote:
.unwrap()
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 58 at r4 (raw file):
exec_scopes.insert_value(Scope::CompiledClassHash.into(), class_hash); // TODO(Rotem): see if we can avoid cloning here.
Why about moving this insertion after the 'load_into'?
Code quote:
// TODO(Rotem): see if we can avoid cloning here.
02b172b
to
1dded4a
Compare
33638e3
to
cb7c0f3
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: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @nimrod-starkware and @yoavGrs)
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 54 at r3 (raw file):
Previously, yoavGrs wrote…
Return
Err
. Something likeOsHintError::EndOfIterator(deprecated_class)
?
Done.
crates/starknet_os/src/hints/hint_implementation/deprecated_compiled_class/implementation.rs
line 58 at r4 (raw file):
Previously, yoavGrs wrote…
Why about moving this insertion after the 'load_into'?
Done.
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 r6, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @rotem-starkware)
…on from moonsong's repo
1dded4a
to
5b64f99
Compare
cb7c0f3
to
8ac7a18
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 2 of 2 files at r8, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @rotem-starkware)
feat(starknet_os): copy load_deprecated_class_inner hint implementation from moonsong's repo
feat(starknet_os): implement load deprecated class inner hint