Closed renzobanegass closed 1 month ago
@renzobanegass For the integration test, you have to write a Cairo program in the cairo_programs/cairo/hints
folder that makes use of the TestLessThanOrEqualAddress.
This hint is used by the multi_pop_front()
and multi_pop_back()
methods of corelib array.cairo
.
So you should make a Cairo program using such methods
A simple program such as
fn main() {
let mut span = array![1, 2, 3].span();
let _ = span.multi_pop_back::<2>();
}
@renzobanegass For the integration test, you have to write a Cairo program in the
cairo_programs/cairo/hints
folder that makes use of the TestLessThanOrEqualAddress.This hint is used by the
multi_pop_front()
andmulti_pop_back()
methods of corelibarray.cairo
. So you should make a Cairo program using such methodsA simple program such as
fn main() { let mut span = array![1, 2, 3].span(); let _ = span.multi_pop_back::<2>(); }
When trying to compile cairo I got this error:
I pushed some changes, I couldn't compile the cairo programs because of the error I showed you before, I added two, one for the multi_pop_front()
and other for the multi_pop_back()
The unit tests are working.
When trying to compile cairo I got this error:
It looks like you haven't the Cairo Zero toolchain (cairo-lang 0.13.1) installed in your current python environment.
Poetry facilitates the management of dependencies, you should have Poetry installed, installation guide here
Then in the root of the project set a poetry env to use python3.10: poetry use python3.10
And install the dependencies of the project (i.e. cairo-lang): poetry install
Then you should be able to compile Cairo Zero files.
⚠️ Your commits are not signed, please configure a GPG key to sign your commits
Also, your typescript files are not formatted as expected. We're using Trunk, install the IDE extension if you're using VSCode or Neovim, otherwise install their CLI and run trunk fmt
Okay, I can now sign my commits, should I do a rebase to sign the previous commits?
I have this error after running poetry install, I already set the env using poetry env use python3.10
.
I solved it, don't worry. I'll check the programs are working.
When running any programs I get this error
When running any programs I get this error
You're using the cairo-lang
command cairo-run
which is made for Cairo Zero programs only.
cairo-lang
is only used for compilation purposes and diff-testing against other Cairo VM implementations.
You should use the the Cairo VM TS CLI command, check the README
You can do make build
and then you'll have the Cairo VM TS CLI commands available.
The target make compile
will compile all the available Cairo and Cairo Zero programs.
Check the availables options with cairo --help
or cairo run --help
For your program, something like this would execute it: cairo run --layout recursive cairo_programs/cairo/hints/test_less_than_or_equal_address.json
Thanks! I missed that part completely.
All done!
Closes #122
This pull request implements the TestLessThanOrEqualAddress hint as described in the issue. The hint checks whether the value at lhs (a relocatable address) is less than or equal to the value at rhs (another relocatable address) and stores the boolean result (0 or 1) at dst. I'll leave it as a draft for now as I didn't create the cairo integration test yet, I would like some help with that because I don't get how those programs work RN. And would like to get feedback over the implementation and the tests.
Changes Made