Skip to content

Commit

Permalink
feat: use the regualr dependnacies to import the install the starknet…
Browse files Browse the repository at this point in the history
…-sierra-compile crate
  • Loading branch information
ArniStarkware committed Sep 8, 2024
1 parent c77fb53 commit 7305cce
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 121 deletions.
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ simple_logger = "4.0.0"
starknet-core = "0.6.0"
starknet-crypto = "0.5.1"
starknet-types-core = "0.1.5"
starknet-sierra-compile = "2.7.0"
starknet_api = { path = "crates/starknet_api", version = "0.0.0" }
starknet_batcher = { path = "crates/batcher", version = "0.0.0" }
starknet_batcher_types = { path = "crates/batcher_types", version = "0.0.0" }
Expand Down
3 changes: 0 additions & 3 deletions crates/gateway/build.rs

This file was deleted.

1 change: 1 addition & 0 deletions crates/starknet_sierra_compile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ version.workspace = true
workspace = true

[dependencies]
starknet-sierra-compile.workspace = true
cairo-lang-sierra.workspace = true
cairo-lang-starknet-classes.workspace = true
cairo-lang-utils.workspace = true
Expand Down
81 changes: 0 additions & 81 deletions crates/starknet_sierra_compile/build.rs

This file was deleted.

28 changes: 0 additions & 28 deletions crates/starknet_sierra_compile/src/build_utils.rs

This file was deleted.

12 changes: 7 additions & 5 deletions crates/starknet_sierra_compile/src/command_line_compiler.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
use std::io::Write;
use std::path::PathBuf;
use std::process::Command;

use cairo_lang_starknet_classes::casm_contract_class::CasmContractClass;
use cairo_lang_starknet_classes::contract_class::ContractClass;
use tempfile::NamedTempFile;

use crate::build_utils::binary_path;
use crate::config::SierraToCasmCompilationConfig;
use crate::errors::CompilationUtilError;
use crate::SierraToCasmCompiler;

#[derive(Clone)]
pub struct CommandLineCompiler {
pub config: SierraToCasmCompilationConfig,
path_to_starknet_sierra_compile_binary: PathBuf,
path_to_starknet_sierra_compile_binary: String,
}

impl CommandLineCompiler {
pub fn new(config: SierraToCasmCompilationConfig) -> Self {
Self { config, path_to_starknet_sierra_compile_binary: binary_path() }
Self { config, path_to_starknet_sierra_compile_binary: new_binary_path() }
}
}

fn new_binary_path() -> String {
"starknet-sierra-compile".to_owned()
}

impl SierraToCasmCompiler for CommandLineCompiler {
fn compile(
&self,
Expand All @@ -39,7 +41,7 @@ impl SierraToCasmCompiler for CommandLineCompiler {

// Set the parameters for the compile process.
// TODO(Arni): Setup the ulimit for the process.
let mut command = Command::new(self.path_to_starknet_sierra_compile_binary.as_os_str());
let mut command = Command::new(&self.path_to_starknet_sierra_compile_binary);
command.args([
temp_file_path,
"--add-pythonic-hints",
Expand Down
1 change: 0 additions & 1 deletion crates/starknet_sierra_compile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use cairo_lang_starknet_classes::contract_class::ContractClass;

use crate::errors::CompilationUtilError;

pub mod build_utils;
pub mod cairo_lang_compiler;
pub mod command_line_compiler;
pub mod config;
Expand Down
3 changes: 0 additions & 3 deletions crates/tests-integration/build.rs

This file was deleted.

0 comments on commit 7305cce

Please sign in to comment.