Skip to content

Commit

Permalink
feat: bump to cairo 2.9.2 (#2879)
Browse files Browse the repository at this point in the history
* wip: deps versionning

* fix: add missing scarb field

* chore: bump scarb

* fix blockifier changes

* fix: update scarb related code for testing

* fix blockifier resource bounds mapping

* bump scarb version

* cairo fmt

* tests: regenerate test databases

* fix: bump cainome to fix event parsing

* fix: clippy

* fix contract call

* add test for calling non legacy contract

* wip: fixing cairo compilation

* chore: bump to cairo 2.9.2

* chore: update scarb

* fix: fmt and scarb update

* tests: regenerates test dbs

* fix: migrate to new scarb test functions

* tests: regenerate test db

* tests: regenerate test db

* ci: add scarb for test commands since it depends on scarb metadata

* fix(core-cairo-test): build external world class and adjust panick messages

* feat: don't enforce fee if tx max fee is zero

* chore: bump scarb

* fix: add better error message if env var SCARB is not correctly set

* tests: regenerate test db and update addresses in cairo config

* only modify if we're in fee enabled mode

* tests: fix test policies

* ci: use rust 181 devcontainer

* tests: regenerate test db

* ci: wip

* ci+docker: move to ubuntu:noble

* ci: add back dojo-dev image for test

* ci: add the container to build for the same version

* docker: add make to devcontainer

* ci: use latest dojo-dev

* docker: revert to bookworm for dojo image

* fix(devcontainer): add missing dependencies for testing

* ci: bump devcontainer

* tests: regenerate test db

---------

Co-authored-by: Ammar Arif <[email protected]>
  • Loading branch information
glihm and kariy authored Jan 17, 2025
1 parent 4b6d473 commit b37b325
Show file tree
Hide file tree
Showing 120 changed files with 1,861 additions and 1,780 deletions.
26 changes: 7 additions & 19 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/rust/.devcontainer/base.Dockerfile
# See here for image contents: https://hub.docker.com/layers/library/rust/1.81.0-slim/images/sha256-ba4ee661bb466ab49f6ceb8c6d9e9f9784bba7c6e45225187cd3c7fb1fbc12ce

# [Choice] Debian OS version (use bookworm on local arm64/Apple Silicon): buster, bullseye, bookworm

ARG VARIANT
FROM mcr.microsoft.com/vscode/devcontainers/rust:${VARIANT}
ARG VARIANT
ARG RUST_VERSION=1.81.0
FROM rust:${RUST_VERSION}-slim
ARG RUST_VERSION

# Install additional packages
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends protobuf-compiler libprotobuf-dev libclang-dev libzstd-dev

RUN apt install -y gh libgmp3-dev software-properties-common
&& apt-get -y install --no-install-recommends protobuf-compiler libprotobuf-dev libclang-dev libzstd-dev make pkg-config libssl-dev

# Install Cairo Native dependencies
RUN curl -s https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc > /dev/null
RUN echo "deb http://apt.llvm.org/${VARIANT}/ llvm-toolchain-${VARIANT}-17 main" | tee /etc/apt/sources.list.d/llvm.list && apt-get update
RUN apt-get -y install -t llvm-toolchain-${VARIANT}-17 llvm-17 llvm-17-dev llvm-17-runtime clang-17 clang-tools-17 lld-17 libpolly-17-dev libmlir-17-dev mlir-17-tools
RUN apt-get install -y gh libgmp3-dev software-properties-common curl git

RUN curl -L https://foundry.paradigm.xyz/ | bash && . /root/.bashrc && foundryup
ENV PATH="${PATH}:/root/.foundry/bin"

# To build Katana with 'native' feature, we need to set the following environment variables
ENV MLIR_SYS_170_PREFIX=/usr/lib/llvm-17
ENV LLVM_SYS_170_PREFIX=/usr/lib/llvm-17
ENV TABLEGEN_170_PREFIX=/usr/lib/llvm-17

# To allow independent workflow of the container, the rust-toolchain is explicitely given.
RUN echo "1.80.0" > rust_toolchain_version
RUN echo ${RUST_VERSION} > rust_toolchain_version
# Make sure to sync the nightly version with the scripts in ./scripts
RUN echo "nightly-2024-08-28" > nightly_rust_toolchain_version

Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.80.0
RUST_VERSION: 1.81.0

jobs:
build:
runs-on: ubuntu-latest-4-cores
needs: [fmt, cairofmt]
container:
image: ghcr.io/dojoengine/dojo-dev:rust181bookworm2
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -32,7 +34,7 @@ jobs:
needs: ensure-docker
runs-on: ubuntu-latest-32-cores
container:
image: ghcr.io/dojoengine/dojo-dev:v1.0.12
image: ghcr.io/dojoengine/dojo-dev:rust181bookworm2
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -58,7 +60,7 @@ jobs:
runs-on: ubuntu-latest
needs: [fmt, cairofmt]
container:
image: ghcr.io/dojoengine/dojo-dev:v1.0.12
image: ghcr.io/dojoengine/dojo-dev:rust181bookworm2
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -92,7 +94,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
container:
image: debian:bookworm-slim
image: ubuntu:noble
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -114,7 +116,7 @@ jobs:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.8.4"
scarb-version: "2.9.2"
- run: |
scarb --manifest-path examples/spawn-and-move/Scarb.toml fmt --check
scarb --manifest-path examples/simple/Scarb.toml fmt --check
Expand All @@ -124,9 +126,10 @@ jobs:
dojo-core-test:
needs: build
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:v1.0.12
steps:
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.9.2"
- uses: actions/download-artifact@v4
with:
name: dojo-bins
Expand All @@ -140,9 +143,10 @@ jobs:
dojo-spawn-and-move-example-test:
needs: build
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:v1.0.12
steps:
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.9.2"
- uses: actions/download-artifact@v4
with:
name: dojo-bins
Expand All @@ -157,7 +161,7 @@ jobs:
runs-on: ubuntu-latest-4-cores
needs: [fmt, cairofmt]
container:
image: ghcr.io/dojoengine/dojo-dev:v1.0.12
image: ghcr.io/dojoengine/dojo-dev:rust181bookworm2
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -166,7 +170,7 @@ jobs:
fmt:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:v1.0.12
image: ghcr.io/dojoengine/dojo-dev:rust181bookworm2
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -176,7 +180,7 @@ jobs:
runs-on: ubuntu-latest
needs: [fmt, cairofmt]
container:
image: ghcr.io/dojoengine/dojo-dev:v1.0.12
image: ghcr.io/dojoengine/dojo-dev:rust181bookworm2
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) }}
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' }}
file: .devcontainer/Dockerfile
tags: ghcr.io/${{ github.repository }}-dev:latest,ghcr.io/${{ github.repository }}-dev:${{ env.DOCKER_TAG }}
build-args: |
VARIANT=bookworm
RUST_VERSION=1.81.0
BUILD_TYPE=${{ github.event_name }}
DOJO_VERSION=${{ github.event.release.tag_name }}
platforms: linux/amd64,linux/arm64
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scarb 2.8.4
scarb 2.9.2
starknet-foundry 0.30.0
Loading

0 comments on commit b37b325

Please sign in to comment.