-
Notifications
You must be signed in to change notification settings - Fork 76
Add cairo1 compilers #348
base: main
Are you sure you want to change the base?
Add cairo1 compilers #348
Conversation
Do we? I'm assuming there will be no projects using Cairo0 ( |
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.
direction looks good! my main concern is that we might have to find a way to make nile work nicely with rust.
not sure if we should go for a full refactor in Rust, or simply distribute Nile as a binary/executable without requiring a venv nor pip install
that adapts to the new starknet CLI (or Rust modules that replace the current CLI nile depends on)
@@ -0,0 +1,7 @@ | |||
"""Cairo1 common.""" |
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.
i think we can remove this file and just replace variables in good ol' common/
if we drop Cairo0 support
Right. Then we can keep the same API.
Exactly, and being this rewrite probably a considerable effort, I'm leaning toward going for the full refactor in Rust. The main blocker I recognize for this is the stage of the cairo repository itself (documentation and features for starknet), but maybe is currently enough to replicate nile without re-implementing a lot? Should we work in parallel on python and rust versions already?
I think (from thinking quickly) this won't be considerably easier than reimplementing in Rust, so for long-term consistency, I would go for the full refactor. But I'm not sure how much effort will this take, from the current status of the cairo repository. |
This PR enables Nile to compile Cairo1 contracts, generating the corresponding
.sierra
and.casm
artifacts (alongside the extracted ABI).It is drafted for the reasons listed below:
compile-1
command in the CLI. This design was implemented just for testing purposes. We still need to define the API to expose both Cairo1 and Cairo0 compilers in the transition period (with starknet 0.11).How to test this branch:
pip install .
compile
command).nile compile-1 contracts/hello_starknet.cairo
to compile it (or change the path accordingly).artifacts/cairo1
directory (including sierra, casm and abi).Note that if you are not in macOS, you may need to re-compile the compilers and update them for your platform (in linux this is perhaps not required).