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

bug: Cairo runner does not support array arguments larger than 2^15 #6479

Closed
m-kus opened this issue Oct 11, 2024 · 2 comments · Fixed by #6489
Closed

bug: Cairo runner does not support array arguments larger than 2^15 #6479

m-kus opened this issue Oct 11, 2024 · 2 comments · Fixed by #6489
Labels
bug Something isn't working

Comments

@m-kus
Copy link
Contributor

m-kus commented Oct 11, 2024

Bug Report

Cairo version:

737cc88

Current behavior:

When running a program with an array argument that is of length 32768:

  • In debug mode: Cairo runner fails with overflow when tries to increment the allocation pointer while loading arguments;
  • In release mode: Cairo runner loads arguments without errors postponing the memory issue to the cairo-vm execution.

Expected behavior:

Cairo runner works without errors in both debug and release, there are no memory issues during the cairo-vm execution.

Steps to reproduce:

Unit test:
https://github.com/m-kus/cairo/pull/1/files

Related code:

The minimal program to reproduce the issue:

fn main(args: Array<felt252>) {}

Other information:

Possibly related:

@m-kus m-kus added the bug Something isn't working label Oct 11, 2024
@maciejka
Copy link
Contributor

When the arg size is large the ap_offset that is tracking ap overflows here:

*ap_offset += 1;
.

@orizi
Copy link
Collaborator

orizi commented Oct 13, 2024

This should be done as part of lambdaclass/cairo-vm#1759 - as the issue is the amount of instructions created for this explicit array creation.

Is going to be solved at the future when the code isn't actually changing by the specific inputs it received.

In the near future we should have a way of running code, where the input is always a Span of felts and the output is always a Span of felts, where both are directly deserialized (from the inputs) and serialized (into the output builtin) providing a provable method of run.

So basically - it isn't a bug - as this was just for local purposes (as cairo-run didn't actually run anything provable, so i would have expected it to work) - but the missing feature should exist soon enough.

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

Successfully merging a pull request may close this issue.

3 participants