Skip to content

Commit

Permalink
rebased on v0.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
antiyro committed Oct 23, 2024
2 parents 61fba0a + b8f5f2a commit 37efa50
Show file tree
Hide file tree
Showing 387 changed files with 49,474 additions and 914 deletions.
3 changes: 0 additions & 3 deletions .codespellignore

This file was deleted.

9 changes: 5 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,24 @@
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"editor.defaultFormatter": "trunk.io",
"cairols.sourceDir": "src",
"cairols.cairoPath": ["src", "tests"]
"cairols.sourceDir": "cairo_zero",
"cairols.cairoPath": ["cairo_zero", "tests"]
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"starkware.cairo",
"ericglau.cairo-ls",
"trunk.io"
"trunk.io",
"starkware.cairo1"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && curl -L https://foundry.paradigm.xyz | bash && /home/vscode/.foundry/bin/foundryup && make setup",
"postCreateCommand": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && curl -L https://foundry.paradigm.xyz | bash && /home/vscode/.foundry/bin/foundryup && curl -LsSf https://astral.sh/uv/install.sh | sh && . $HOME/.cargo/env && uv venv && make setup && curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
Expand Down
12 changes: 11 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ SHARINGAN_RPC_URL="https://sharingan.madara.zone"
STARKNET_DEVNET_ACCOUNT_ADDRESS=0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691
STARKNET_DEVNET_PRIVATE_KEY=0x71d7bb07b9a64f6f78ac4c816aff4da9

STARKNET_SEPOLIA_RELAYER_ACCOUNT_ADDRESS=
STARKNET_SEPOLIA_RELAYER_PRIVATE_KEY=
STARKNET_SEPOLIA_ACCOUNT_ADDRESS=
STARKNET_SEPOLIA_PRIVATE_KEY=

KATANA_ACCOUNT_ADDRESS=0xb3ff441a68610b30fd5e2abbf3a1548eb6ba6f3559f2862bf2dc757e5828ca
KATANA_PRIVATE_KEY=0x2bbf4f9fd0bbb2e60b0316c1fe0b76cf7a4d0198bd493ced9b8df2a3a24d68a

Expand All @@ -38,8 +43,9 @@ ACCOUNT_ADDRESS=
PRIVATE_KEY=

# An EVM private to define a default EOA for EVM related kakarot_scripts
STARKNET_SEPOLIA_EVM_PRIVATE_KEY=
# This default value is Anvil first account private key
EVM_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
KATANA_EVM_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

# Because cairo-land generated files used protobuf<=3.20 and web3.py uses protobuf ~4
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
Expand All @@ -52,3 +58,7 @@ HYPOTHESIS_PROFILE=dev

VOYAGER_API_URL=
VOYAGER_API_KEY=

# Private key to sign transactions for RLP scripts/compute_rlp_encoding.ts
# Warning: Do not use this key in production systems
PRIVATE_KEY_RLP_SCRIPT=0x6be0067ba259624aa28f796b703e7d095925a470b17786767bd09aaa3fc2ceea
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml → .github/workflows/cairo-zero-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: cairo-zero-CI

on:
push:
Expand All @@ -11,7 +11,7 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: cairo-zero-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: read-all
Expand All @@ -33,7 +33,7 @@ jobs:
with:
filters: |
src:
- 'src/**'
- 'cairo_zero/**'
kakarot_scripts:
- 'kakarot_scripts/**'
solidity:
Expand Down Expand Up @@ -65,7 +65,9 @@ jobs:
- uses: asdf-vm/actions/install@v3
- run: asdf install
- name: Compile all the cairo files
run: make build
run: |
cp .env.example .env
make build
- name: Uploads Kakarot build artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -97,7 +99,9 @@ jobs:
- name: Run tests
env:
HYPOTHESIS_PROFILE: ci
run: make test-unit
run: |
cp .env.example .env
make test-unit-cairo-zero
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
Expand All @@ -122,7 +126,7 @@ jobs:
- name: Extract Katana Version
id: extract_katana_version
run: |
KATANA_VERSION=$(grep -oP '^KATANA_VERSION = \K.*' Makefile)
KATANA_VERSION=$(grep -E "^KATANA_VERSION\s*=" kakarot_scripts/setup/setup.py | cut -d'"' -f2)
echo "katana_version=$KATANA_VERSION" >> "$GITHUB_OUTPUT"
- uses: astral-sh/setup-uv@v2
with:
Expand All @@ -144,7 +148,7 @@ jobs:
key: katana-${{ steps.extract_katana_version.outputs.katana_version }}
- name: Install Katana
if: steps.cached-katana.outputs.cache-hit != 'true'
run: make install-katana
run: make setup "katana"
- name: Run tests
run: |
cp .env.example .env
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: NIGHTLY-FUZZING
name: cairo-zero-NIGHTLY-FUZZING

on:
schedule:
Expand Down Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Run tests
env:
HYPOTHESIS_PROFILE: nightly
run: make test-unit
run: make test-unit-cairo-zero
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# trunk-ignore-all(checkov/CKV2_GHA_1)
name: Release
name: cairo-zero-Release

on:
release:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update Submodule
name: cairo-zero Update Submodule

on:
release:
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/ssj-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Reusable Build Workflow

on:
workflow_call:
inputs:
artifact-name:
required: true
type: string

permissions: read-all

jobs:
ssj-build:
runs-on: ubuntu-latest
env:
CI_COMMIT_MESSAGE: CI Formatting Auto Commit
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} CI
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Scarb
uses: software-mansion/setup-scarb@v1
with:
tool-versions: ./cairo/kakarot-ssj/.tool-versions

- name: Build contracts
run: cd cairo/kakarot-ssj/ && scarb build -p contracts

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: cairo/kakarot-ssj/target/dev
83 changes: 83 additions & 0 deletions .github/workflows/ssj-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: SSJ-CI

on:
push:
branches:
- main
pull_request: {}

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

concurrency:
group: ssj-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: read-all

jobs:
paths-filter:
runs-on: ubuntu-latest
outputs:
crates: ${{ steps.filter.outputs.crates }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
crates:
- 'cairo/kakarot-ssj/crates/**'
ssj-build:
needs: paths-filter
if: needs.paths-filter.outputs.crates == 'true'
uses: ./.github/workflows/ssj-build.yml
with:
artifact-name: ssj-build

ssj-tests-unit:
needs: paths-filter
if: needs.paths-filter.outputs.crates == 'true'
uses: ./.github/workflows/ssj-tests-unit.yml
with:
run-fmt-check: false

ssj-ef-tests:
uses: ./.github/workflows/ssj-ef-tests.yml
needs:
- ssj-build
- paths-filter
if: needs.paths-filter.outputs.crates == 'true'
with:
artifact-name: ssj-build

ssj-resources:
runs-on: ubuntu-latest
needs:
- ssj-ef-tests
- paths-filter
if: needs.paths-filter.outputs.crates == 'true'
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v2
with:
enable-cache: true
cache-dependency-glob: uv.lock
- uses: actions/setup-python@v5
with:
python-version-file: .python-version

- name: Install dependencies
run: make setup

- name: Load performance artifacts
uses: actions/download-artifact@v3
with:
path: resources
name: resources

- name: Check resources evolution
run: |
result=$(GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} make check-resources 2>&1)
echo "$result" >> "$GITHUB_STEP_SUMMARY"
Loading

0 comments on commit 37efa50

Please sign in to comment.