Skip to content

starknet_os: validate_builtins function #8724

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

Open
wants to merge 1 commit into
base: main-v0.14.1
Choose a base branch
from

Conversation

Yonatan-Starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@Yonatan-Starkware Yonatan-Starkware force-pushed the yonatank/os/validate_builtins_function branch from dc6bbb8 to 72f4030 Compare August 20, 2025 14:12
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.

Please open a py side PR to make sure all python OS related tests pass this validation.

@nimrod-starkware reviewed 1 of 2 files at r1.
Reviewable status: 1 of 2 files reviewed, 3 unresolved discussions (waiting on @meship-starkware)


crates/starknet_os/src/test_utils.rs line 13 at r1 (raw file):

    let builtins_end = runner.vm.get_ap();
    assert_eq!((builtins_start + n_builtins).unwrap(), builtins_end);
}

Please move this to the utils.rs module.

Code quote:

#[cfg(any(test, feature = "testing"))]
use cairo_vm::vm::runners::cairo_runner::CairoRunner;
pub(crate) fn validate_builtins(runner: &mut CairoRunner) {
    let builtins_start = runner.get_builtins_final_stack(runner.vm.get_ap()).unwrap();
    let n_builtins = runner.get_program().builtins_len();
    let builtins_end = runner.vm.get_ap();
    assert_eq!((builtins_start + n_builtins).unwrap(), builtins_end);
}

crates/starknet_os/src/runner.rs line 33 at r1 (raw file):

use crate::metrics::OsMetrics;
#[cfg(any(test, feature = "testing"))]
use crate::test_utils::validate_builtins;

remove and use the full path in the function


crates/starknet_os/src/runner.rs line 225 at r1 (raw file):

    )?;

    validate_builtins(&mut runner_output.cairo_runner);

our convention is not to gate imports under feature flags, but use the full path instead

Suggestion:

crate::test_utils::validate_builtins(&mut runner_output.cairo_runner);

Copy link
Collaborator

@meship-starkware meship-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meship-starkware reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @Yonatan-Starkware)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants