Skip to content

Commit

Permalink
Cairo v0.0.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
liorgold2 committed Jan 25, 2021
1 parent 993d129 commit e4d44d2
Show file tree
Hide file tree
Showing 59 changed files with 849 additions and 355 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/build/
__pycache__/
cairo-starkware-*.zip
cairo-lang-*.zip
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ WORKDIR /app/src/starkware/cairo/lang/ide/vscode-cairo
RUN npm install -g vsce
RUN npm install
RUN vsce package

WORKDIR /app/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ We recommend starting from [Setting up the environment](https://cairo-lang.org/d
# 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)
[github](https://github.com/starkware-libs/cairo-lang/releases/tag/v0.0.2)
and install it using ``pip``.
See [Setting up the environment](https://cairo-lang.org/docs/quickstart.html).

Expand Down Expand Up @@ -55,7 +55,7 @@ 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 cp ${container_id}:/app/cairo-lang-0.0.2.zip .
> docker rm -v ${container_id}
```

3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ 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
cp README.md ${VENV_SITE_DIR}
( cd ${VENV_SITE_DIR}; python3 setup.py sdist --format=zip )
cp ${VENV_SITE_DIR}/dist/cairo-starkware-0.0.1.zip .
cp ${VENV_SITE_DIR}/dist/cairo-lang-$(cat src/starkware/cairo/lang/VERSION).zip .
10 changes: 5 additions & 5 deletions src/starkware/cairo/apps/starkex2_0/execute_batch.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# * The license can be found in: licenses/CairoProgramLicense.txt *
# ***********************************************************************

from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin, SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.dict import DictAccess
from starkware.cairo.apps.starkex2_0.dex_context import DexContext
from starkware.cairo.apps.starkex2_0.execute_false_full_withdrawal import execute_false_full_withdrawal
from starkware.cairo.apps.starkex2_0.execute_modification import ModificationOutput
from starkware.cairo.apps.starkex2_0.execute_modification import execute_modification
from starkware.cairo.apps.starkex2_0.execute_false_full_withdrawal import (
execute_false_full_withdrawal)
from starkware.cairo.apps.starkex2_0.execute_modification import (
ModificationOutput, execute_modification)
from starkware.cairo.apps.starkex2_0.execute_settlement import execute_settlement
from starkware.cairo.apps.starkex2_0.execute_transfer import execute_transfer

Expand Down
9 changes: 3 additions & 6 deletions src/starkware/cairo/apps/starkex2_0/execute_limit_order.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
# * The license can be found in: licenses/CairoProgramLicense.txt *
# ***********************************************************************

from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin, SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.dict import DictAccess
from starkware.cairo.apps.starkex2_0.common.merkle_update import merkle_update
from starkware.cairo.apps.starkex2_0.dex_constants import BALANCE_BOUND
from starkware.cairo.apps.starkex2_0.dex_constants import EXPIRATION_TIMESTAMP_BOUND
from starkware.cairo.apps.starkex2_0.dex_constants import NONCE_BOUND
from starkware.cairo.apps.starkex2_0.dex_constants import PackedOrderMsg
from starkware.cairo.apps.starkex2_0.dex_constants import (
BALANCE_BOUND, EXPIRATION_TIMESTAMP_BOUND, NONCE_BOUND, PackedOrderMsg)
from starkware.cairo.apps.starkex2_0.dex_context import DexContext
from starkware.cairo.apps.starkex2_0.vault_update import vault_update_diff
from starkware.cairo.apps.starkex2_0.verify_order_signature import verify_order_signature
Expand Down
3 changes: 1 addition & 2 deletions src/starkware/cairo/apps/starkex2_0/execute_settlement.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# * The license can be found in: licenses/CairoProgramLicense.txt *
# ***********************************************************************

from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin, SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.dict import DictAccess
from starkware.cairo.apps.starkex2_0.dex_constants import BALANCE_BOUND
from starkware.cairo.apps.starkex2_0.dex_context import DexContext
Expand Down
9 changes: 3 additions & 6 deletions src/starkware/cairo/apps/starkex2_0/execute_transfer.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
# * The license can be found in: licenses/CairoProgramLicense.txt *
# ***********************************************************************

from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin, SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.dict import DictAccess
from starkware.cairo.apps.starkex2_0.common.merkle_update import merkle_update
from starkware.cairo.apps.starkex2_0.dex_constants import BALANCE_BOUND
from starkware.cairo.apps.starkex2_0.dex_constants import EXPIRATION_TIMESTAMP_BOUND
from starkware.cairo.apps.starkex2_0.dex_constants import NONCE_BOUND
from starkware.cairo.apps.starkex2_0.dex_constants import PackedOrderMsg
from starkware.cairo.apps.starkex2_0.dex_constants import (
BALANCE_BOUND, EXPIRATION_TIMESTAMP_BOUND, NONCE_BOUND, PackedOrderMsg)
from starkware.cairo.apps.starkex2_0.dex_context import DexContext
from starkware.cairo.apps.starkex2_0.vault_update import vault_update_diff
from starkware.cairo.apps.starkex2_0.verify_order_signature import verify_order_signature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin
from starkware.cairo.apps.starkex2_0.common.dict import DictAccess
from starkware.cairo.apps.starkex2_0.vault_update import compute_vault_hash
from starkware.cairo.apps.starkex2_0.vault_update import VaultState
from starkware.cairo.apps.starkex2_0.vault_update import VaultState, compute_vault_hash

# Gets a single pointer to a vault state and outputs the hash of that vault.
func hash_vault_state_ptr(hash_ptr : HashBuiltin*, vault_state_ptr : VaultState*) -> (
Expand Down
6 changes: 2 additions & 4 deletions src/starkware/cairo/apps/starkex2_0/main.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

%builtins output pedersen range_check ecdsa

from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.dict import DictAccess
from starkware.cairo.apps.starkex2_0.common.dict import squash_dict
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin, SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.dict import DictAccess, squash_dict
from starkware.cairo.apps.starkex2_0.common.merkle_multi_update import merkle_multi_update
from starkware.cairo.apps.starkex2_0.dex_context import make_dex_context
from starkware.cairo.apps.starkex2_0.execute_batch import execute_batch
Expand Down
3 changes: 1 addition & 2 deletions src/starkware/cairo/apps/starkex2_0/vault_update.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin
from starkware.cairo.apps.starkex2_0.common.dict import DictAccess
from starkware.cairo.apps.starkex2_0.common.merkle_update import merkle_update
from starkware.cairo.apps.starkex2_0.dex_constants import BALANCE_BOUND
from starkware.cairo.apps.starkex2_0.dex_constants import ZERO_VAULT_HASH
from starkware.cairo.apps.starkex2_0.dex_constants import BALANCE_BOUND, ZERO_VAULT_HASH

struct VaultState:
member stark_key = 0
Expand Down
3 changes: 2 additions & 1 deletion src/starkware/cairo/apps/starkex2_0/verify_order_id.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# * The license can be found in: licenses/CairoProgramLicense.txt *
# ***********************************************************************

from starkware.cairo.apps.starkex2_0.dex_constants import HASH_MESSAGE_BOUND as DEX_HASH_MESSAGE_BOUND
from starkware.cairo.apps.starkex2_0.dex_constants import (
HASH_MESSAGE_BOUND as DEX_HASH_MESSAGE_BOUND)
from starkware.cairo.apps.starkex2_0.dex_constants import ORDER_ID_BOUND as DEX_ORDER_ID_BOUND
from starkware.cairo.apps.starkex2_0.dex_constants import RANGE_CHECK_BOUND as DEX_RANGE_CHECK_BOUND

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# * The license can be found in: licenses/CairoProgramLicense.txt *
# ***********************************************************************

from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import SignatureBuiltin
from starkware.cairo.apps.starkex2_0.common.cairo_builtins import HashBuiltin, SignatureBuiltin
from starkware.cairo.apps.starkex2_0.dex_constants import PackedOrderMsg
from starkware.cairo.apps.starkex2_0.verify_order_id import verify_order_id

Expand Down
1 change: 1 addition & 0 deletions src/starkware/cairo/bootloader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ python_lib(cairo_hash_program_lib
LIBS
cairo_common_lib
cairo_compile_lib
cairo_version_lib
cairo_vm_crypto_lib
)

Expand Down
2 changes: 2 additions & 0 deletions src/starkware/cairo/bootloader/hash_program.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from starkware.cairo.common.hash_chain import compute_hash_chain
from starkware.cairo.lang.compiler.program import Program, ProgramBase
from starkware.cairo.lang.version import __version__
from starkware.cairo.lang.vm.crypto import get_crypto_lib_context_manager


Expand All @@ -21,6 +22,7 @@ def compute_program_hash_chain(program: ProgramBase, bootloader_version=0):
def main():
parser = argparse.ArgumentParser(
description='A tool to compute the hash of a cairo program')
parser.add_argument('-v', '--version', action='version', version=f'%(prog)s {__version__}')
parser.add_argument(
'--program', type=argparse.FileType('r'), required=True,
help='The name of the program json file.')
Expand Down
10 changes: 8 additions & 2 deletions src/starkware/cairo/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,28 @@ python_lib(cairo_common_lib
alloc.cairo
cairo_builtins.cairo
dict.cairo
dict_access.cairo
dict.py
find_element.cairo
hash.cairo
hash_chain.cairo
hash_chain.py
hash_state.cairo
math.cairo
hash.cairo
math_utils.py
math.cairo
memcpy.cairo
merkle_multi_update.cairo
merkle_update.cairo
registers.cairo
serialize.cairo
signature.cairo
small_merkle_tree.cairo
small_merkle_tree.py
squash_dict.cairo
${CAIRO_COMMON_LIB_ADDITIONAL_FILES}

LIBS
cairo_vm_crypto_lib
starkware_merkle_tree_lib
${CAIRO_COMMON_LIB_ADDITIONAL_LIBS}
)
Loading

0 comments on commit e4d44d2

Please sign in to comment.