Skip to content

Commit

Permalink
Add support for sierra 1.6.0 (#50)
Browse files Browse the repository at this point in the history
* Add support for sierra 1.6.0

* Update tests for sierra 1.6.0
  • Loading branch information
tomek0123456789 authored Jul 2, 2024
1 parent 2e0a469 commit fe1184c
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 381 deletions.
540 changes: 166 additions & 374 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name = "universal-sierra-compiler"
description = "Universal-Sierra-Compiler is the tool for Sierra compilation. It compiles any ever-existing Sierra version to CASM."
homepage = "https://github.com/software-mansion/universal-sierra-compiler"
documentation = "https://github.com/software-mansion/universal-sierra-compiler/blob/master/README.md"
readme = "README.md"
repository = "https://github.com/software-mansion/universal-sierra-compiler"
version = "2.1.0"
Expand All @@ -13,9 +12,9 @@ license = "MIT"
[dependencies]
cairo-lang-starknet-sierra-0_1_0 = { package = "cairo-lang-starknet", git = "https://github.com/starkware-libs/cairo.git", tag = "v1.0.0-alpha.6", version = "1.0.0-alpha.6" }
cairo-lang-starknet-sierra-1_0_0 = { package = "universal-sierra-compiler-cairo-lang-starknet-proxy", version = "=0.2.0" }
cairo-lang-sierra-to-casm = "=2.6.0"
cairo-lang-sierra = "=2.6.0"
cairo-lang-starknet-classes = "2.6.0"
cairo-lang-sierra-to-casm = "=2.7.0-rc.0"
cairo-lang-sierra = "=2.7.0-rc.0"
cairo-lang-starknet-classes = "2.7.0-rc.0"
serde_json = "1.0.108"
serde = "1.0.193"
clap = "4.4.11"
Expand All @@ -29,4 +28,4 @@ indoc = "2.0.4"
fs_extra = "1.3.0"
test-case = "3.3.1"
num-bigint = "0.4.4"
cairo-lang-casm = { version = "2.6.0", features = ["serde"] }
cairo-lang-casm = { version = "2.7.0-rc.0", features = ["serde"] }
2 changes: 1 addition & 1 deletion src/commands/compile_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn compile(mut sierra_json: Value) -> Result<Value> {

let sierra_version = parse_sierra_version(&sierra_json)?;
match sierra_version.as_slice() {
[1, 2..=5, ..] => {
[1, 2..=6, ..] => {
let sierra_class: ContractClass = serde_json::from_value(sierra_json.clone()).unwrap();
let casm_class =
CasmContractClass::from_contract_class(sierra_class, true, usize::MAX).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src/commands/compile_raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn serialize_cairo_program_debug_info(debug_info: &CairoProgramDebugInfo) -> Vec
.iter()
.map(|statement_debug_info| {
(
statement_debug_info.code_offset,
statement_debug_info.start_offset,
statement_debug_info.instruction_idx,
)
})
Expand Down
1 change: 1 addition & 0 deletions tests/data/sierra_contract/sierra_1_6_0.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/data/sierra_raw/sierra_1_6_0.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/e2e/compile_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ fn wrong_json() {
"});
}

#[test_case("1_6_0"; "sierra 1.6.0")]
#[test_case("1_5_0"; "sierra 1.5.0")]
#[test_case("1_4_0"; "sierra 1.4.0")]
#[test_case("1_3_0"; "sierra 1.3.0")]
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/compile_raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ fn wrong_json() {
"});
}

#[test_case("1_6_0"; "sierra 1.6.0")]
#[test_case("1_5_0"; "sierra 1.5.0")]
#[test_case("1_4_0"; "sierra 1.4.0")]
fn test_happy_case(sierra_version: &str) {
Expand Down
1 change: 1 addition & 0 deletions tests/integration/compile_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn wrong_json() {
assert!(casm_class.is_err());
}

#[test_case("1_6_0"; "sierra 1.6.0")]
#[test_case("1_5_0"; "sierra 1.5.0")]
#[test_case("1_4_0"; "sierra 1.4.0")]
#[test_case("1_3_0"; "sierra 1.3.0")]
Expand Down
1 change: 1 addition & 0 deletions tests/integration/compile_raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn wrong_json() {
assert!(cairo_program.is_err());
}

#[test_case("1_6_0"; "sierra 1.6.0")]
#[test_case("1_5_0"; "sierra 1.5.0")]
#[test_case("1_4_0"; "sierra 1.4.0")]
fn compile_raw_sierra(sierra_version: &str) {
Expand Down

0 comments on commit fe1184c

Please sign in to comment.