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.

Home Page:https://lambdaclass.github.io/cairo-vm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VirtualMachine error when using Felt252Dict<T>

catusax opened this issue · comments

Describe the bug
when using Felt252Dict in cairo1, vm reports an error:

Error: VirtualMachine(DiffAssertValues((RelocatableValue(Relocatable { segment_index: 13, offset: 0 }), RelocatableValue(Relocatable { segment_index: 14, offset: 3 }))))

To Reproduce
Steps to reproduce the behavior:

please go to this repo for a full example: https://github.com/catusax/cairovm-felt252dict-error

when i use this source code, compile to serria, and run with --print_output --proof_mode --layout all_cairo, the error occurs:

fn main(input:Array<felt252>) -> Array<felt252> {
    let elements: Felt252Dict<Nullable<Span<u8>>> = Default::default();
    input
}

but if i remove the function params ,it works fine

fn main() -> Array<felt252> {
    let elements: Felt252Dict<Nullable<Span<u8>>> = Default::default();
    array![1]
}

Expected behavior
this should has same result as the scarb cairo-run, which works fine

What version/commit are you on?
3f9428e

Additional context
Add any other context about the problem here.
https://github.com/catusax/cairovm-felt252dict-error

this was introduced by #1759

Hello! Thank you for reporting this! #1789 should fix it once merged