-
Notifications
You must be signed in to change notification settings - Fork 160
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
Basic example to run Cairo 1 programs #1370
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1370 +/- ##
==========================================
- Coverage 96.99% 96.84% -0.15%
==========================================
Files 93 94 +1
Lines 38791 39003 +212
==========================================
+ Hits 37624 37772 +148
- Misses 1167 1231 +64
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Benchmark Results for unmodified programs 🚀
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is having the entire corelib necessary?
If it is, can we install it using makefile targets instead of having it in the repo? This will also mean less changes when the corelib is updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an example on how to use this new cli to the readme (similar to the cairo-vm-cli example)
…rft, needs cleaning)
…1-running-example
Cargo.toml
Outdated
@@ -69,6 +70,12 @@ bitvec = { version = "1", default-features = false, features = ["alloc"] } | |||
cairo-lang-starknet = { version = "2.1.0-rc2", default-features = false } | |||
cairo-lang-casm = { version = "2.1.0-rc2", default-features = false } | |||
|
|||
cairo-lang-compiler = { version = "2.1.0-rc2", default-features = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you pin the cairo compiler crates to 2.1.0-rc2 but then you compile the contracts with cairo 2.2.0, this can lead to errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually cargo working in our favour, as depsite the version being pinned to "2.1.0-rc2", the "2.2.0" version is the one downloaded. But ill change it to avoid confusions
cairo1-run/Cargo.toml
Outdated
# To match the cairo-vm version used by cairo-lang-runner crate | ||
cairo-vm = {version = "0.8.2", features = ["std"]} | ||
|
||
cairo-lang-sierra-type-size = { version = "2.1.0-rc2", default-features = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
deps: | ||
git clone https://github.com/starkware-libs/cairo.git \ | ||
&& cd cairo \ | ||
&& git checkout v2.2.0 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is where the 2.2.0 version of the compiler is downloaded
This PR shows the minimal steps required for running a Cairo 1 program, as it can be found in the StarkWare's cairo repo.
It is done with a simple fibonacci Cairo 1 program. The sierra code can be read directly from the
fibonacci.sierra
file or compiled inside the example.To test it, just run
cargo run
inside thecairo1-run
repo.