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

Commit aafcb2d

Browse files
committed
Upgrade cairo-vm
This requires a few ugly hacks from mismatches with Blockifier's version. TODO: comment on them!
1 parent 7a024c7 commit aafcb2d

File tree

4 files changed

+93
-29
lines changed

4 files changed

+93
-29
lines changed

Cargo.lock

+55-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cairo-lang-runner = "2.1.0-rc4"
2020
cairo-lang-sierra = "2.1.0-rc4"
2121
cairo-lang-starknet = "2.1.0-rc4"
2222
cairo-lang-utils = "2.1.0-rc4"
23-
cairo-vm = { version = "0.8.5", features = ["cairo-1-hints"] }
23+
cairo-vm = { version = "0.9.0", features = ["cairo-1-hints"] }
2424
num-traits = "0.2.15"
2525
starknet = "0.5.0"
2626
starknet_api = "0.4.1"

rpc_state_reader/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ thiserror = { workspace = true }
2020
flate2 = "1.0.25"
2121
serde_with = "3.0.0"
2222
dotenv = "0.15.0"
23-
cairo-vm = "0.8.5"
23+
cairo-vm.workspace = true
24+
# To create the `Program` in Blockifier's tests
25+
cairo-vm-blockifier = { package = "cairo-vm", version = "0.8.7" }
2426
blockifier = "0.2.0-rc0"
2527
starknet_in_rust = { path = "../", version = "0.4.0" }
2628

rpc_state_reader/tests/blockifier_tests.rs

+34-14
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use blockifier::{
1919
use cairo_lang_starknet::{
2020
casm_contract_class::CasmContractClass, contract_class::ContractClass as SierraContractClass,
2121
};
22-
use cairo_vm::types::program::Program;
22+
use cairo_vm_blockifier::types::program::Program;
2323
use pretty_assertions_sorted::{assert_eq, assert_eq_sorted};
2424
use rpc_state_reader::rpc_state::*;
2525
use rpc_state_reader::utils;
@@ -217,14 +217,24 @@ fn blockifier_test_recent_tx() {
217217
..
218218
} = execute_call_info.unwrap();
219219

220+
let trace_resources = &trace
221+
.function_invocation
222+
.as_ref()
223+
.unwrap()
224+
.execution_resources;
220225
assert_eq!(actual_fee.0, receipt.actual_fee);
221-
assert_eq!(
222-
vm_resources,
223-
trace
224-
.function_invocation
225-
.as_ref()
226-
.unwrap()
227-
.execution_resources
226+
// NOTE: had to check field by field due to version mismatch causing type errors
227+
assert_eq_sorted!(
228+
(
229+
vm_resources.n_steps,
230+
vm_resources.n_memory_holes,
231+
&vm_resources.builtin_instance_counter
232+
),
233+
(
234+
trace_resources.n_steps,
235+
trace_resources.n_memory_holes,
236+
&trace_resources.builtin_instance_counter
237+
),
228238
);
229239
assert_eq!(
230240
inner_calls.len(),
@@ -313,13 +323,23 @@ fn blockifier_test_case_tx(hash: &str, block_number: u64, chain: RpcChain) {
313323
}
314324
}
315325

326+
let trace_resources = &trace
327+
.function_invocation
328+
.as_ref()
329+
.unwrap()
330+
.execution_resources;
331+
// NOTE: had to check field by field due to version mismatch causing type errors
316332
assert_eq_sorted!(
317-
vm_resources,
318-
trace
319-
.function_invocation
320-
.as_ref()
321-
.unwrap()
322-
.execution_resources
333+
(
334+
vm_resources.n_steps,
335+
vm_resources.n_memory_holes,
336+
&vm_resources.builtin_instance_counter
337+
),
338+
(
339+
trace_resources.n_steps,
340+
trace_resources.n_memory_holes,
341+
&trace_resources.builtin_instance_counter
342+
),
323343
);
324344
assert_eq!(
325345
inner_calls.len(),

0 commit comments

Comments
 (0)