Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUST_VERSION=1.89.0
ARG RUST_VERSION=1.90.0
FROM ubuntu:24.04
ARG RUST_VERSION

Expand Down Expand Up @@ -51,8 +51,6 @@ RUN rustup target add x86_64-pc-windows-msvc && \

RUN cargo install cargo-nextest cargo-llvm-cov cargo-release cargo-get

RUN curl -L https://install.dojoengine.org | bash

# Platform specific tooling (hurl, llvm-tools)
ARG TARGETPLATFORM

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
file: .devcontainer/Dockerfile
tags: ghcr.io/${{ github.repository }}-dev:latest,ghcr.io/${{ github.repository }}-dev:${{ env.DOCKER_TAG }}
build-args: |
RUST_VERSION=1.88.0
RUST_VERSION=1.90.0
DOJO_VERSION=${{ env.DOCKER_TAG }}
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-dev:latest
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/release-dispatch-sozo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,55 @@ jobs:
- uses: actions/checkout@v4
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install cargo-release
run: cargo install cargo-release
run: cargo install cargo-release --version 0.25.20 --locked
- name: Normalize version and update files
id: version
working-directory: ./bin/sozo
run: |
INPUT_VERSION="${{ inputs.version }}"

if [[ -z "$INPUT_VERSION" ]]; then
if [ -z "$INPUT_VERSION" ]; then
echo "Error: Version input is empty"
exit 1
fi

CLEAN_VERSION=${INPUT_VERSION#v}
DISPLAY_VERSION="v${CLEAN_VERSION}"

# Manually update the version in the Cargo.toml files, until we have a proper
# rework of the Dojo crates and Sozo isolation.

set -e

SOZO_MANIFESTS="./Cargo.toml ../../crates/sozo/mcp/Cargo.toml ../../crates/sozo/ops/Cargo.toml ../../crates/sozo/signers/Cargo.toml ../../crates/sozo/ui/Cargo.toml ../../crates/sozo/walnut/Cargo.toml"

for manifest in $SOZO_MANIFESTS; do
tmp="$(mktemp)"
if ! awk -v ver="$CLEAN_VERSION" '
BEGIN { updated = 0 }
!updated && /^[[:space:]]*version[[:space:]]*=/ {
sub(/=.*/, "= \"" ver "\"")
updated = 1
}
{ print }
END {
if (!updated) exit 1
}
' "$manifest" > "$tmp"; then
echo "Failed to update version in $manifest"
exit 1
fi

mv "$tmp" "$manifest"
done

cargo release version ${CLEAN_VERSION} --execute --no-confirm
cargo release replace --execute --no-confirm

echo "display_version=${DISPLAY_VERSION}" >> $GITHUB_OUTPUT

- uses: peter-evans/create-pull-request@v7
with:
# We have to use a PAT in order to trigger ci
token: ${{ secrets.CREATE_PR_TOKEN }}
title: "release-sozo(prepare): ${{ steps.version.outputs.display_version }}"
commit-message: "Prepare Sozo release: ${{ steps.version.outputs.display_version }}"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-sozo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ jobs:
- uses: actions/checkout@v4
- name: Get version
id: release_info
working-directory: ./bin/sozo
run: |
cargo install cargo-get
VERSION="v$(cargo get workspace.package.version)"
VERSION="v$(cargo get package.version)"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tag_name=sozo/${VERSION}" >> $GITHUB_OUTPUT

Expand Down
86 changes: 0 additions & 86 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,92 +37,6 @@ jobs:
cargo install cargo-get
echo "tag_name=v$(cargo get workspace.package.version)" >> $GITHUB_OUTPUT

release:
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
needs: prepare
runs-on: ${{ matrix.job.os }}
env:
PLATFORM_NAME: ${{ matrix.job.platform }}
TARGET: ${{ matrix.job.target }}
ARCH: ${{ matrix.job.arch }}
strategy:
matrix:
job:
# The OS is used for the runner
# The platform is a generic platform name
# The target is used by Cargo
# The arch is either 386, arm64 or amd64
# The svm target platform to use for the binary https://github.com/roynalnaruto/svm-rs/blob/84cbe0ac705becabdc13168bae28a45ad2299749/svm-builds/build.rs#L4-L24
- os: ubuntu-latest-8-cores
platform: linux
target: x86_64-unknown-linux-gnu
arch: amd64
- os: ubuntu-latest-8-cores-arm64
platform: linux
target: aarch64-unknown-linux-gnu
arch: arm64
svm_target_platform: linux-aarch64
- os: macos-latest-xlarge
platform: darwin
target: x86_64-apple-darwin
arch: amd64
- os: macos-latest
platform: darwin
target: aarch64-apple-darwin
arch: arm64
- os: windows-latest
platform: win32
target: x86_64-pc-windows-msvc
arch: amd64

steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@master
name: Rust Toolchain Setup
with:
targets: ${{ matrix.job.target }}
toolchain: ${{ env.RUST_VERSION }}

- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true

- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.13.1"

- name: Build binaries
run: cargo build --release --locked --bin sozo --target ${{ matrix.job.target }}

- name: Archive binaries
id: artifacts
env:
VERSION_NAME: ${{ needs.prepare.outputs.tag_name }}
run: |
if [ "$PLATFORM_NAME" == "linux" ]; then
tar -czvf "dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release sozo
echo "file_name=dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
elif [ "$PLATFORM_NAME" == "darwin" ]; then
# We need to use gtar here otherwise the archive is corrupt.
# See: https://github.com/actions/virtual-environments/issues/2619
gtar -czvf "dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release sozo
echo "file_name=dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
else
cd ./target/${TARGET}/release
7z a -tzip "dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" sozo.exe
mv "dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" ../../../
echo "file_name=dojo_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.zip" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.job.target }}
path: ${{ steps.artifacts.outputs.file_name }}
retention-days: 1

publish-scarb-packages:

runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions bin/sozo/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scarb 2.13.1
starknet-foundry 0.51.0
31 changes: 30 additions & 1 deletion bin/sozo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG SOZO_VERSION
ARG TARGETARCH

RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& apt-get install -y --no-install-recommends git curl wget ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Archive is provided by the release workflow (linux/amd64 and linux/arm64 variants).
Expand All @@ -14,4 +14,33 @@ RUN tar -xzf /tmp/sozo.tar.gz -C /usr/local/bin sozo \
&& rm /tmp/sozo.tar.gz \
&& chmod +x /usr/local/bin/sozo

# Define the ASDF related variables.
# Note that the data dir is also invovled.
ENV ASDF_VERSION=v0.18.0
ENV ASDF_DIR=/opt/asdf
ENV ASDF_BIN_DIR=${ASDF_DIR}/bin
ENV ASDF_DATA_DIR=${ASDF_DIR}/

# Add to the PATH + ensure the ASDF_DATA_DIR is also set,
# to have next invocation of asdf working as expected.
ENV PATH="${ASDF_BIN_DIR}:${ASDF_DATA_DIR}/shims:$PATH"
ENV ASDF_DATA_DIR=${ASDF_DATA_DIR}
Comment on lines +17 to +27

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Ohayo sensei! Remove redundant ASDF_DATA_DIR assignment and fix path double-slash.

Line 22 sets ASDF_DATA_DIR with a trailing slash, and line 27 re-exports it identically—this is redundant. Also, the trailing slash causes ${ASDF_DATA_DIR}/shims to expand to /opt/asdf//shims (double slash), which is cosmetically sloppy and can confuse debugging.

Consolidate and clean up the ASDF environment setup:

-ENV ASDF_VERSION=v0.18.0
-ENV ASDF_DIR=/opt/asdf
-ENV ASDF_BIN_DIR=${ASDF_DIR}/bin
-ENV ASDF_DATA_DIR=${ASDF_DIR}/
-
-# Add to the PATH + ensure the ASDF_DATA_DIR is also set,
-# to have next invocation of asdf working as expected.
-ENV PATH="${ASDF_BIN_DIR}:${ASDF_DATA_DIR}/shims:$PATH"
-ENV ASDF_DATA_DIR=${ASDF_DATA_DIR}
+ENV ASDF_VERSION=v0.18.0 \
+    ASDF_DIR=/opt/asdf \
+    ASDF_BIN_DIR=/opt/asdf/bin \
+    ASDF_DATA_DIR=/opt/asdf \
+    PATH="/opt/asdf/bin:/opt/asdf/shims:$PATH"
📝 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
# Define the ASDF related variables.
# Note that the data dir is also invovled.
ENV ASDF_VERSION=v0.18.0
ENV ASDF_DIR=/opt/asdf
ENV ASDF_BIN_DIR=${ASDF_DIR}/bin
ENV ASDF_DATA_DIR=${ASDF_DIR}/
# Add to the PATH + ensure the ASDF_DATA_DIR is also set,
# to have next invocation of asdf working as expected.
ENV PATH="${ASDF_BIN_DIR}:${ASDF_DATA_DIR}/shims:$PATH"
ENV ASDF_DATA_DIR=${ASDF_DATA_DIR}
# Define the ASDF related variables.
# Note that the data dir is also invovled.
ENV ASDF_VERSION=v0.18.0 \
ASDF_DIR=/opt/asdf \
ASDF_BIN_DIR=/opt/asdf/bin \
ASDF_DATA_DIR=/opt/asdf \
PATH="/opt/asdf/bin:/opt/asdf/shims:$PATH"
🤖 Prompt for AI Agents
In bin/sozo/Dockerfile around lines 17 to 27, the ASDF_DATA_DIR is set with a
trailing slash and then redundantly re-exported, causing a double-slash in the
PATH; remove the second ENV ASDF_DATA_DIR line, set ASDF_DATA_DIR without a
trailing slash (e.g. ENV ASDF_DATA_DIR=${ASDF_DIR}), and update PATH to
reference ${ASDF_DATA_DIR}/shims so expansions produce a single slash (ensure
only one ENV defines ASDF_DATA_DIR).


# Install ASDF from pre-built binaries github release (easiest way IMHO).
RUN wget -q https://github.com/asdf-vm/asdf/releases/download/${ASDF_VERSION}/asdf-${ASDF_VERSION}-linux-${TARGETARCH}.tar.gz -O /tmp/asdf.tar.gz && \
mkdir -p $ASDF_BIN_DIR && \
tar -xzf /tmp/asdf.tar.gz -C $ASDF_BIN_DIR && \
rm /tmp/asdf.tar.gz && \
ls -laR ${ASDF_DIR}

RUN chmod +x $ASDF_BIN_DIR/asdf && ls -alR $ASDF_DIR/
RUN asdf --version
Comment on lines +29 to +37

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove debug output commands for cleaner Docker builds.

Lines 34, 36, and 37 are verbose/debug-only commands (ls -laR, asdf --version) that add no value to the final image and slow down builds. These should be removed for production.

Clean up the ASDF installation step:

 RUN wget -q https://github.com/asdf-vm/asdf/releases/download/${ASDF_VERSION}/asdf-${ASDF_VERSION}-linux-${TARGETARCH}.tar.gz -O /tmp/asdf.tar.gz && \
 mkdir -p $ASDF_BIN_DIR && \
 tar -xzf /tmp/asdf.tar.gz -C $ASDF_BIN_DIR && \
 rm /tmp/asdf.tar.gz && \
-ls -laR ${ASDF_DIR}
-
-RUN chmod +x $ASDF_BIN_DIR/asdf && ls -alR $ASDF_DIR/
-RUN asdf --version
+chmod +x $ASDF_BIN_DIR/asdf
🤖 Prompt for AI Agents
In bin/sozo/Dockerfile around lines 29 to 37, remove the debug/verbose commands:
delete the recursive directory listings (ls -laR ${ASDF_DIR} and ls -alR
$ASDF_DIR/) and the final asdf --version invocation; retain the ASDF install
extraction and the chmod +x $ASDF_BIN_DIR/asdf step so the binary is executable,
and squash or combine RUN lines as needed to avoid extra image layers and keep
the build lean.


COPY .tool-versions /root/.tool-versions

RUN asdf plugin add scarb https://github.com/software-mansion/asdf-scarb.git && \
asdf plugin add starknet-foundry https://github.com/foundry-rs/asdf-starknet-foundry && \
asdf install && \
asdf reshim

ENTRYPOINT ["sozo"]
Loading