Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cairo1-run InvocationError during sierra->casm compilation on programs with loops and recursion #1745

Closed
Okm165 opened this issue May 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Okm165
Copy link

Okm165 commented May 2, 2024

Bug Description:
Encountering a compilation error during the sierra to casm compilation process in programs containing loops within the cairo-vm cairo1-run package. The error message indicates an InvocationError with the specific error being UnknownVariableData.
Full error message:

Error: Compilation(InvocationError { statement_idx: StatementIdx(23), error: UnknownVariableData })

How to Reproduce:

  1. Set up a scarb project.
  2. Paste the program.
fn main() -> felt252 {
    let mut i = 5;
    loop {
        if i == 0 {
            break;
        }
        i-=1;
    };
    i
}
  1. Execute the following steps:
    • scarb build
    • cargo run (path to sierra) --layout all_cairo

It is important to note that if u remove loop from the above program the cairo1-run succeeds to run it


Branch and Commit:

  • Branch: main
  • Commit: 6c554e7
  • Scarb 2.6.3
@fmoletta
Copy link
Contributor

fmoletta commented May 2, 2024

Hello! Did you add the following to your Scarb.toml?

[cairo]
enable-gas = false

@Okm165
Copy link
Author

Okm165 commented May 2, 2024

@fmoletta Hi! It solves this issue! Thank u for quick response🚀🚀🚀

@Okm165 Okm165 closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants