Skip to content

feat: bump to cairo 2.9.2 #2879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 47 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d5038b6
wip: deps versionning
glihm Dec 6, 2024
83bf801
fix: add missing scarb field
glihm Dec 6, 2024
1fb3e30
chore: bump scarb
glihm Dec 6, 2024
4a3ade9
fix blockifier changes
kariy Dec 6, 2024
4ce7374
fix: update scarb related code for testing
glihm Dec 6, 2024
b60db4c
fix blockifier resource bounds mapping
kariy Dec 10, 2024
60d43dd
Merge branch 'main' into feat/cairo-291
kariy Dec 10, 2024
3126333
bump scarb version
kariy Dec 10, 2024
e380dda
cairo fmt
kariy Dec 10, 2024
5e77d22
tests: regenerate test databases
glihm Dec 10, 2024
e71beff
fix: bump cainome to fix event parsing
glihm Dec 10, 2024
914af81
fix: clippy
glihm Dec 10, 2024
fdd0956
fix contract call
kariy Dec 11, 2024
1deee22
add test for calling non legacy contract
kariy Dec 11, 2024
318571a
wip: fixing cairo compilation
glihm Dec 11, 2024
0f5b8c0
merge main
glihm Jan 8, 2025
4c3c27b
chore: bump to cairo 2.9.2
glihm Jan 8, 2025
c04cdc6
chore: update scarb
glihm Jan 8, 2025
443f034
fix: fmt and scarb update
glihm Jan 8, 2025
9f0d3c4
tests: regenerates test dbs
glihm Jan 8, 2025
60f97aa
fix: migrate to new scarb test functions
glihm Jan 15, 2025
68680d6
tests: regenerate test db
glihm Jan 15, 2025
2fb4521
merge main
glihm Jan 15, 2025
ce9a8e9
tests: regenerate test db
glihm Jan 15, 2025
7415519
ci: add scarb for test commands since it depends on scarb metadata
glihm Jan 15, 2025
703a066
fix(core-cairo-test): build external world class and adjust panick me…
glihm Jan 15, 2025
58007e2
feat: don't enforce fee if tx max fee is zero
kariy Jan 16, 2025
b4bf759
merge main
glihm Jan 16, 2025
972c147
chore: bump scarb
glihm Jan 16, 2025
d3e8aba
fix: add better error message if env var SCARB is not correctly set
glihm Jan 16, 2025
0872858
tests: regenerate test db and update addresses in cairo config
glihm Jan 16, 2025
b559ab2
only modify if we're in fee enabled mode
kariy Jan 16, 2025
545cc07
tests: fix test policies
glihm Jan 16, 2025
231b228
ci: use rust 181 devcontainer
glihm Jan 16, 2025
27d499a
tests: regenerate test db
glihm Jan 16, 2025
9f0efd1
ci: wip
glihm Jan 16, 2025
64d0877
ci+docker: move to ubuntu:noble
glihm Jan 17, 2025
4b2a7c0
merge main
glihm Jan 17, 2025
c4ba5bf
ci: add back dojo-dev image for test
glihm Jan 17, 2025
767be0f
merge main
glihm Jan 17, 2025
6fbdccf
ci: add the container to build for the same version
glihm Jan 17, 2025
ef8ec48
docker: add make to devcontainer
glihm Jan 17, 2025
3500f1d
ci: use latest dojo-dev
glihm Jan 17, 2025
44c0358
docker: revert to bookworm for dojo image
glihm Jan 17, 2025
f3cced0
fix(devcontainer): add missing dependencies for testing
glihm Jan 17, 2025
3bccc10
ci: bump devcontainer
glihm Jan 17, 2025
81d1a02
tests: regenerate test db
glihm Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

Comment on lines +17 to 19
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ohayo sensei! The nightly toolchain date needs attention.

The nightly toolchain is set to a future date (2024-08-28) which doesn't exist yet. This will cause the build to fail.

-RUN echo "nightly-2024-08-28" > nightly_rust_toolchain_version
+RUN echo "nightly-2024-01-28" > nightly_rust_toolchain_version
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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
RUN echo ${RUST_VERSION} > rust_toolchain_version
# Make sure to sync the nightly version with the scripts in ./scripts
RUN echo "nightly-2024-01-28" > nightly_rust_toolchain_version
🧰 Tools
🪛 GitHub Actions: devcontainer

[warning] Invalid default value for ARG rust:${RUST_VERSION}-slim results in empty or invalid base image name

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Ohayo sensei!

Confirmed: ubuntu:noble is a development version and could cause CI instability

The Docker registry shows that ubuntu:jammy (22.04 LTS) has stable monthly releases, while noble shows signs of active development with multiple releases per month. For CI reliability, please use ubuntu:jammy instead.

🔗 Analysis chain

Consider using a stable Ubuntu release instead of noble.

The ubuntu:noble image refers to Ubuntu 24.04 LTS which is still in development. Using a pre-release version in CI could lead to unexpected issues.

Consider using ubuntu:jammy (22.04 LTS) instead. Let's verify the current state of noble:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Ubuntu noble release status and available versions

# Check available Ubuntu versions in registry
curl -s https://registry.hub.docker.com/v2/repositories/library/ubuntu/tags?page_size=10 | \
  jq -r '.results[].name' | \
  grep -E '^(noble|jammy)'

Length of output: 168


Script:

#!/bin/bash
# Get more Ubuntu tags and release information
echo "=== Available Ubuntu versions ==="
curl -s "https://registry.hub.docker.com/v2/repositories/library/ubuntu/tags?page_size=100" | \
  jq -r '.results[].name' | \
  grep -E '^(noble|jammy|lunar|mantic)' | sort

echo -e "\n=== Ubuntu Release Information ==="
curl -s https://ubuntu.com/release-cycle | grep -A 2 -B 2 "Noble"

Length of output: 1310

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Ohayo sensei! Found a Cairo version mismatch that needs attention!

The Scarb version 2.9.2 is indeed consistent across all CI jobs, but there's a related issue:

  • crates/benches/contracts/Scarb.toml is using Cairo 2.9.1 while the rest of the codebase uses 2.9.2
🔗 Analysis chain

Verify Scarb version consistency across jobs.

Ohayo sensei! The Scarb version is set to 2.9.2 across multiple jobs, which aligns with the Cairo version upgrade mentioned in the PR objectives.

Let's verify the version consistency:

Also applies to: 130-132, 147-149

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check Scarb version references across the codebase

# Search for Scarb version references
echo "=== Scarb version references ==="
rg -n "scarb-version|SCARB_VERSION" --type yaml --type toml

# Search for Cairo version references
echo -e "\n=== Cairo version references ==="
rg -n "cairo-version|CAIRO_VERSION" --type yaml --type toml

Length of output: 725


Script:

#!/bin/bash
# Check Scarb version references in CI workflow
echo "=== Scarb version references in CI workflow ==="
rg -n "scarb-version:" .github/workflows/ci.yml

Length of output: 263

- 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
Loading