Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

chore: monorepo #1456

Merged
merged 56 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
53776a3
chore: import ssj
obatirou Sep 30, 2024
99672e9
chore: move sources to kakarot0/src
obatirou Oct 1, 2024
f6d8bfa
chore: add scarb and snforge tool-versions root
obatirou Oct 1, 2024
99901f5
chore: ssj compiled contracts
obatirou Oct 1, 2024
0968c3f
fix trunk issues
obatirou Oct 1, 2024
1966404
ci: fix path ssj
obatirou Oct 1, 2024
4d8450d
ci: trigger respective workflow on filtered paths
obatirou Oct 1, 2024
19cd373
ci: move files to workflows folder
obatirou Oct 1, 2024
06700f6
ci: rename ssj github jobs
obatirou Oct 1, 2024
a0c0baa
ci: concurrency by name
obatirou Oct 1, 2024
c02b975
ci: cd into ssj
obatirou Oct 1, 2024
4b1083f
ci: supply tool-versions scarb
obatirou Oct 1, 2024
719d29f
ci: typo
obatirou Oct 1, 2024
6a57f76
ci: use ssj tool-versions
obatirou Oct 1, 2024
b0ea84b
ci: install python and use tool-versions ssj
obatirou Oct 1, 2024
fd4c456
ci: fix path ssj-build
obatirou Oct 1, 2024
98d0701
chore: unified devcontainer
obatirou Oct 1, 2024
7a85931
chore: deployer docker use uv
obatirou Oct 1, 2024
a521056
chore: move zellic audit to kakarot0 folder
obatirou Oct 1, 2024
8bb0a86
chore: update devcontainer
obatirou Oct 1, 2024
9915c25
chore: fix dockerfile
obatirou Oct 2, 2024
5d8a9b5
chore: remove unecessary target
obatirou Oct 2, 2024
df04d2f
refactor: move cairo1_contracts to root
obatirou Oct 2, 2024
f8587fb
chore: update kakarot-ssj blockchain-tests-skip
obatirou Oct 2, 2024
a187daf
ci: fix skip file ef-test ssj
obatirou Oct 2, 2024
19f1e08
refactor: rename folder for cairo and cairo_zero
obatirou Oct 2, 2024
2e1970f
update ssj
obatirou Oct 2, 2024
f355e8b
chore: fix trunk
obatirou Oct 2, 2024
3d21034
chore: rename audit folder
obatirou Oct 2, 2024
943aa36
ci: rename workflows file and fix sparse-checkout
obatirou Oct 2, 2024
9fd50a7
ci: fix concurrency
obatirou Oct 2, 2024
c1b76a7
ci: fix skip file ssj ef-tests
obatirou Oct 2, 2024
45221d3
chore: update ssj
obatirou Oct 2, 2024
dd433be
ci: sparse checkout
obatirou Oct 2, 2024
54c4f02
fix: add missing mandatory fields
obatirou Oct 2, 2024
fbcc5c5
fix: add missing mandatory fields
obatirou Oct 2, 2024
e6a2dd0
fix: add missing mandatory fields
obatirou Oct 3, 2024
b48c7ed
chore: merge .env.example
obatirou Oct 3, 2024
e0a216f
chore: merge .gitignore
obatirou Oct 3, 2024
20e337e
chore: remove unecessary rust-toolchain
obatirou Oct 3, 2024
c0792f5
chore: remove unecessary files ssj
obatirou Oct 3, 2024
8487351
style: trunk fmt
obatirou Oct 3, 2024
f412117
fix: npm audit fix
obatirou Oct 3, 2024
a71b790
ci: merge trunk workflows
obatirou Oct 3, 2024
b371b7e
refactor: move cairo_zero unit tests
obatirou Oct 3, 2024
b36e8ca
update SSJ
obatirou Oct 4, 2024
8bfa101
style: trunk fmt
obatirou Oct 4, 2024
a27c49d
style: trunk check
obatirou Oct 4, 2024
2840b79
ci: fix ssj release
obatirou Oct 4, 2024
6d46f7f
update ef test skipfile ssj
obatirou Oct 4, 2024
74bb7a7
apply review
obatirou Oct 4, 2024
d845a16
fix: ssj script
obatirou Oct 4, 2024
2c8fb60
update ssj skip file
obatirou Oct 4, 2024
c68f593
fix ef-tests resources
obatirou Oct 7, 2024
8bdf75b
update ssj
obatirou Oct 7, 2024
630eaa8
update skipfile ssj
obatirou Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,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
obatirou marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml → .github/workflows/cairo-zero-ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
name: CI
name: cairo-zero-CI

on:
push:
branches:
- main
pull_request: {}
pull_request:
paths:
- cairo_zero/**

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 @@ -32,7 +34,7 @@ jobs:
with:
filters: |
src:
- 'src/**'
- 'cairo_zero/**'
kakarot_scripts:
- 'kakarot_scripts/**'
solidity:
Expand Down Expand Up @@ -96,7 +98,7 @@ jobs:
- name: Run tests
env:
HYPOTHESIS_PROFILE: ci
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,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
84 changes: 84 additions & 0 deletions .github/workflows/ssj-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: SSJ-CI

on:
push:
branches:
- main
paths:
- cairo/kakarot-ssj/**

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

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

permissions: read-all

jobs:
ssj-build:
uses: ./.github/workflows/ssj-build.yml
with:
artifact-name: ssj-build

ssj-tests-unit:
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]
with:
artifact-name: ssj-build

ssj-resources:
runs-on: ubuntu-latest
needs: [ssj-ef-tests]
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.10.14
uses: actions/setup-python@v4
with:
python-version: 3.10.14

- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- run: poetry config installer.modern-installation false

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
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"
129 changes: 129 additions & 0 deletions .github/workflows/ssj-ef-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: SSJ-EF-Tests

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

permissions: read-all

jobs:
ef-tests:
# trunk-ignore(actionlint/runner-label)
runs-on: ubuntu-latest-16-cores
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache cairo-native setup
id: cache-cairo-native
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
cairo/kakarot-ssj/target/
./libcairo_native_runtime.a
key:
${{ runner.os }}-cairo-native-${{ hashFiles('**/Cargo.lock',
'scripts/setup_cairo_native.sh') }}

- name: Make setup script executable
run: chmod +x ./cairo/kakarot-ssj/scripts/setup_cairo_native.sh

- name: Setup Cairo Native
run: |
if [[ "${{ steps.cache-cairo-native.outputs.cache-hit }}" == 'true' ]]; then
sudo ./cairo/kakarot-ssj/scripts/setup_cairo_native.sh -s
else
sudo ./cairo/kakarot-ssj/scripts/setup_cairo_native.sh
fi

- name: Set Environment Variables
run: |
echo "MLIR_SYS_190_PREFIX=/usr/lib/llvm-19/" >> $GITHUB_ENV
echo "LLVM_SYS_191_PREFIX=/usr/lib/llvm-19/" >> $GITHUB_ENV
echo "TABLEGEN_190_PREFIX=/usr/lib/llvm-19/" >> $GITHUB_ENV
echo "CAIRO_NATIVE_RUNTIME_LIBRARY=$(pwd)/libcairo_native_runtime.a" >> $GITHUB_ENV

- name: Checkout ef-tests
uses: actions/checkout@v4
with:
repository: kkrt-labs/ef-tests
ref: feat/cairo-native
path: ef-tests # Check out to a subdirectory to avoid cleaning the kakarot-ssj directory

- name: Checkout local skip file
uses: actions/checkout@v4
with:
sparse-checkout: |
cairo/kakarot-ssj/
sparse-checkout-cone-mode: false
path: skip-file

- name: Setup ef-tests
run: |
mv skip-file/cairo/kakarot-ssj/blockchain-tests-skip.yml ef-tests/blockchain-tests-skip.yml
cd ef-tests
mkdir -p build/common
make setup setup-kakarot-v0

- name: Install nextest
uses: taiki-e/install-action@nextest

- name: Download Kakarot-SSJ build artifacts in v1
uses: actions/download-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: ef-tests/build/v1

- name: Move Cairo1Helpers
run: |
mv ef-tests/build/v1/contracts_Cairo1Helpers.compiled_contract_class.json \
ef-tests/build/common/cairo1_helpers.json

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.10.14

# Add this step to verify the file exists
- name: Verify libcairo_native_runtime.a
run: |
echo $CAIRO_NATIVE_RUNTIME_LIBRARY
ls -l $CAIRO_NATIVE_RUNTIME_LIBRARY

- name: Run tests
working-directory: ef-tests
run: |
set -o pipefail
RUST_MIN_STACK=1342177280 make ef-test-v1-native | tee test_v1.out
set +o pipefail

- name: Retrieve ef-tests execution resources
working-directory: ef-tests
run: python scripts/compute_resources.py
env:
KAKAROT_VERSION: v1

- name: Upload resources
uses: actions/upload-artifact@v3
with:
path: ef-tests/resources
name: resources

- name: Generate blockchain-tests-skip.yml file
if: github.event_name == 'workflow_dispatch'
working-directory: ef-tests
run: make generate-skip-file

- name: Upload skip file
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v3
with:
path: ef-tests/blockchain-tests-skip.yml
name: blockchain-tests-skip
30 changes: 30 additions & 0 deletions .github/workflows/ssj-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# trunk-ignore-all(checkov/CKV2_GHA_1)
name: SSJ-Release

on:
release:
types: [published]

jobs:
build-and-upload:
runs-on: ubuntu-latest
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: Zip dev artifacts
run: zip -rj kakarot-ssj-build.zip cairo/kakarot-ssj/target/dev
- name: Upload artifacts to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: kakarot-ssj-build.zip
asset_name: kakarot-ssj-build.zip
tag: ${{ github.ref_name }}
overwrite: true
Loading
Loading