Skip to content

VM fails when running particular Cairo1 programs #2008

@MaksymMalicki

Description

@MaksymMalicki

Describe the bug
While trying to run the VM using particular Cairo1 programs, I get panic errors for two of them, and an execution error for one of them. Below, I listed the Cairo1 programs, which are failing for me, with the error, that the CLI produces. The last listed program is implemented by me, with the help of a LLM.

  1. https://github.com/NethermindEth/cairo-vm-go/blob/main/integration_tests/cairo_1_programs/serialized_output/with_input/array_input_sum__small.cairo - execution mode and proofmode

cargo run array_input_sum__small.cairo --trace_file trace_output --memory_file memory_output --layout small --args "[444 555 666 777]"
Error: Run panicked with: [29721761890975875353235833581453094220424382983267374 ('Option::unwrap failed.')]

cargo run array_input_sum__small.cairo --trace_file trace_output --memory_file memory_output --layout small --args "[444 555 666 777]" --proof_mode --air_public_input air_public_input.json
Error: Run panicked with: [1 (''), 29721761890975875353235833581453094220424382983267374 ('Option::unwrap failed.')]

  1. https://github.com/NethermindEth/cairo-vm-go/blob/main/integration_tests/cairo_1_programs/serialized_output/with_input/tensor__small.cairo - execution mode and proof mode

cargo run tensor__small.cairo --trace_file trace_output --memory_file memory_output --layout small --args "[5 4 3 2 1]"
Error: Run panicked with: [29721761890975875353235833581453094220424382983267374 ('Option::unwrap failed.')]

cargo run tensor__small.cairo --trace_file trace_output --memory_file memory_output --layout small --args "[5 4 3 2 1]" --proof_mode --air_public_input air_public_input.json
Error: Run panicked with: [1 (''), 29721761890975875353235833581453094220424382983267374 ('Option::unwrap failed.')]

  1. https://github.com/NethermindEth/cairo-vm-go/blob/main/integration_tests/cairo_1_programs/with_input/proofmode_segment_arena__small.cairo - execution mode and proof mode

cargo run proofmode_segment_arena__small.cairo --trace_file trace_output --memory_file memory_output --layout small --args "[1 2 3 4 5]"
Error: VirtualMachine(CantWriteReturnFp((RelocatableValue(Relocatable { segment_index: 6, offset: 5 }), RelocatableValue(Relocatable { segment_index: 1, offset: 4 }))))

cargo run proofmode_segment_arena__small.cairo --trace_file trace_output --memory_file memory_output --layout small --args "[1 2 3 4 5]" --proof_mode --air_public_input air_public_input.json
Error: Error: VirtualMachine(CantWriteReturnFp((RelocatableValue(Relocatable { segment_index: 8, offset: 5 }), RelocatableValue(Relocatable { segment_index: 1, offset: 5 }))))

To Reproduce
Steps to reproduce the behavior:

  1. Go to ./cairo1-run
  2. Run the VM, using the commands listed in the description

Expected behavior
The VM should not fail on those Cairo1 programs.

What version/commit are you on?
Version: v2.0.0, Commit: 60c1fa0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions