Skip to content

Commit

Permalink
chore(blockifier): update cairo native version to v0.2.3 (#2190)
Browse files Browse the repository at this point in the history
  • Loading branch information
varex83 authored Nov 20, 2024
1 parent 4e76762 commit fbbb6c5
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 95 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ cairo-lang-sierra-to-casm = "2.9.0-dev.0"
cairo-lang-starknet-classes = "2.9.0-dev.0"
cairo-lang-utils = "2.9.0-dev.0"
# Important: when updated, make sure to update the cairo-native submodule as well.
cairo-native = "0.2.2-alpha.0"
cairo-native = "0.2.3"
cairo-vm = "=1.0.1"
camelpaste = "0.1.0"
chrono = "0.4.26"
Expand Down
8 changes: 4 additions & 4 deletions crates/bin/starknet-native-compile/Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/bin/starknet-native-compile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ license = "Apache-2.0"
# TODO(Avi, 01/02/2025): Check consistency with the blockifier.
cairo-lang-sierra = "2.9.0-dev.0"
cairo-lang-starknet-classes = "2.9.0-dev.0"
cairo-native = "0.2.1-alpha.0"
cairo-native = "0.2.3"
clap = { version = "4.5.4", features = ["derive"] }
serde_json = "1.0.116"
23 changes: 14 additions & 9 deletions crates/bin/starknet-native-compile/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use crate::utils::load_sierra_program_from_file;
use cairo_native::executor::AotContractExecutor;
use cairo_native::OptLevel;
use std::path::PathBuf;
use std::process;

use cairo_native::executor::AotContractExecutor;
use cairo_native::OptLevel;
use clap::Parser;

use crate::utils::load_sierra_program_from_file;

mod utils;

#[derive(Parser, Debug)]
Expand All @@ -23,14 +24,18 @@ fn main() {
let path = args.path;
let output = args.output;

let sierra_program = load_sierra_program_from_file(&path);
let (contract_class, sierra_program) = load_sierra_program_from_file(&path);

// TODO(Avi, 01/12/2024): Test different optimization levels for best performance.
let mut contract_executor = AotContractExecutor::new(&sierra_program, OptLevel::default())
.unwrap_or_else(|err| {
eprintln!("Error compiling Sierra program: {}", err);
process::exit(1);
});
let mut contract_executor = AotContractExecutor::new(
&sierra_program,
&contract_class.entry_points_by_type,
OptLevel::default(),
)
.unwrap_or_else(|err| {
eprintln!("Error compiling Sierra program: {}", err);
process::exit(1);
});
contract_executor.save(output.clone()).unwrap_or_else(|err| {
eprintln!("Error saving compiled program: {}", err);
process::exit(1);
Expand Down
20 changes: 11 additions & 9 deletions crates/bin/starknet-native-compile/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use cairo_lang_starknet_classes::contract_class::ContractClass;

use cairo_lang_sierra::program::Program;

use std::path::PathBuf;
use std::process;

pub(crate) fn load_sierra_program_from_file(path: &PathBuf) -> Program {
use cairo_lang_sierra::program::Program;
use cairo_lang_starknet_classes::contract_class::ContractClass;

pub(crate) fn load_sierra_program_from_file(path: &PathBuf) -> (ContractClass, Program) {
let raw_contract_class = std::fs::read_to_string(path).unwrap_or_else(|err| {
eprintln!("Error reading Sierra file: {}", err);
process::exit(1);
Expand All @@ -15,8 +14,11 @@ pub(crate) fn load_sierra_program_from_file(path: &PathBuf) -> Program {
eprintln!("Error deserializing Sierra file into contract class: {}", err);
process::exit(1);
});
contract_class.extract_sierra_program().unwrap_or_else(|err| {
eprintln!("Error extracting Sierra program from contract class: {}", err);
process::exit(1);
})
(
contract_class.clone(),
contract_class.extract_sierra_program().unwrap_or_else(|err| {
eprintln!("Error extracting Sierra program from contract class: {}", err);
process::exit(1);
}),
)
}
2 changes: 1 addition & 1 deletion crates/blockifier/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn compile_cairo_native_aot_runtime() {
const RUNTIME_LIBRARY: &str = "CAIRO_NATIVE_RUNTIME_LIBRARY";
let runtime_expected_path = {
let expected_path_env =
std::env::var(RUNTIME_LIBRARY).expect("Cairo Native rutime path variable is not set");
std::env::var(RUNTIME_LIBRARY).expect("Cairo Native runtime path variable is not set");
let expected_path = PathBuf::from(&expected_path_env);

if expected_path.is_absolute() {
Expand Down
2 changes: 1 addition & 1 deletion crates/blockifier/cairo_native
Submodule cairo_native updated 70 files
+4 −4 .github/workflows/bench-hyperfine.yml
+64 −5 .github/workflows/daily.yml
+2 −2 .github/workflows/starknet-blocks.yml
+2 −2 Cargo.lock
+2 −2 Cargo.toml
+1 −1 README.md
+6 −6 benches/benches.rs
+6 −6 benches/libfuncs.rs
+1 −2 docs/gas_builtin_accounting.md
+41 −27 docs/overview.md
+25 −25 examples/erc20.rs
+25 −25 examples/starknet.rs
+2 −2 programs/benches/factorial_2M.c
+2 −2 programs/benches/fib_2M.c
+2 −2 programs/benches/logistic_map.c
+1 −1 runtime/Cargo.toml
+0 −1 scripts/bench-hyperfine.sh
+1 −1 src/bin/cairo-native-run.rs
+1 −1 src/bin/cairo-native-stress/main.rs
+1 −1 src/cache/aot.rs
+1 −1 src/error.rs
+9 −9 src/execution_result.rs
+7 −7 src/executor.rs
+6 −6 src/executor/aot.rs
+9 −10 src/executor/contract.rs
+3 −3 src/executor/jit.rs
+8 −13 src/ffi.rs
+14 −14 src/libfuncs/array.rs
+9 −9 src/libfuncs/bounded_int.rs
+2 −2 src/libfuncs/box.rs
+1 −1 src/libfuncs/const.rs
+1 −6 src/libfuncs/felt252_dict.rs
+1 −1 src/libfuncs/felt252_dict_entry.rs
+16 −22 src/libfuncs/gas.rs
+145 −139 src/libfuncs/starknet.rs
+100 −100 src/libfuncs/starknet/secp256.rs
+15 −10 src/metadata.rs
+1 −1 src/metadata/auto_breakpoint.rs
+1 −1 src/metadata/debug_utils.rs
+8 −3 src/metadata/drop_overrides.rs
+8 −3 src/metadata/dup_overrides.rs
+25 −20 src/metadata/gas.rs
+3 −5 src/metadata/realloc_bindings.rs
+38 −18 src/metadata/runtime_bindings.rs
+97 −101 src/starknet.rs
+24 −24 src/starknet_stub.rs
+5 −4 src/types.rs
+2 −2 src/types/array.rs
+2 −2 src/types/box.rs
+10 −9 src/types/enum.rs
+10 −6 src/types/felt252_dict.rs
+1 −1 src/types/gas_builtin.rs
+2 −2 src/types/nullable.rs
+5 −5 src/types/snapshot.rs
+2 −2 src/types/starknet.rs
+5 −5 src/types/struct.rs
+1 −1 src/utils.rs
+4 −4 tests/common.rs
+1 −1 tests/tests/alexandria.rs
+2 −2 tests/tests/arrays.rs
+7 −7 tests/tests/boolean.rs
+1 −1 tests/tests/dict.rs
+5 −5 tests/tests/ec.rs
+4 −4 tests/tests/felt252.rs
+11 −11 tests/tests/programs.rs
+1 −4 tests/tests/starknet/keccak.rs
+58 −58 tests/tests/starknet/secp256.rs
+44 −44 tests/tests/starknet/syscalls.rs
+1 −4 tests/tests/starknet/u256.rs
+25 −25 tests/tests/uint.rs
Loading

0 comments on commit fbbb6c5

Please sign in to comment.