-
Notifications
You must be signed in to change notification settings - Fork 52
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
feat(starknet_os): os_logger: implement ResourceCounter::new #5279
Conversation
f7f26d0
to
faec2fa
Compare
6f587d2
to
6003270
Compare
faec2fa
to
1518237
Compare
6003270
to
fe4e96d
Compare
1518237
to
fb2aa4d
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, 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()))?
fe4e96d
to
51b25fb
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, 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 hitclippy::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
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 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
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, 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 useok_or_else
for heavier computations
Done.
51b25fb
to
57bcca9
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 2 files reviewed, all discussions resolved (waiting on @meship-starkware and @Yoni-Starkware)
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 r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @meship-starkware and @Yoni-Starkware)
No description provided.