From e07a059b03a1fa26b665981f70c9effb3e5c78ee Mon Sep 17 00:00:00 2001 From: Gregory Edison Date: Thu, 11 Apr 2024 11:59:40 -0300 Subject: [PATCH] bump native --- Cargo.lock | 30 ++++++++++++------- Cargo.toml | 20 +++++++------ src/execution/execution_entry_point.rs | 10 ++----- src/syscalls/native_syscall_handler.rs | 6 ++-- src/utils.rs | 7 +---- .../complex_contracts/kakarot/mod.rs | 2 +- 6 files changed, 39 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2704975f9..86070b093 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1317,7 +1317,7 @@ dependencies = [ [[package]] name = "cairo-native" version = "0.1.0" -source = "git+https://github.com/lambdaclass/cairo_native?rev=8fddcd3914badfe3f89752fe7a22befeaffc17f9#8fddcd3914badfe3f89752fe7a22befeaffc17f9" +source = "git+https://github.com/lambdaclass/cairo_native?rev=60ed062a3d6d40cd8688a580f440af525f40d437#60ed062a3d6d40cd8688a580f440af525f40d437" dependencies = [ "anyhow", "bumpalo", @@ -1361,7 +1361,7 @@ dependencies = [ [[package]] name = "cairo-native-runtime" version = "0.1.0" -source = "git+https://github.com/lambdaclass/cairo_native?rev=8fddcd3914badfe3f89752fe7a22befeaffc17f9#8fddcd3914badfe3f89752fe7a22befeaffc17f9" +source = "git+https://github.com/lambdaclass/cairo_native?rev=60ed062a3d6d40cd8688a580f440af525f40d437#60ed062a3d6d40cd8688a580f440af525f40d437" dependencies = [ "cairo-lang-runner", "lazy_static", @@ -1438,10 +1438,11 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.88" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" +checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" dependencies = [ + "jobserver", "libc", ] @@ -2858,6 +2859,15 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +[[package]] +name = "jobserver" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.68" @@ -3115,9 +3125,9 @@ dependencies = [ [[package]] name = "melior" -version = "0.16.2" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e76dd7ff903474595023aebb93f8287667a2fe95132c65e1c77efdb99c64a973" +checksum = "672be978c3550fd9c329987c9457e60e4452049b24518a5acb2d3f14cf6d2777" dependencies = [ "dashmap", "melior-macro", @@ -5578,18 +5588,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 3ddd13cf3..6f9e7f690 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,10 +15,10 @@ replay_benchmark = [] [workspace] members = [ - "fuzzer", - "rpc_state_reader", - "replay", - "examples/contract_execution", + "fuzzer", + "rpc_state_reader", + "replay", + "examples/contract_execution", ] [workspace.dependencies] @@ -26,11 +26,13 @@ cairo-lang-casm = "=2.5.4" cairo-lang-sierra = "=2.5.4" cairo-lang-starknet = "=2.5.4" cairo-lang-utils = "=2.5.4" -cairo-vm = { git = "https://github.com/lambdaclass/cairo-vm", rev = "3547089579dd74f815edbc2d1caa91e00fc8a2f7", features = ["cairo-1-hints"] } +cairo-vm = { git = "https://github.com/lambdaclass/cairo-vm", rev = "3547089579dd74f815edbc2d1caa91e00fc8a2f7", features = [ + "cairo-1-hints", +] } num-traits = "0.2.15" starknet = "0.7.0" # todo: update to 0.9.0+ once cairo-lang is 2.6.0+ starknet_api = "0.7.0-dev.0" # todo: update to 0.9.0+ once cairo-lang is 2.6.0+ -thiserror = "1.0.32" +thiserror = "1.0.58" [dependencies] anyhow = "1.0" @@ -39,7 +41,7 @@ cairo-lang-casm = { workspace = true } cairo-lang-sierra = { workspace = true } cairo-lang-starknet = { workspace = true } cairo-lang-utils = { workspace = true } -cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "8fddcd3914badfe3f89752fe7a22befeaffc17f9", optional = true } +cairo-native = { git = "https://github.com/lambdaclass/cairo_native", rev = "60ed062a3d6d40cd8688a580f440af525f40d437", optional = true } k256 = "0.13.3" p256 = "0.13.2" sec1 = "0.7.3" @@ -59,8 +61,8 @@ once_cell = "1.17.1" sha3 = "0.10.1" serde = { version = "1.0.152", features = ["derive"] } serde_json = { version = "1.0", features = [ - "arbitrary_precision", - "raw_value", + "arbitrary_precision", + "raw_value", ] } serde_json_pythonic = "0.1.2" starknet = { workspace = true } diff --git a/src/execution/execution_entry_point.rs b/src/execution/execution_entry_point.rs index f1b11a4a1..fea00314a 100644 --- a/src/execution/execution_entry_point.rs +++ b/src/execution/execution_entry_point.rs @@ -687,9 +687,7 @@ impl ExecutionEntryPoint { class_hash: &ClassHash, program_cache: Rc>>, ) -> Result { - use cairo_native::{ - executor::NativeExecutor, metadata::syscall_handler::SyscallHandlerMeta, - }; + use cairo_native::executor::NativeExecutor; use crate::{ syscalls::{ @@ -757,8 +755,6 @@ impl ExecutionEntryPoint { resources_manager: Default::default(), }; - let syscall_meta = SyscallHandlerMeta::new(&mut syscall_handler); - let entry_point_fn = &sierra_program .funcs .iter() @@ -772,13 +768,13 @@ impl ExecutionEntryPoint { entry_point_id, &self.calldata, Some(self.initial_gas), - Some(&syscall_meta), + &mut syscall_handler, ), NativeExecutor::Jit(executor) => executor.invoke_contract_dynamic( entry_point_id, &self.calldata, Some(self.initial_gas), - Some(&syscall_meta), + &mut syscall_handler, ), } .map_err(|e| TransactionError::CustomError(format!("cairo-native error: {:?}", e)))?; diff --git a/src/syscalls/native_syscall_handler.rs b/src/syscalls/native_syscall_handler.rs index badeea73a..c1414aab1 100644 --- a/src/syscalls/native_syscall_handler.rs +++ b/src/syscalls/native_syscall_handler.rs @@ -33,7 +33,7 @@ use cairo_native::{ cache::ProgramCache, starknet::{ BlockInfo, ExecutionInfo, ExecutionInfoV2, ResourceBounds, Secp256k1Point, Secp256r1Point, - StarkNetSyscallHandler, SyscallResult, TxInfo, TxV2Info, U256, + StarknetSyscallHandler, SyscallResult, TxInfo, TxV2Info, U256, }, }; use cairo_vm::Felt252; @@ -85,8 +85,8 @@ impl<'a, 'cache, S: StateReader, C: ContractClassCache> NativeSyscallHandler<'a, } } -impl<'a, 'cache, S: StateReader, C: ContractClassCache> StarkNetSyscallHandler - for NativeSyscallHandler<'a, 'cache, S, C> +impl<'a, 'cache, S: StateReader, C: ContractClassCache> StarknetSyscallHandler + for &mut NativeSyscallHandler<'a, 'cache, S, C> { fn get_block_hash( &mut self, diff --git a/src/utils.rs b/src/utils.rs index c7fe0d6b9..675bb8090 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -122,12 +122,7 @@ pub fn field_element_to_felt(felt: &FieldElement) -> Felt252 { } pub fn felt_to_hash(value: &Felt252) -> ClassHash { - let mut output = [0; 32]; - - let bytes = value.to_bytes_be(); - output[..].copy_from_slice(&bytes); - - ClassHash(output) + ClassHash(value.to_bytes_be()) } pub fn string_to_hash(class_string: &str) -> ClassHash { diff --git a/tests/integration_tests/complex_contracts/kakarot/mod.rs b/tests/integration_tests/complex_contracts/kakarot/mod.rs index e523d70ae..a07891fa8 100644 --- a/tests/integration_tests/complex_contracts/kakarot/mod.rs +++ b/tests/integration_tests/complex_contracts/kakarot/mod.rs @@ -18,7 +18,7 @@ use starknet_in_rust::utils::{calculate_sn_keccak, felt_to_field_element, field_ use crate::integration_tests::cairo_native::TestStateSetup; #[test] -#[ignore = "linked to native issue #499 and #500"] +// #[ignore = "linked to native issue #499 and #500"] fn test_kakarot_contract() { // Evm constants let private_key: B256 =