lambdaclass / cairo-vm

cairo-vm is a Rust implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
https://lambdaclass.github.io/cairo-vm
Apache License 2.0
485 stars 133 forks source link

Unknown variant segment_arena #1437

Closed gaetbout closed 6 months ago

gaetbout commented 10 months ago

Describe the bug When using shardlabs devnet with the cairo_vm env var set to rust, if my contract uses a dictionary, I run into:

Traceback (most recent call last):  File "/Users/username/cairo_venv/lib/python3.9/site-packages/starkware/starkware_utils/error_handling.py", line 266, in wrap_with_stark_exception
    yield
  File "/Users/username/cairo_venv/lib/python3.9/site-packages/starkware/starknet/business_logic/transaction/state_objects.py", line 120, in apply_concurrent_changes
    return self._apply_specific_concurrent_changes(
  File "/Users/username/cairo_venv/lib/python3.9/site-packages/starkware/starknet/business_logic/transaction/objects.py", line 1454, in _apply_specific_concurrent_changes
    call_info, remaining_gas = self.run_execute_entrypoint(
  File "/Users/username/cairo_venv/lib/python3.9/site-packages/starkware/starknet/business_logic/transaction/objects.py", line 1500, in run_execute_entrypoint
    call_info = call.execute(
  File "/Users/username/cairo_venv/lib/python3.9/site-packages/starkware/starknet/business_logic/execution/execute_entry_point.py", line 206, in execute
    call_info = self._execute(
  File "/Users/username/cairo_venv/lib/python3.9/site-packages/starknet_devnet/cairo_rs_py_patch.py", line 186, in cairo_rs_py_execute
    runner = CairoRunner(  # pylint: disable=no-member
ValueError: unknown variant segment_arena, expected one of output, range_check, pedersen, ecdsa, keccak, bitwise, ec_op, poseidon at line 1 column 76

To Reproduce This typically hapenned when I used this snippets of code:

  use nullable::{match_nullable, FromNullableResult};
let after_hook_data = data.get(12);
let span = match match_nullable(after_hook_data) {
    FromNullableResult::Null(()) => {},
    FromNullableResult::NotNull(val) => {
       // Do stuff
    },
};
  let mut responses: Felt252Dict<Nullable<Span<felt252>>> = Default::default();

  loop {
      match hooks.pop_front() {
          Option::Some(something) => {
              let data = get_data()
              responses
                  .insert(
                      12, nullable_from_box(BoxTrait::new(data))
                  );
          },
          Option::None => {
              break;
          },
      };
  };
  responses

Expected behavior It shouldn't crash

What version/commit are you on? using: cairo-lang==0.12.2 starknet-devnet==0.6.1 cairo-rs-py==0.2.0 cairo-compiler==2.2.0

gaetbout commented 10 months ago

It could be shardlabs devnet that uses an old version of the vm, I forwarded them this message

pefontana commented 8 months ago

Hi @gaetbout ! Do you have any update about this?

gaetbout commented 8 months ago

Hey @pefontana Apparently it is due to shardlabs using an old version of the vm šŸ™ Had some talk and their main focus is their devnet in rust, so they won't be updating their python devnet šŸ˜ž