-
Notifications
You must be signed in to change notification settings - Fork 65
starknet_os: run tests directly #7675
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
starknet_os: run tests directly #7675
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
nimrod-starkware
left a comment
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.
py side:
https://reviewable.io/reviews/starkware-industries/starkware/38487
Reviewable status: 0 of 9 files reviewed, all discussions resolved (waiting on @amosStarkware and @dorimedini-starkware)
dorimedini-starkware
left a comment
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 9 of 9 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @amosStarkware)
crates/starknet_os/src/tests/bls_field.rs line 128 at r1 (raw file):
); } }
use rstest's #[values] attribute instead of a for loop
Suggestion:
#[rstest]
fn test_felt_to_bigint3(
#[values(
0.into(),
1.into(),
DEFAULT_PRIME.clone() - 1,
DEFAULT_PRIME.clone() - 2,
BASE.clone() - 1,
BASE.clone(),
BASE.pow(2_u32) - 1,
BASE.pow(2_u32),
DEFAULT_PRIME.clone() / 2
)] value: BigInt) {
let entrypoint_runner_config = get_entrypoint_runner_config();
let explicit_args: [EndpointArg; 1] = [Felt::from(value.clone()).into()];
let implicit_args = [ImplicitArg::Builtin(BuiltinName::range_check)];
let split_value = split_bigint3(value.clone()).unwrap();
let expected_explicit_args = [EndpointArg::Value(ValueArg::Array(split_value.to_vec()))];
let n_range_checks = if value == DEFAULT_PRIME.clone() - 1 { 0 } else { 6 };
let expected_implicit_args: [EndpointArg; 1] = [n_range_checks.into()];
test_cairo_function(
&entrypoint_runner_config,
OS_PROGRAM_BYTES,
"starkware.starknet.core.os.data_availability.bls_field.felt_to_bigint3",
&explicit_args,
&implicit_args,
&expected_explicit_args,
&expected_implicit_args,
HashMap::new(),
);
}
}crates/starknet_os/src/test_utils/utils.rs line 0 at r1 (raw file):
code here was only moved from the deleted utils module, right?
crates/starknet_os/Cargo.toml line 19 at r1 (raw file):
[dependencies] apollo_starknet_os_program = { workspace = true, features = ["test_programs"] }
remove - this shouldn't be part of business logic.
if you need it because the testing feature needs it, you can activate the feature from the testing feature directly:
testing = ["blockifier/testing", "starknet_patricia/testing", "apollo_starknet_os_program/test_programs"]
crates/starknet_os/Cargo.toml line 36 at r1 (raw file):
] } derive_more.workspace = true ethnum.workspace = true
- make it optional - it's not needed in business logic
- activate it in the
testingfeature:
testing = ["blockifier/testing", "starknet_patricia/testing", "ethnum"]
Suggestion:
ethnum = { workspace = true, optional = true }crates/starknet_os/Cargo.toml line 45 at r1 (raw file):
papyrus_common.workspace = true paste.workspace = true rand.workspace = true
same as ethnum (make optional)
Code quote:
rand.workspace = truecrates/starknet_os/src/lib.rs line 11 at r1 (raw file):
pub mod test_utils; #[cfg(any(test, feature = "testing"))] pub(crate) mod tests;
- why do you need the
testingfeature here, and not justcfg(test)? are there test utils in these modules? - will you split this module and move the tests into their respective directories?
starknet_os/src/testsis a bit too general for aliases and BLS tests, they should be next to their respective hint impl modules
Code quote:
#[cfg(any(test, feature = "testing"))]
pub(crate) mod tests;60073ba to
ab9acfb
Compare
9edf3b1 to
10d933a
Compare
nimrod-starkware
left a comment
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, 5 unresolved discussions (waiting on @amosStarkware and @dorimedini-starkware)
crates/starknet_os/Cargo.toml line 19 at r1 (raw file):
Previously, dorimedini-starkware wrote…
remove - this shouldn't be part of business logic.
if you need it because thetestingfeature needs it, you can activate the feature from the testing feature directly:testing = ["blockifier/testing", "starknet_patricia/testing", "apollo_starknet_os_program/test_programs"]
Done.
crates/starknet_os/Cargo.toml line 36 at r1 (raw file):
Previously, dorimedini-starkware wrote…
- make it optional - it's not needed in business logic
- activate it in the
testingfeature:testing = ["blockifier/testing", "starknet_patricia/testing", "ethnum"]
Done.
crates/starknet_os/Cargo.toml line 45 at r1 (raw file):
Previously, dorimedini-starkware wrote…
same as
ethnum(make optional)
Done.
crates/starknet_os/src/lib.rs line 11 at r1 (raw file):
Previously, dorimedini-starkware wrote…
- why do you need the
testingfeature here, and not justcfg(test)? are there test utils in these modules?- will you split this module and move the tests into their respective directories?
starknet_os/src/testsis a bit too general for aliases and BLS tests, they should be next to their respective hint impl modules
- Done
- Added todos
crates/starknet_os/src/test_utils/utils.rs line at r1 (raw file):
Previously, dorimedini-starkware wrote…
code here was only moved from the deleted
utilsmodule, right?
yes
crates/starknet_os/src/tests/bls_field.rs line 128 at r1 (raw file):
Previously, dorimedini-starkware wrote…
use
rstest's#[values]attribute instead of aforloop
Done.
ab9acfb to
d07b00f
Compare
dorimedini-starkware
left a comment
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 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @amosStarkware and @nimrod-starkware)
crates/starknet_os/src/lib.rs line 11 at r1 (raw file):
Previously, nimrod-starkware wrote…
- Done
- Added todos
ok, now that this module is only cfg(test), you can delete ethnum and rand from [dependencies] (only needed in [dev-dependencies]); + remove them from the testing list.
also, you can remove apollo_starknet_os_program/test_programs
d07b00f to
8c182da
Compare
nimrod-starkware
left a comment
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 @amosStarkware and @dorimedini-starkware)
crates/starknet_os/src/lib.rs line 11 at r1 (raw file):
Previously, dorimedini-starkware wrote…
ok, now that this module is only
cfg(test), you can deleteethnumandrandfrom[dependencies](only needed in[dev-dependencies]); + remove them from thetestinglist.
also, you can removeapollo_starknet_os_program/test_programs
Done
|
Benchmark movements: No major performance changes detected. |
dorimedini-starkware
left a comment
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 3 of 3 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @amosStarkware)
8c182da to
5202af2
Compare
dorimedini-starkware
left a comment
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 r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @amosStarkware)

No description provided.