Skip to content

Commit

Permalink
Merge pull request #2 from fishseabowl/1466_fix_non_state
Browse files Browse the repository at this point in the history
Sync with main branch
  • Loading branch information
fishseabowl authored May 27, 2024
2 parents 4717aac + ad60b12 commit 89316a7
Show file tree
Hide file tree
Showing 396 changed files with 28,705 additions and 12,257 deletions.
12 changes: 11 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,20 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then \
fi

ARG DOJO_VERSION=stable
ARG BUILD_TYPE=default
RUN curl -L https://install.dojoengine.org | bash
RUN curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash
ENV PATH=${PATH}:/root/.dojo/bin
RUN dojoup -v $DOJO_VERSION
RUN if [ "$BUILD_TYPE" = "release" ]; then \
echo "Installing Dojo version $DOJO_VERSION"; \
dojoup -v $DOJO_VERSION; \
elif [ "$BUILD_TYPE" = "push" ]; then \
echo "Installing Dojo at commit $DOJO_VERSION"; \
dojoup -c $DOJO_VERSION; \
else \
echo "Installing latest stable version of Dojo"; \
dojoup; \
fi

RUN chown -R root:root /usr/local/cargo
RUN chmod -R 700 /usr/local/cargo
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/rust
{
"name": "Rust",
"image": "ghcr.io/dojoengine/dojo-dev:3153a80",
"image": "ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4",
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
Expand Down
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: ''

assignees: ""
---

**Describe the bug**
Expand Down
7 changes: 3 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
Expand Down
40 changes: 40 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Description

<!--
A description of what this PR is solving.
-->

## Related issue

<!--
Please link related issues: Fixes #<issue_number>
More info: https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->

## Tests

<!--
Please refer to the CONTRIBUTING.md file to know more about the testing process. Ensure you've tested at least the package you're modifying if running all the tests consumes too much memory on your system.
-->

- [ ] Yes
- [ ] No, because they aren't needed
- [ ] No, because I need help

## Added to documentation?

<!--
If the changes are small, code comments are enough, otherwise, the documentation is needed. It
may be a README.md file added to your module/package, a DojoBook PR or both.
-->

- [ ] README.md
- [ ] [Dojo Book](https://github.com/dojoengine/book)
- [ ] No documentation needed

## Checklist

- [ ] I've formatted my code (`scripts/prettier.sh`, `scripts/rust_fmt.sh`, `scripts/cairo_fmt.sh`)
- [ ] I've linted my code (`scripts/clippy.sh`, `scripts/docs.sh`)
- [ ] I've commented my code
- [ ] I've requested a review after addressing the comments
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:3153a80
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4
steps:
- uses: actions/checkout@v3
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
Expand Down
43 changes: 22 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ jobs:
test:
runs-on: ubuntu-latest-16-cores
container:
image: ghcr.io/dojoengine/dojo-dev:3153a80
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- run: |
cargo llvm-cov nextest --no-report --all-features --workspace --exclude katana --build-jobs 10
cargo build -r --bin katana
KATANA_RUNNER_BIN=$(pwd)/target/release/katana cargo llvm-cov nextest --no-report --all-features --workspace --exclude katana --build-jobs 10
cargo llvm-cov nextest --no-report -p katana
cargo llvm-cov nextest --no-report -p katana --no-default-features --features sir
# TODO(kariy): uncomment this line when `sir` feature support Cairo 2.6.3
# cargo llvm-cov nextest --no-report -p katana --no-default-features --features sir
cargo llvm-cov report --lcov --output-path lcov.info
- uses: codecov/codecov-action@v4
with:
Expand All @@ -31,7 +33,7 @@ jobs:
ensure-wasm:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:3153a80
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -51,22 +53,21 @@ jobs:
repo-token: ${{ secrets.github_token }}
- run: cargo build --target x86_64-pc-windows-msvc --bins

# cairofmt:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: nightly-2022-11-03
# - uses: Swatinem/rust-cache@v2
# - run: cargo install cairo-lang-formatter
# - run: scripts/cairo_fmt.sh --check
cairofmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.6.3"
- run: |
scarb --manifest-path examples/spawn-and-move/Scarb.toml fmt --check
scarb --manifest-path crates/dojo-core/Scarb.toml fmt --check
dojo-core-test:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:3153a80
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -75,7 +76,7 @@ jobs:
dojo-spawn-and-move-example-test:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:3153a80
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -84,7 +85,7 @@ jobs:
dojo-world-bindings-check:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:3153a80
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -93,7 +94,7 @@ jobs:
clippy:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:3153a80
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -102,7 +103,7 @@ jobs:
fmt:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:3153a80
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -111,7 +112,7 @@ jobs:
docs:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:3153a80
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
name: devcontainer

on:
workflow_dispatch:
inputs:
docker_tag:
description: Descriptive name of the devcontainer for the Docker tag
required: true
type: string
push:
paths:
- ".devcontainer/**"
- ".github/workflows/devcontainer.yml"
- "!.devcontainer/devcontainer.json"
release:
types: [created]
types: [published]

jobs:
build-and-push:
Expand Down Expand Up @@ -45,6 +51,11 @@ jobs:
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c 1-7)
echo "DOCKER_TAG=$SHORT_SHA" >> $GITHUB_ENV
- name: Set Docker tag for workflow_dispatch event
if: github.event_name == 'workflow_dispatch'
run: |
echo "DOCKER_TAG=${{ inputs.docker_tag }}" >> $GITHUB_ENV
- name: Set outputs
id: release_info
run: |
Expand All @@ -53,19 +64,20 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
push: true
push: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')) }}
file: .devcontainer/Dockerfile
tags: ghcr.io/${{ github.repository }}-dev:latest,ghcr.io/${{ github.repository }}-dev:${{ env.DOCKER_TAG }}
build-args: |
VARIANT=bookworm
DOJO_VERSION=${{ github.event_name == 'release' && github.event.release.tag_name || 'stable' }}
BUILD_TYPE=${{ github.event_name }}
DOJO_VERSION=${{ github.event.release.tag_name }}
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-dev:latest

propose-update-pr:
needs: build-and-push
runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'create' && startsWith(github.ref, 'refs/tags/'))
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/'))
permissions:
pull-requests: write
contents: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
contents: write
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:3153a80
image: ghcr.io/dojoengine/dojo-dev:v0.7.0-alpha.4
env:
VERSION: ""
steps:
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: release

on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
Expand All @@ -13,7 +14,7 @@ env:

jobs:
prepare:
if: github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'prepare-release'
if: (github.event.pull_request.merged == true && github.event.pull_request.head.ref == 'prepare-release') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
outputs:
tag_name: ${{ steps.release_info.outputs.tag_name }}
Expand Down Expand Up @@ -41,11 +42,11 @@ jobs:
# 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-20.04-4-cores
- os: ubuntu-latest-4-cores
platform: linux
target: x86_64-unknown-linux-gnu
arch: amd64
- os: ubuntu-20.04-8-cores
- os: ubuntu-latest-8-cores
platform: linux
target: aarch64-unknown-linux-gnu
arch: arm64
Expand Down Expand Up @@ -93,6 +94,9 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y gcc-aarch64-linux-gnu libssl-dev
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
# We build jemalloc with 64KB pagesize so that it works for all linux/arm64 pagesize variants
# See: https://github.com/jemalloc/jemalloc/issues/467
echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV
- name: Build binaries
run: cargo build --release --bins --target ${{ matrix.job.target }}
Expand Down
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "crates/katana/primitives/contracts/messaging/solidity/lib/forge-std"]
path = crates/katana/primitives/contracts/messaging/solidity/lib/forge-std
[submodule "crates/katana/contracts/messaging/solidity/lib/forge-std"]
path = crates/katana/contracts/messaging/solidity/lib/forge-std
url = https://github.com/foundry-rs/forge-std
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scarb 2.6.3
59 changes: 39 additions & 20 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in 'dojo-world'",
"cargo": {
"args": ["test", "--no-run", "--package=dojo-world", "--lib"],
"filter": {
"name": "dojo-world",
"kind": "lib"
}
},
"args": ["migration::compile_moves"],
"cwd": "${workspaceFolder}/crates/dojo-world"
}
]
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Dojo Core test",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/target/debug/sozo",
"args": ["--manifest-path", "crates/dojo-core/Scarb.toml", "test"]
},
{
"name": "Sozo Migrate",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/target/debug/sozo",
"args": [
"--manifest-path",
"examples/spawn-and-move/Scarb.toml",
"migrate",
"apply"
]
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in 'dojo-world'",
"cargo": {
"args": ["test", "--no-run", "--package=dojo-world", "--lib"],
"filter": {
"name": "dojo-world",
"kind": "lib"
}
},
"args": ["migration::compile_moves"],
"cwd": "${workspaceFolder}/crates/dojo-world"
}
]
}
Loading

0 comments on commit 89316a7

Please sign in to comment.