Skip to content

Commit

Permalink
refactor: use sierra compile function in casm compile
Browse files Browse the repository at this point in the history
  • Loading branch information
varex83 authored and rodrigo-pino committed Oct 21, 2024
1 parent 73af1c8 commit bbacfbf
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions crates/blockifier/src/test_utils/cairo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ pub fn cairo1_compile(
git_tag_override: Option<String>,
cargo_nightly_arg: Option<String>,
) -> Vec<u8> {
prepare_cairo1_compiler_deps(git_tag_override);
let cairo1_compiler_path = local_cairo1_compiler_repo_path();

// Command args common to both compilation phases.
Expand All @@ -121,18 +120,14 @@ pub fn cairo1_compile(
"--bin".into(),
];
// Add additional cargo arg if provided. Should be first arg (base command is `cargo`).
if let Some(nightly_version) = cargo_nightly_arg {
if let Some(ref nightly_version) = cargo_nightly_arg {
base_compile_args.insert(0, format!("+nightly-{nightly_version}"));
}

// Cairo -> Sierra.
let mut starknet_compile_commmand = Command::new("cargo");
starknet_compile_commmand.args(base_compile_args.clone());
starknet_compile_commmand.args(["starknet-compile", "--", "--single-file", &path]);
let sierra_output = run_and_verify_output(&mut starknet_compile_commmand);
let sierra_output = sierra_compile(path, git_tag_override, cargo_nightly_arg);

let mut temp_file = NamedTempFile::new().unwrap();
temp_file.write_all(&sierra_output.stdout).unwrap();
temp_file.write_all(&sierra_output).unwrap();
let temp_path_str = temp_file.into_temp_path();

// Sierra -> CASM.
Expand Down

0 comments on commit bbacfbf

Please sign in to comment.