Skip to content

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

Conversation

rotem-starkware
Copy link
Contributor

feat(starknet_os): copy load_deprecated_class_inner hint implementation from moonsong's repo

feat(starknet_os): implement load deprecated class inner hint

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

rotem-starkware commented Mar 20, 2025

Copy link
Contributor

@nimrod-starkware nimrod-starkware 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: 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))]);

@rotem-starkware rotem-starkware force-pushed the rotem/hints/deprecated_compiled_class/load_into_deprecated_contract_class branch from 48b17bb to ba6bdd6 Compare March 23, 2025 08:35
@rotem-starkware rotem-starkware force-pushed the rotem/hints/deprecated_compiled_class/load_deprecated_class_inner branch from 482e397 to b688aad Compare March 23, 2025 08:35
Copy link
Contributor Author

@rotem-starkware rotem-starkware 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: 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 for get\_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.

@rotem-starkware rotem-starkware changed the base branch from rotem/hints/deprecated_compiled_class/load_into_deprecated_contract_class to graphite-base/5108 March 23, 2025 08:42
@rotem-starkware rotem-starkware force-pushed the rotem/hints/deprecated_compiled_class/load_deprecated_class_inner branch from b688aad to 33638e3 Compare March 23, 2025 08:50
@rotem-starkware rotem-starkware changed the base branch from graphite-base/5108 to rotem/hints/deprecated_compiled_class/load_into_deprecated_contract_class March 23, 2025 08:50
Copy link
Contributor

@nimrod-starkware nimrod-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 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @yoavGrs)

Copy link
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.

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.

@rotem-starkware rotem-starkware force-pushed the rotem/hints/deprecated_compiled_class/load_into_deprecated_contract_class branch from 02b172b to 1dded4a Compare March 23, 2025 13:15
@rotem-starkware rotem-starkware force-pushed the rotem/hints/deprecated_compiled_class/load_deprecated_class_inner branch from 33638e3 to cb7c0f3 Compare March 23, 2025 13:15
Copy link
Contributor Author

@rotem-starkware rotem-starkware 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: 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 like OsHintError::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.

@rotem-starkware rotem-starkware changed the title feat(starknet_os): copy load_deprecated_class_inner hint implementation from moonsong's repo feat(starknet_os): implement load deprecated class inner hint Mar 23, 2025
Copy link
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.

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

@rotem-starkware rotem-starkware changed the base branch from rotem/hints/deprecated_compiled_class/load_into_deprecated_contract_class to graphite-base/5108 March 23, 2025 14:35
@rotem-starkware rotem-starkware force-pushed the rotem/hints/deprecated_compiled_class/load_deprecated_class_inner branch from cb7c0f3 to 8ac7a18 Compare March 23, 2025 15:27
@rotem-starkware rotem-starkware changed the base branch from graphite-base/5108 to rotem/hints/deprecated_compiled_class/load_into_deprecated_contract_class March 23, 2025 15:27
Copy link
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.

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

@rotem-starkware rotem-starkware changed the base branch from rotem/hints/deprecated_compiled_class/load_into_deprecated_contract_class to main March 23, 2025 15:55
@rotem-starkware rotem-starkware added this pull request to the merge queue Mar 23, 2025
Merged via the queue into main with commit 121c7e0 Mar 23, 2025
16 of 23 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 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.

4 participants