Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
bump native
Browse files Browse the repository at this point in the history
  • Loading branch information
greged93 committed Apr 11, 2024
1 parent d199153 commit e07a059
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 36 deletions.
30 changes: 20 additions & 10 deletions Cargo.lock

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

20 changes: 11 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@ replay_benchmark = []

[workspace]
members = [
"fuzzer",
"rpc_state_reader",
"replay",
"examples/contract_execution",
"fuzzer",
"rpc_state_reader",
"replay",
"examples/contract_execution",
]

[workspace.dependencies]
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"
Expand All @@ -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"
Expand All @@ -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 }
Expand Down
10 changes: 3 additions & 7 deletions src/execution/execution_entry_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,7 @@ impl ExecutionEntryPoint {
class_hash: &ClassHash,
program_cache: Rc<RefCell<ProgramCache<'_, ClassHash>>>,
) -> Result<CallInfo, TransactionError> {
use cairo_native::{
executor::NativeExecutor, metadata::syscall_handler::SyscallHandlerMeta,
};
use cairo_native::executor::NativeExecutor;

use crate::{
syscalls::{
Expand Down Expand Up @@ -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()
Expand All @@ -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)))?;
Expand Down
6 changes: 3 additions & 3 deletions src/syscalls/native_syscall_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 1 addition & 6 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/complex_contracts/kakarot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit e07a059

Please sign in to comment.