11use std:: array;
22use std:: collections:: HashMap ;
33
4+ use apollo_starknet_os_program:: OS_PROGRAM_BYTES ;
45use cairo_vm:: types:: builtin_name:: BuiltinName ;
56use cairo_vm:: types:: layout_name:: LayoutName ;
67use cairo_vm:: types:: program:: Program ;
@@ -32,20 +33,21 @@ use crate::shared_utils::types::PythonTestError;
3233
3334const REDUCED_MUL_LIMB_BOUND : i128 = 2_i128 . pow ( 104 ) ;
3435
36+ // TODO(Nimrod): Move this to the starknet_os crate and run it directly.
3537#[ allow( clippy:: result_large_err) ]
36- pub ( crate ) fn test_bls_field ( input : & str ) -> OsPythonTestResult {
38+ pub ( crate ) fn test_bls_field ( ) -> OsPythonTestResult {
3739 info ! ( "Testing `test_bigint3_to_uint256`..." ) ;
38- test_bigint3_to_uint256 ( input ) ?;
40+ test_bigint3_to_uint256 ( ) ?;
3941 info ! ( "Testing `test_felt_to_bigint3`..." ) ;
40- test_felt_to_bigint3 ( input ) ?;
42+ test_felt_to_bigint3 ( ) ?;
4143 info ! ( "Testing `test_horner_eval`..." ) ;
42- test_horner_eval ( input ) ?;
44+ test_horner_eval ( ) ?;
4345 info ! ( "Testing `test_reduced_mul_random`..." ) ;
44- test_reduced_mul_random ( input ) ?;
46+ test_reduced_mul_random ( ) ?;
4547 info ! ( "Testing `test_reduced_mul_parameterized`..." ) ;
46- test_reduced_mul_parameterized ( input ) ?;
48+ test_reduced_mul_parameterized ( ) ?;
4749 info ! ( "Testing `test_bls_prime_value`..." ) ;
48- test_bls_prime_value ( input ) ?;
50+ test_bls_prime_value ( ) ?;
4951 Ok ( "" . to_string ( ) )
5052}
5153
@@ -58,7 +60,7 @@ fn get_entrypoint_runner_config() -> EntryPointRunnerConfig {
5860}
5961
6062#[ allow( clippy:: result_large_err) ]
61- fn run_reduced_mul_test ( input : & str , a_split : & [ Felt ] , b_split : & [ Felt ] ) -> OsPythonTestResult {
63+ fn run_reduced_mul_test ( a_split : & [ Felt ] , b_split : & [ Felt ] ) -> OsPythonTestResult {
6264 let explicit_args = [
6365 EndpointArg :: Value ( ValueArg :: Array ( a_split. to_vec ( ) ) ) ,
6466 EndpointArg :: Value ( ValueArg :: Array ( b_split. to_vec ( ) ) ) ,
@@ -72,7 +74,7 @@ fn run_reduced_mul_test(input: &str, a_split: &[Felt], b_split: &[Felt]) -> OsPy
7274 let expected_explicit_args = [ EndpointArg :: Value ( ValueArg :: Array ( expected_result. to_vec ( ) ) ) ] ;
7375 test_cairo_function (
7476 & get_entrypoint_runner_config ( ) ,
75- input ,
77+ OS_PROGRAM_BYTES ,
7678 "starkware.starknet.core.os.data_availability.bls_field.reduced_mul" ,
7779 & explicit_args,
7880 & implicit_args,
@@ -84,7 +86,7 @@ fn run_reduced_mul_test(input: &str, a_split: &[Felt], b_split: &[Felt]) -> OsPy
8486}
8587
8688#[ allow( clippy:: result_large_err) ]
87- fn test_bigint3_to_uint256 ( input : & str ) -> OsPythonTestResult {
89+ fn test_bigint3_to_uint256 ( ) -> OsPythonTestResult {
8890 let mut rng = seeded_random_prng ( ) ;
8991 let random_u256_big_uint: BigUint = rng. sample ( RandomBits :: new ( 256 ) ) ;
9092 let random_u256_bigint = BigInt :: from_biguint ( Sign :: Plus , random_u256_big_uint) ;
@@ -104,7 +106,7 @@ fn test_bigint3_to_uint256(input: &str) -> OsPythonTestResult {
104106 let entrypoint_runner_config = get_entrypoint_runner_config ( ) ;
105107 test_cairo_function (
106108 & entrypoint_runner_config,
107- input ,
109+ OS_PROGRAM_BYTES ,
108110 "starkware.starknet.core.os.data_availability.bls_field.bigint3_to_uint256" ,
109111 & explicit_args,
110112 & implicit_args,
@@ -116,7 +118,7 @@ fn test_bigint3_to_uint256(input: &str) -> OsPythonTestResult {
116118}
117119
118120#[ allow( clippy:: result_large_err) ]
119- fn test_felt_to_bigint3 ( input : & str ) -> OsPythonTestResult {
121+ fn test_felt_to_bigint3 ( ) -> OsPythonTestResult {
120122 let values: [ BigInt ; 9 ] = [
121123 0 . into ( ) ,
122124 1 . into ( ) ,
@@ -140,7 +142,7 @@ fn test_felt_to_bigint3(input: &str) -> OsPythonTestResult {
140142
141143 test_cairo_function (
142144 & entrypoint_runner_config,
143- input ,
145+ OS_PROGRAM_BYTES ,
144146 "starkware.starknet.core.os.data_availability.bls_field.felt_to_bigint3" ,
145147 & explicit_args,
146148 & implicit_args,
@@ -153,7 +155,7 @@ fn test_felt_to_bigint3(input: &str) -> OsPythonTestResult {
153155}
154156
155157#[ allow( clippy:: result_large_err) ]
156- fn test_horner_eval ( input : & str ) -> OsPythonTestResult {
158+ fn test_horner_eval ( ) -> OsPythonTestResult {
157159 let mut rng = seeded_random_prng ( ) ;
158160 let entrypoint_runner_config = get_entrypoint_runner_config ( ) ;
159161
@@ -175,7 +177,7 @@ fn test_horner_eval(input: &str) -> OsPythonTestResult {
175177
176178 let ( _, explicit_retdata, _) = run_cairo_0_entry_point (
177179 & entrypoint_runner_config,
178- input ,
180+ OS_PROGRAM_BYTES ,
179181 "starkware.starknet.core.os.data_availability.bls_field.horner_eval" ,
180182 & explicit_args,
181183 & implicit_args,
@@ -237,7 +239,7 @@ fn test_horner_eval(input: &str) -> OsPythonTestResult {
237239
238240#[ allow( dead_code) ]
239241#[ allow( clippy:: result_large_err) ]
240- fn test_reduced_mul_random ( input : & str ) -> OsPythonTestResult {
242+ fn test_reduced_mul_random ( ) -> OsPythonTestResult {
241243 // Generate a,b in (-REDUCED_MUL_LIMB_LIMIT, REDUCED_MUL_LIMB_LIMIT).
242244 let mut rng = seeded_random_prng ( ) ;
243245 let a_split = ( 0 ..3 )
@@ -247,12 +249,12 @@ fn test_reduced_mul_random(input: &str) -> OsPythonTestResult {
247249 . map ( |_| rng. gen_range ( -REDUCED_MUL_LIMB_BOUND + 1 ..REDUCED_MUL_LIMB_BOUND ) . into ( ) )
248250 . collect :: < Vec < Felt > > ( ) ;
249251
250- run_reduced_mul_test ( input , & a_split, & b_split)
252+ run_reduced_mul_test ( & a_split, & b_split)
251253}
252254
253255#[ allow( dead_code) ]
254256#[ allow( clippy:: result_large_err) ]
255- fn test_reduced_mul_parameterized ( input : & str ) -> OsPythonTestResult {
257+ fn test_reduced_mul_parameterized ( ) -> OsPythonTestResult {
256258 let max_value = Felt :: from ( REDUCED_MUL_LIMB_BOUND - 1 ) ;
257259 let min_value = Felt :: from ( -REDUCED_MUL_LIMB_BOUND + 1 ) ;
258260 let values: [ ( [ Felt ; 3 ] , [ Felt ; 3 ] ) ; 4 ] = [
@@ -263,16 +265,16 @@ fn test_reduced_mul_parameterized(input: &str) -> OsPythonTestResult {
263265 ] ;
264266 for ( a_split, b_split) in values {
265267 info ! ( "Testing `reduced_mul` with a = {a_split:?}, b = {b_split:?}" ) ;
266- run_reduced_mul_test ( input , & a_split, & b_split) ?;
268+ run_reduced_mul_test ( & a_split, & b_split) ?;
267269 }
268270
269271 Ok ( "" . to_string ( ) )
270272}
271273
272274#[ allow( clippy:: result_large_err) ]
273- fn test_bls_prime_value ( input : & str ) -> OsPythonTestResult {
275+ fn test_bls_prime_value ( ) -> OsPythonTestResult {
274276 let entrypoint = None ;
275- let program = Program :: from_bytes ( input . as_bytes ( ) , entrypoint) . unwrap ( ) ;
277+ let program = Program :: from_bytes ( OS_PROGRAM_BYTES , entrypoint) . unwrap ( ) ;
276278 let actual_split_bls_prime: [ Felt ; 3 ] = array:: from_fn ( |i| {
277279 * program
278280 . constants
0 commit comments