Skip to content

feat(starknet_os): os_logger: implement ResourceCounter::new #5279

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

dorimedini-starkware
Copy link
Collaborator

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@dorimedini-starkware dorimedini-starkware self-assigned this Mar 25, 2025
@dorimedini-starkware dorimedini-starkware marked this pull request as ready for review March 25, 2025 17:29
@dorimedini-starkware dorimedini-starkware force-pushed the 03-25-feat_starknet_os_os_logger_implement_transactiontrace branch from f7f26d0 to faec2fa Compare March 25, 2025 19:39
@dorimedini-starkware dorimedini-starkware force-pushed the 03-25-feat_starknet_os_os_logger_implement_resourcecounter_new branch from 6f587d2 to 6003270 Compare March 25, 2025 19:39
@dorimedini-starkware dorimedini-starkware force-pushed the 03-25-feat_starknet_os_os_logger_implement_transactiontrace branch from faec2fa to 1518237 Compare March 25, 2025 20:13
@dorimedini-starkware dorimedini-starkware force-pushed the 03-25-feat_starknet_os_os_logger_implement_resourcecounter_new branch from 6003270 to fe4e96d Compare March 25, 2025 20:13
@dorimedini-starkware dorimedini-starkware force-pushed the 03-25-feat_starknet_os_os_logger_implement_transactiontrace branch from 1518237 to fb2aa4d Compare March 26, 2025 09:23
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 2 files reviewed, 4 unresolved discussions (waiting on @meship-starkware and @Yoni-Starkware)


crates/starknet_os/src/hint_processor/os_logger.rs line 197 at r1 (raw file):

            ap_tracking,
            os_program,
        )?;

WDYT of passing the cairo struct and the field name instead of the selected flag? do you hit clippy::too_many_args?

Code quote:

        // The `BuiltinPointers` struct has two fields: selectable and non-selectable builtins.
        Self::insert_builtins(true, &mut builtin_ptrs_dict, ids_data, vm, ap_tracking, os_program)?;
        Self::insert_builtins(
            false,
            &mut builtin_ptrs_dict,
            ids_data,
            vm,
            ap_tracking,
            os_program,
        )?;

crates/starknet_os/src/hint_processor/os_logger.rs line 216 at r1 (raw file):

        };

        // We want all pointers except `segment_arena` and `sha256`.

move it next to excluded_builtins definition please


crates/starknet_os/src/hint_processor/os_logger.rs line 228 at r1 (raw file):

            if member_name == "segment_arena" || member_name == "sha256" {
                continue;
            }

Suggestion:

        // We want all pointers except `segment_arena` and `sha256`
        let excluded_builtins = ["segment_arena", "sha256"];
        for member_name in inner_members.keys() {
            if excluded_builtins.contains(member_name) {
                continue;
            }

crates/starknet_os/src/hint_processor/os_logger.rs line 241 at r1 (raw file):

            builtin_ptrs_dict.insert(
                BuiltinName::from_str(member_name)
                    .ok_or(OsLoggerError::UnknownBuiltin(member_name.clone()))?,

Suggestion:

.ok_or_else(|| OsLoggerError::UnknownBuiltin(member_name.clone()))?

@dorimedini-starkware dorimedini-starkware force-pushed the 03-25-feat_starknet_os_os_logger_implement_resourcecounter_new branch from fe4e96d to 51b25fb Compare March 26, 2025 10:06
@dorimedini-starkware dorimedini-starkware changed the base branch from 03-25-feat_starknet_os_os_logger_implement_transactiontrace to main March 26, 2025 10:06
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.

Reviewable status: 0 of 2 files reviewed, 4 unresolved discussions (waiting on @meship-starkware, @nimrod-starkware, and @Yoni-Starkware)


crates/starknet_os/src/hint_processor/os_logger.rs line 197 at r1 (raw file):

Previously, nimrod-starkware wrote…

WDYT of passing the cairo struct and the field name instead of the selected flag? do you hit clippy::too_many_args?

Done.


crates/starknet_os/src/hint_processor/os_logger.rs line 216 at r1 (raw file):

Previously, nimrod-starkware wrote…

move it next to excluded_builtins definition please

Done.


crates/starknet_os/src/hint_processor/os_logger.rs line 228 at r1 (raw file):

            if member_name == "segment_arena" || member_name == "sha256" {
                continue;
            }

Done.


crates/starknet_os/src/hint_processor/os_logger.rs line 241 at r1 (raw file):

            builtin_ptrs_dict.insert(
                BuiltinName::from_str(member_name)
                    .ok_or(OsLoggerError::UnknownBuiltin(member_name.clone()))?,

this is to only clone on error? nice

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 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dorimedini-starkware, @meship-starkware, and @Yoni-Starkware)


crates/starknet_os/src/hint_processor/os_logger.rs line 241 at r1 (raw file):

Previously, dorimedini-starkware wrote…

this is to only clone on error? nice

yes, ok_or always evaluates. so it's better to use ok_or_else for heavier computations

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.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @meship-starkware, @nimrod-starkware, and @Yoni-Starkware)


crates/starknet_os/src/hint_processor/os_logger.rs line 241 at r1 (raw file):

Previously, nimrod-starkware wrote…

yes, ok_or always evaluates. so it's better to use ok_or_else for heavier computations

Done.

@dorimedini-starkware dorimedini-starkware force-pushed the 03-25-feat_starknet_os_os_logger_implement_resourcecounter_new branch from 51b25fb to 57bcca9 Compare March 26, 2025 11:01
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:

Reviewable status: 1 of 2 files reviewed, all discussions resolved (waiting on @meship-starkware and @Yoni-Starkware)

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.

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @meship-starkware and @Yoni-Starkware)

@dorimedini-starkware dorimedini-starkware added this pull request to the merge queue Mar 26, 2025
Merged via the queue into main with commit bc76f31 Mar 26, 2025
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 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