forked from starkware-libs/cairo-lang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f9ac4c1
Showing
225 changed files
with
24,798 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/build/ | ||
__pycache__/ | ||
cairo-starkware-*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "repos/starkware-public"] | ||
path = repos/starkware-public | ||
url = [email protected]:starkware-libs/starkex-resources-wip.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
cmake_minimum_required (VERSION 3.5) | ||
|
||
project(CairoLang VERSION 0.1.0) | ||
include(CTest) | ||
|
||
enable_testing() | ||
|
||
if (NOT DEFINED CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
endif() | ||
|
||
# Python library macro. | ||
find_program(PYTHON "python3") | ||
|
||
include("repos/starkware-public/cmake_utils/exe_rules.cmake") | ||
include("repos/starkware-public/cmake_utils/python_rules.cmake") | ||
include("repos/starkware-public/cmake_utils/pip_rules.cmake") | ||
python_get_pip_deps(main_reqs | ||
python3.7:${CMAKE_SOURCE_DIR}/scripts/requirements-deps.json | ||
) | ||
|
||
# Repos needs to be first as it defines macros that are needed by src. | ||
add_subdirectory(repos) | ||
add_subdirectory(src) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM ubuntu:18.04 | ||
|
||
RUN apt update | ||
RUN apt install -y cmake python3.7 libgmp3-dev g++ python3-pip python3.7-dev npm | ||
|
||
COPY . /app/ | ||
|
||
# Build. | ||
WORKDIR /app/ | ||
RUN ./build.sh | ||
|
||
WORKDIR /app/build/Release | ||
RUN make all -j8 | ||
|
||
# Run tests. | ||
RUN ctest -V | ||
|
||
# Build the Visual Studio Code extension. | ||
WORKDIR /app/src/starkware/cairo/lang/ide/vscode-cairo | ||
RUN npm install -g vsce | ||
RUN npm install | ||
RUN vsce package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
The files in this repository are governed by several licenses, | ||
which are located under the licenses/ directory. | ||
|
||
All code in this project except for the files under | ||
'src/starkware/cairo/apps/starkex2_0/' and its subdirectories is | ||
subject to the Cairo Toolchain License (Source Available), which | ||
can be found under 'licenses/CairoToolchainLicense.txt'. | ||
|
||
The code under 'src/starkware/cairo/apps/starkex2_0/' and its | ||
subdirectories is subject to the Cairo Program License (Source | ||
Available), which can be found under | ||
'licenses/CairoProgramLicense.txt'. | ||
|
||
For more infromation regarding licenses visit | ||
https://starkware.co/licenses/. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Introduction | ||
|
||
[Cairo](https://cairo-lang.org/) is a programming language for writing provable programs. | ||
|
||
# Documentation | ||
|
||
The Cairo documentation consists of two parts: "Hello Cairo" and "How Cairo Works?". | ||
Both parts can be found in https://cairo-lang.org/docs/. | ||
|
||
We recommend starting from [Setting up the environment](https://cairo-lang.org/docs/quickstart.html). | ||
|
||
# Installation instructions | ||
|
||
You should be able to download the python package zip file directly from | ||
[github](https://github.com/starkware-libs/cairo-lang/releases/tag/v0.0.1) | ||
and install it using ``pip``. | ||
See [Setting up the environment](https://cairo-lang.org/docs/quickstart.html). | ||
|
||
However, if you want to build it yourself, you can build it from the git repository. | ||
It is recommended to run the build inside a docker (as explained below), | ||
since it guarantees that all the dependencies | ||
are installed. Alternatively, you can try following the commands in the | ||
[docker file](https://github.com/starkware-libs/cairo-lang/blob/master/Dockerfile). | ||
|
||
## Building using the dockerfile | ||
|
||
The root directory holds a dedicated Dockerfile, which automatically builds the package and runs | ||
the unit tests on a simulated Ubuntu 18.04 environment. | ||
|
||
Clone the repository and initialize the git submodules using: | ||
|
||
```bash | ||
> git clone [email protected]:starkware-libs/cairo-lang.git | ||
> cd cairo-lang | ||
> git submodule update --init | ||
``` | ||
|
||
Build the docker image: | ||
|
||
```bash | ||
> docker build --tag cairo . | ||
``` | ||
|
||
If everything works, you should see | ||
|
||
```bash | ||
Successfully tagged cairo:latest | ||
``` | ||
|
||
Once the docker image is built, you can fetch the python package zip file using: | ||
|
||
```bash | ||
> container_id=$(docker create cairo) | ||
> docker cp ${container_id}:/app/cairo-starkware-0.0.1.zip . | ||
> docker rm -v ${container_id} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
set -e | ||
|
||
mkdir -p build/Release | ||
( | ||
cd build/Release | ||
cmake ../.. -DCMAKE_BUILD_TYPE=Release | ||
make -j8 cairo_lang_venv | ||
) | ||
|
||
VENV_SITE_DIR=build/Release/src/starkware/cairo/lang/cairo_lang_venv-site | ||
cp src/starkware/cairo/lang/setup.py ${VENV_SITE_DIR} | ||
cp src/starkware/cairo/lang/MANIFEST.in ${VENV_SITE_DIR} | ||
cp scripts/requirements-gen.txt ${VENV_SITE_DIR}/requirements.txt | ||
( cd ${VENV_SITE_DIR}; python3 setup.py sdist --format=zip ) | ||
cp ${VENV_SITE_DIR}/dist/cairo-starkware-0.0.1.zip . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Cairo Program License (Source Available) | ||
|
||
Version 1.0, November 2020 | ||
|
||
This license contains the terms and conditions under which StarkWare | ||
Industries, Ltd ("StarkWare") makes available its StarkEx Cairo Software | ||
("Cairo Software"). Your use of the Cairo Software is subject to these | ||
terms and conditions. | ||
|
||
StarkWare grants you a license to use and distribute the Cairo Software | ||
during the Test Period, only for writing Cairo programs. The Cairo Verifier | ||
Smart Contract ("Verifier") is not part of the Cairo Software and is | ||
subject to a separate license. The "Test Period" will end on June 30, 2021, | ||
however, StarkWare may extend this date by posting a notice of extension | ||
referencing this license on its web site | ||
https://www.starkware.co/source-available-license/. | ||
|
||
These terms do not allow you to sublicense or transfer any of your rights to | ||
anyone else. These terms do not imply any other licenses not expressly | ||
granted in this license. | ||
|
||
If you violate any of these terms, use the Cairo Software in a way not | ||
authorized under this license, your license ends immediately. If you make, | ||
or authorize any other person to make, any written claim that the Cairo | ||
Software infringes or contributes to infringement of any patent, all rights | ||
you are granted under this license end immediately. In either case, for | ||
purposes of your license, the Test Period will end. | ||
|
||
After the end of the Test Period, you will not be licensed to use the Cairo | ||
Software to write Cairo programs, but you may retain and distribute copies of | ||
the Cairo Software only as needed to allow Ethereum nodes to sync with the | ||
Ethereum Mainnet and verify Ethereum transactions. | ||
|
||
As far as the law allows, the Cairo Software is provided AS IS, without any | ||
warranty or condition, and StarkWare will not be liable to you for any damages | ||
arising out of these terms or the use or nature of the Cairo Software and/or | ||
the Verifier, under any kind of legal claim. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Cairo Toolchain License (Source Available) | ||
|
||
Version 1.0 dated December 22, 2020 | ||
|
||
This license contains the terms and conditions under which StarkWare | ||
Industries, Ltd ("StarkWare") makes available its Cairo Toolchain | ||
("Toolchain"). Your use of the Toolchain is subject to these terms and | ||
conditions. | ||
|
||
StarkWare grants you ("Licensee") a license to use the Toolchain, only | ||
for the purpose of developing and compiling Cairo programs. Licensee's | ||
use of the Toolchain is limited to non-commercial use, which means academic, | ||
scientific, or research and development use, or evaluating the Cairo | ||
language and Toolchain. | ||
|
||
StarkWare grants Licensee a license to modify the Toolchain, only as | ||
necessary to fix errors. Licensee may, but is not obligated to, provide | ||
any of Licensee's modifications to StarkWare. This license grants Licensee no | ||
right to distribute the Toolchain or make copies of the Toolchain available | ||
to others. | ||
|
||
These terms do not allow Licensee to sublicense or transfer any of Licensee's | ||
rights to anyone else. These terms do not imply any other licenses not | ||
expressly granted in this license. | ||
|
||
If Licensee violates any of these terms, or uses the Toolchain in a way not | ||
authorized under this license, the license granted to Licensee ends immediately. | ||
If Licensee makes, or authorizes any other person to make, any written claim | ||
that the Toolchain infringes or contributes to infringement of any patent, all | ||
rights granted to Licensee under this license end immediately. | ||
|
||
As far as the law allows, the Toolchain is provided AS IS, without any warranty | ||
or condition, and StarkWare will not be liable to Licensee for any damages | ||
arising out of these terms or the use or nature of the Toolchain, under any kind | ||
of legal claim. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory(starkware-public) |
Submodule starkware-public
added at
24bb51
Oops, something went wrong.