File tree Expand file tree Collapse file tree 7 files changed +25
-1
lines changed
apollo_starknet_os_program
starknet_committer_and_os_cli Expand file tree Collapse file tree 7 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ description = "The source (Cairo) code of the Starknet OS."
99[lints ]
1010workspace = true
1111
12+ [features ]
13+ test_programs = []
14+
1215[dependencies ]
1316apollo_infra_utils.workspace = true
1417cairo-vm.workspace = true
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ async fn main() {
1010 let out_dir = PathBuf :: from ( std:: env:: var ( "OUT_DIR" ) . expect ( "OUT_DIR not set." ) ) ;
1111
1212 let mut task_set = tokio:: task:: JoinSet :: new ( ) ;
13+ #[ cfg( feature = "test_programs" ) ]
14+ task_set. spawn ( compile_test_contracts ( out_dir. clone ( ) ) ) ;
1315 task_set. spawn ( compile_and_output_program (
1416 out_dir. clone ( ) ,
1517 "starkware/starknet/core/os/os.cairo" ,
@@ -55,6 +57,17 @@ async fn compile_and_output_program(
5557 } ) ;
5658}
5759
60+ #[ cfg( feature = "test_programs" ) ]
61+ async fn compile_test_contracts ( out_dir : PathBuf ) {
62+ let mut task_set = tokio:: task:: JoinSet :: new ( ) ;
63+ task_set. spawn ( compile_and_output_program (
64+ out_dir,
65+ "starkware/starknet/core/os/state/aliases_test.cairo" ,
66+ "aliases_test" ,
67+ ) ) ;
68+ task_set. join_all ( ) . await ;
69+ }
70+
5871fn cairo_root_path ( ) -> PathBuf {
5972 PathBuf :: from ( compile_time_cargo_manifest_dir ! ( ) ) . join ( "src/cairo" )
6073}
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ use cairo_vm::types::program::Program;
66use crate :: program_hash:: { ProgramHash , PROGRAM_HASH_PATH } ;
77
88pub mod program_hash;
9+ #[ cfg( feature = "test_programs" ) ]
10+ pub mod test_programs;
911
1012pub const OS_PROGRAM_BYTES : & [ u8 ] = include_bytes ! ( concat!( env!( "OUT_DIR" ) , "/starknet_os_bytes" ) ) ;
1113pub const AGGREGATOR_PROGRAM_BYTES : & [ u8 ] =
Original file line number Diff line number Diff line change 1+ pub const ALIASES_TEST_BYTES : & [ u8 ] =
2+ include_bytes ! ( concat!( env!( "OUT_DIR" ) , "/aliases_test_bytes" ) ) ;
Original file line number Diff line number Diff line change @@ -18,7 +18,8 @@ tempfile.workspace = true
1818
1919# TODO(Amos): Add `testing` feature and move Python test dependencies under it.
2020[dependencies ]
21- apollo_starknet_os_program.workspace = true
21+ # `test_programs` feature should be moved under `testing` feature, when it exists.
22+ apollo_starknet_os_program = { workspace = true , features = [" test_programs" ] }
2223cairo-lang-starknet-classes.workspace = true
2324cairo-vm.workspace = true
2425# Should be moved under `testing` feature, when it exists.
Original file line number Diff line number Diff line change 11use std:: fs;
22use std:: path:: Path ;
33
4+ use apollo_starknet_os_program:: test_programs:: ALIASES_TEST_BYTES ;
45use apollo_starknet_os_program:: { AGGREGATOR_PROGRAM_BYTES , OS_PROGRAM_BYTES , PROGRAM_HASH } ;
56use cairo_lang_starknet_classes:: casm_contract_class:: CasmContractClass ;
67use cairo_vm:: types:: layout_name:: LayoutName ;
@@ -105,6 +106,7 @@ pub(crate) fn serialize_os_runner_output(
105106pub ( crate ) fn dump_program ( output_path : String , program : ProgramToDump ) {
106107 let bytes = match program {
107108 ProgramToDump :: Aggregator => AGGREGATOR_PROGRAM_BYTES ,
109+ ProgramToDump :: AliasesTest => ALIASES_TEST_BYTES ,
108110 ProgramToDump :: Os => OS_PROGRAM_BYTES ,
109111 } ;
110112 // Dumping the `Program` struct won't work - it is not deserializable via cairo-lang's Program
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ pub struct OsCliCommand {
2020#[ serde( rename_all = "kebab-case" ) ]
2121pub enum ProgramToDump {
2222 Aggregator ,
23+ AliasesTest ,
2324 Os ,
2425}
2526
You can’t perform that action at this time.
0 commit comments