Skip to content

Commit

Permalink
refactor: remove pythonic_hints
Browse files Browse the repository at this point in the history
  • Loading branch information
zmalatrax committed Oct 24, 2024
1 parent 115f496 commit 1ead3e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 30 deletions.
8 changes: 2 additions & 6 deletions crates/bin/sierra-compile-json/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ struct Args {
/// Add gas usage check
#[arg(long, default_value_t = false)]
gas_usage_check: bool,
#[arg(long, default_value_t = false)]
/// Add pythonic hints
add_pythonic_hints: bool,
}

fn main() -> anyhow::Result<()> {
Expand All @@ -44,9 +41,8 @@ fn main() -> anyhow::Result<()> {
)
.with_context(|| "Compilation failed.")?;

let casm_cairo_program =
CasmCairoProgram::new(&sierra_program, &cairo_program, args.add_pythonic_hints)
.with_context(|| "Sierra to Casm compilation failed.")?;
let casm_cairo_program = CasmCairoProgram::new(&sierra_program, &cairo_program)
.with_context(|| "Sierra to Casm compilation failed.")?;

let res = serde_json::to_string(&casm_cairo_program)
.with_context(|| "Casm contract Serialization failed.")?;
Expand Down
26 changes: 2 additions & 24 deletions crates/cairo-lang-sierra-to-casm/src/compiler.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::fmt::Display;

use cairo_lang_casm::assembler::AssembledCairoProgram;
use cairo_lang_casm::hints::{Hint, PythonicHint};
use cairo_lang_casm::hints::Hint;
use cairo_lang_casm::instructions::{Instruction, InstructionBody, RetInstruction};
use cairo_lang_sierra::extensions::bitwise::BitwiseType;
use cairo_lang_sierra::extensions::circuit::{AddModType, MulModType};
Expand Down Expand Up @@ -140,8 +140,6 @@ pub struct CasmCairoProgram {
pub compiler_version: String,
pub bytecode: Vec<BigUintAsHex>,
pub hints: Vec<(usize, Vec<Hint>)>,
#[serde(skip_serializing_if = "skip_if_none")]
pub pythonic_hints: Option<Vec<(usize, Vec<String>)>>,
pub entry_points_by_function: OrderedHashMap<String, CasmCairoEntryPoint>,
}

Expand Down Expand Up @@ -175,7 +173,6 @@ impl CasmCairoProgram {
pub fn new(
sierra_program: &Program,
cairo_program: &CairoProgram,
add_pythonic_hints: bool,
) -> Result<Self, CompilationError> {
let replacer = CanonicalReplacer::from_program(&sierra_program);
let sierra_program = &replacer.apply(&sierra_program);
Expand All @@ -196,18 +193,6 @@ impl CasmCairoProgram {
})
.collect();

let pythonic_hints = match add_pythonic_hints {
true => Some(
hints
.iter()
.map(|(pc, hints)| {
(*pc, hints.iter().map(|hint| hint.get_pythonic_hint()).collect_vec())
})
.collect_vec(),
),
false => None,
};

let builtin_types = UnorderedHashSet::<GenericTypeId>::from_iter([
RangeCheckType::id(),
BitwiseType::id(),
Expand Down Expand Up @@ -309,14 +294,7 @@ impl CasmCairoProgram {
(function_name, CasmCairoEntryPoint { offset, builtins, input_args, return_arg })
}));

Ok(Self {
prime,
compiler_version,
bytecode,
hints,
pythonic_hints,
entry_points_by_function,
})
Ok(Self { prime, compiler_version, bytecode, hints, entry_points_by_function })
}
}

Expand Down

0 comments on commit 1ead3e3

Please sign in to comment.