Skip to content

Commit

Permalink
refactor(gateway): delete CairoLangSierraToCasmCompiler (#2228)
Browse files Browse the repository at this point in the history
No longer in use, we compile using CLI.
This is a leftover of an earlier design (depending on the compiler in
`Cargo.toml`, which ended up being less favorable.
  • Loading branch information
elintul authored Nov 24, 2024
1 parent 2450cca commit 29f5d16
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 62 deletions.
6 changes: 0 additions & 6 deletions crates/starknet_gateway/src/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use cairo_lang_starknet_classes::contract_class::ContractClass as CairoLangContr
use starknet_api::contract_class::{ClassInfo, ContractClass};
use starknet_api::rpc_transaction::RpcDeclareTransaction;
use starknet_gateway_types::errors::GatewaySpecError;
use starknet_sierra_compile::cairo_lang_compiler::CairoLangSierraToCasmCompiler;
use starknet_sierra_compile::command_line_compiler::CommandLineCompiler;
use starknet_sierra_compile::config::SierraToCasmCompilationConfig;
use starknet_sierra_compile::utils::into_contract_class_for_compilation;
Expand All @@ -29,11 +28,6 @@ impl GatewayCompiler {
Self { sierra_to_casm_compiler: Arc::new(CommandLineCompiler::new(config)) }
}

// TODO(Arni): Cosider deleting `CairoLangSierraToCasmCompiler`.
pub fn new_cairo_lang_compiler(config: SierraToCasmCompilationConfig) -> Self {
Self { sierra_to_casm_compiler: Arc::new(CairoLangSierraToCasmCompiler { config }) }
}

/// Formats the contract class for compilation, compiles it, and returns the compiled contract
/// class wrapped in a [`ClassInfo`].
/// Assumes the contract class is of a Sierra program which is compiled to Casm.
Expand Down
48 changes: 0 additions & 48 deletions crates/starknet_sierra_compile/src/cairo_lang_compiler.rs

This file was deleted.

7 changes: 0 additions & 7 deletions crates/starknet_sierra_compile/src/compile_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use infra_utils::path::resolve_project_relative_path;
use mempool_test_utils::{FAULTY_ACCOUNT_CLASS_FILE, TEST_FILES_FOLDER};
use rstest::rstest;

use crate::cairo_lang_compiler::CairoLangSierraToCasmCompiler;
use crate::command_line_compiler::CommandLineCompiler;
use crate::config::SierraToCasmCompilationConfig;
use crate::errors::CompilationUtilError;
Expand All @@ -19,9 +18,6 @@ use crate::SierraToNativeCompiler;
const SIERRA_TO_CASM_COMPILATION_CONFIG: SierraToCasmCompilationConfig =
SierraToCasmCompilationConfig { max_bytecode_size: 81920 };

fn cairo_lang_compiler() -> CairoLangSierraToCasmCompiler {
CairoLangSierraToCasmCompiler { config: SIERRA_TO_CASM_COMPILATION_CONFIG }
}
fn command_line_compiler() -> CommandLineCompiler {
CommandLineCompiler::new(SIERRA_TO_CASM_COMPILATION_CONFIG)
}
Expand All @@ -39,9 +35,7 @@ fn get_faulty_test_contract() -> ContractClass {
contract_class
}

// TODO: use the other compiler as well.
#[rstest]
#[case::cairo_lang_compiler(cairo_lang_compiler())]
#[case::command_line_compiler(command_line_compiler())]
fn test_compile_sierra_to_casm(#[case] compiler: impl SierraToCasmCompiler) {
let expected_casm_contract_length = 72304;
Expand All @@ -55,7 +49,6 @@ fn test_compile_sierra_to_casm(#[case] compiler: impl SierraToCasmCompiler) {

// TODO(Arni, 1/5/2024): Add a test for panic result test.
#[rstest]
#[case::cairo_lang_compiler(cairo_lang_compiler())]
#[case::command_line_compiler(command_line_compiler())]
fn test_negative_flow_compile_sierra_to_casm(#[case] compiler: impl SierraToCasmCompiler) {
let contract_class = get_faulty_test_contract();
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 @@ -7,7 +7,6 @@ use cairo_native::executor::AotContractExecutor;
use crate::errors::CompilationUtilError;

pub mod build_utils;
pub mod cairo_lang_compiler;
pub mod command_line_compiler;
pub mod config;
pub mod errors;
Expand Down

0 comments on commit 29f5d16

Please sign in to comment.