Skip to content

Commit

Permalink
Merge remote-tracking branch 'dojo/main' into namespace-bindgen
Browse files Browse the repository at this point in the history
  • Loading branch information
glihm committed Jul 8, 2024
2 parents 2ad234a + 617fafb commit e743f61
Show file tree
Hide file tree
Showing 115 changed files with 1,367 additions and 1,169 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ 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.76.0" > rust_toolchain_version
RUN echo "1.79.0" > rust_toolchain_version

# Install cargo-binstall
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
CARGO_TERM_COLOR: always
RUST_VERSION: 1.76.0
RUST_VERSION: 1.79.0

jobs:
build:
Expand All @@ -31,7 +31,7 @@ jobs:
needs: ensure-docker
runs-on: ubuntu-latest-32-cores
container:
image: ghcr.io/dojoengine/dojo-dev:v0.7.2
image: ghcr.io/dojoengine/dojo-dev:ff30e1d
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -54,7 +54,7 @@ jobs:
ensure-wasm:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:v0.7.2
image: ghcr.io/dojoengine/dojo-dev:ff30e1d
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:v0.7.2
image: ghcr.io/dojoengine/dojo-dev:ff30e1d
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -129,7 +129,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:v0.7.2
image: ghcr.io/dojoengine/dojo-dev:ff30e1d
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -143,7 +143,7 @@ jobs:
dojo-world-bindings-check:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:v0.7.2
image: ghcr.io/dojoengine/dojo-dev:ff30e1d
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -152,7 +152,7 @@ jobs:
clippy:
runs-on: ubuntu-latest-4-cores
container:
image: ghcr.io/dojoengine/dojo-dev:v0.7.2
image: ghcr.io/dojoengine/dojo-dev:ff30e1d
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -161,7 +161,7 @@ jobs:
fmt:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:v0.7.2
image: ghcr.io/dojoengine/dojo-dev:ff30e1d
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -170,7 +170,7 @@ jobs:
docs:
runs-on: ubuntu-latest
container:
image: ghcr.io/dojoengine/dojo-dev:v0.7.2
image: ghcr.io/dojoengine/dojo-dev:ff30e1d
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand Down
1,300 changes: 650 additions & 650 deletions Cargo.lock

Large diffs are not rendered by default.

48 changes: 24 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,28 @@ auto_impl = "1.2.0"
base64 = "0.21.2"
bigdecimal = "0.4.1"
bytes = "1.6"
cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-language-server = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-parser = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-plugins = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632", features = [ "testing" ] }
cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632", features = [ "testing" ] }
cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-test-utils = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "d9984ef58e2f704909e271f2f01327f520ded632" }
cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-language-server = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-parser = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-plugins = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c", features = [ "testing" ] }
cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c", features = [ "testing" ] }
cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-test-utils = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "43cf361d9b6b26ec8cd5ee076dd15341bde7577c" }
cairo-proof-parser = { git = "https://github.com/cartridge-gg/cairo-proof-parser", branch = "v0.3.0/new-felt" }
cairo-vm = "0.9.2"
camino = { version = "1.1.2", features = [ "serde1" ] }
Expand Down Expand Up @@ -172,8 +172,8 @@ rpassword = "7.2.0"
rstest = "0.18.2"
rstest_reuse = "0.6.0"
salsa = "0.16.1"
scarb = { git = "https://github.com/software-mansion/scarb", rev = "f1aa7b09507a84d209d83b2fa80472c82605cc43" }
scarb-ui = { git = "https://github.com/software-mansion/scarb", rev = "f1aa7b09507a84d209d83b2fa80472c82605cc43" }
scarb = { git = "https://github.com/software-mansion/scarb", rev = "4b75f435f68248a7c096ec0fa5939ecdd92e2d79" }
scarb-ui = { git = "https://github.com/software-mansion/scarb", rev = "4b75f435f68248a7c096ec0fa5939ecdd92e2d79" }
semver = "1.0.5"
serde = { version = "1.0", features = [ "derive" ] }
serde_json = { version = "1.0", features = [ "arbitrary_precision" ] }
Expand Down
5 changes: 3 additions & 2 deletions bin/sozo/src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ impl BuildArgs {
let compile_info = compile_workspace(
config,
CompileOpts {
include_targets: vec![],
exclude_targets: vec![TargetKind::TEST],
include_target_names: vec![],
include_target_kinds: vec![],
exclude_target_kinds: vec![TargetKind::TEST],
features: features_opts,
},
)?;
Expand Down
61 changes: 31 additions & 30 deletions bin/sozo/src/commands/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fs;
use anyhow::{Context, Result};
use camino::Utf8PathBuf;
use clap::Args;
use dojo_world::manifest::{ABIS_DIR, BASE_DIR, MANIFESTS_DIR};
use dojo_world::manifest::{BASE_DIR, MANIFESTS_DIR};
use scarb::core::Config;
use scarb::ops;
use tracing::trace;
Expand All @@ -28,7 +28,7 @@ impl CleanArgs {
/// * `profile_dir` - The directory where the profile files are located.
pub fn clean_manifests(profile_dir: &Utf8PathBuf) -> Result<()> {
trace!(?profile_dir, "Cleaning manifests.");
let dirs = vec![profile_dir.join(BASE_DIR), profile_dir.join(ABIS_DIR).join(BASE_DIR)];
let dirs = vec![profile_dir.join(BASE_DIR)];

for d in dirs {
if d.exists() {
Expand All @@ -45,11 +45,7 @@ impl CleanArgs {
trace!(ws=?ws, "Workspace read successfully.");

let profile_names = if self.all_profiles {
let mut profiles = ws.profile_names().expect("given method never returns an error");
// currently scarb can return duplicate profiles and since the vector is sorted we can
// remove duplicates by calling dedup
profiles.dedup();
profiles
ws.profile_names()
} else {
vec![
ws.current_profile().expect("Scarb profile is expected at this point.").to_string(),
Expand Down Expand Up @@ -96,6 +92,8 @@ impl CleanArgs {
#[cfg(test)]
mod tests {
use dojo_test_utils::compiler;
use dojo_world::manifest::DEPLOYMENT_DIR;
use dojo_world::metadata::ABIS_DIR;
use scarb::compiler::Profile;

use super::*;
Expand All @@ -111,6 +109,8 @@ mod tests {
Profile::DEV,
);

println!("path {:?}", config.manifest_path());

let temp_project_dir = config.manifest_path().parent().unwrap().to_path_buf();

let clean_cmd = CleanArgs { full: false, all_profiles: false };
Expand All @@ -126,14 +126,14 @@ mod tests {
let release_manifests_dir = temp_project_dir.join("manifests").join(release_profile_name);

let dev_manifests_base_dir = dev_manifests_dir.join("base");
let dev_manifests_abis_base_dir = dev_manifests_dir.join("abis").join("base");
let dev_manifests_abis_base_dir = dev_manifests_dir.join("base").join("abis");
let release_manifests_base_dir = release_manifests_dir.join("base");
let release_manifests_abis_base_dir = release_manifests_dir.join("abis").join("base");

let dev_manifests_abis_depl_dir = dev_manifests_dir.join("abis").join("deployments");
let release_manifests_abis_base_dir = release_manifests_dir.join("base").join("abis");

let dev_manifest_toml = dev_manifests_dir.join("manifest").with_extension("toml");
let dev_manifest_json = dev_manifests_dir.join("manifest").with_extension("json");
let dev_manifests_depl_dir = dev_manifests_dir.join("deployment");
let dev_manifests_abis_depl_dir = dev_manifests_depl_dir.join("abis");
let dev_manifest_toml = dev_manifests_depl_dir.join("manifest").with_extension("toml");
let dev_manifest_json = dev_manifests_depl_dir.join("manifest").with_extension("json");

assert!(fs::read_dir(target_dev_dir).is_err(), "Expected 'target/dev' to be empty");
assert!(
Expand All @@ -147,11 +147,11 @@ mod tests {
);
assert!(
fs::read_dir(dev_manifests_abis_base_dir).is_err(),
"Expected 'manifests/dev/abis/base' to be empty"
"Expected 'manifests/dev/base/abis' to be empty"
);
assert!(
fs::read_dir(&dev_manifests_abis_depl_dir).is_ok(),
"Expected 'manifests/dev/abis/deployments' to not be empty"
"Expected 'manifests/dev/deployment/abis' to not be empty"
);

// we expect release profile to be not affected
Expand All @@ -161,7 +161,7 @@ mod tests {
);
assert!(
fs::read_dir(release_manifests_abis_base_dir).is_ok(),
"Expected 'manifests/release/abis/base' to be non empty"
"Expected 'manifests/release/base/abis' to be non empty"
);

assert!(dev_manifest_toml.exists(), "Expected 'manifest.toml' to exist");
Expand All @@ -172,7 +172,7 @@ mod tests {

assert!(
fs::read_dir(&dev_manifests_abis_depl_dir).is_err(),
"Expected 'manifests/dev/abis/deployments' to be empty"
"Expected 'manifests/dev/deployment/abis' to be empty"
);
assert!(!dev_manifest_toml.exists(), "Expected 'manifest.toml' to not exist");
assert!(!dev_manifest_json.exists(), "Expected 'manifest.json' to not exist");
Expand Down Expand Up @@ -200,18 +200,19 @@ mod tests {
let target_dev_dir = temp_project_dir.join("target").join(dev_profile_name);
let target_release_dir = temp_project_dir.join("target").join(release_profile_name);

let dev_manifests_dir = temp_project_dir.join("manifests").join(dev_profile_name);
let release_manifests_dir = temp_project_dir.join("manifests").join(release_profile_name);
let dev_manifests_dir = temp_project_dir.join(MANIFESTS_DIR).join(dev_profile_name);
let release_manifests_dir = temp_project_dir.join(MANIFESTS_DIR).join(release_profile_name);

let dev_manifests_base_dir = dev_manifests_dir.join("base");
let dev_manifests_abis_base_dir = dev_manifests_dir.join("abis").join("base");
let release_manifests_base_dir = release_manifests_dir.join("base");
let release_manifests_abis_base_dir = release_manifests_dir.join("abis").join("base");
let dev_manifests_base_dir = dev_manifests_dir.join(BASE_DIR);
let dev_manifests_abis_base_dir = dev_manifests_base_dir.join(ABIS_DIR);
let release_manifests_base_dir = release_manifests_dir.join(BASE_DIR);
let release_manifests_abis_base_dir = release_manifests_base_dir.join(ABIS_DIR);

let dev_manifests_abis_depl_dir = dev_manifests_dir.join("abis").join("deployments");
let dev_manifests_deploy_dir = dev_manifests_dir.join(DEPLOYMENT_DIR);
let dev_manifests_abis_depl_dir = dev_manifests_deploy_dir.join(ABIS_DIR);

let dev_manifest_toml = dev_manifests_dir.join("manifest").with_extension("toml");
let dev_manifest_json = dev_manifests_dir.join("manifest").with_extension("json");
let dev_manifest_toml = dev_manifests_deploy_dir.join("manifest").with_extension("toml");
let dev_manifest_json = dev_manifests_deploy_dir.join("manifest").with_extension("json");

assert!(fs::read_dir(target_dev_dir).is_err(), "Expected 'target/dev' to be empty");
assert!(fs::read_dir(target_release_dir).is_err(), "Expected 'target/release' to be empty");
Expand All @@ -222,11 +223,11 @@ mod tests {
);
assert!(
fs::read_dir(dev_manifests_abis_base_dir).is_err(),
"Expected 'manifests/dev/abis/base' to be empty"
"Expected 'manifests/dev/base/abis' to be empty"
);
assert!(
fs::read_dir(&dev_manifests_abis_depl_dir).is_ok(),
"Expected 'manifests/dev/abis/deployments' to not be empty"
"Expected 'manifests/dev/deployment/abis' to not be empty"
);

assert!(
Expand All @@ -235,7 +236,7 @@ mod tests {
);
assert!(
fs::read_dir(release_manifests_abis_base_dir).is_err(),
"Expected 'manifests/release/abis/base' to be empty"
"Expected 'manifests/release/base/abis' to be empty"
);

assert!(dev_manifest_toml.exists(), "Expected 'manifest.toml' to exist");
Expand All @@ -246,7 +247,7 @@ mod tests {

assert!(
fs::read_dir(&dev_manifests_abis_depl_dir).is_err(),
"Expected 'manifests/dev/abis/deployments' to be empty"
"Expected 'manifests/dev/deployment/abis' to be empty"
);
assert!(!dev_manifest_toml.exists(), "Expected 'manifest.toml' to not exist");
assert!(!dev_manifest_json.exists(), "Expected 'manifest.json' to not exist");
Expand Down
4 changes: 3 additions & 1 deletion bin/sozo/src/commands/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ impl MigrateArgs {
None
};

let profile_name =
ws.current_profile().expect("Scarb profile expected to be defined.").to_string();
let manifest_dir = ws.manifest_path().parent().unwrap().to_path_buf();
if !manifest_dir.join(MANIFESTS_DIR).exists() {
if !manifest_dir.join(MANIFESTS_DIR).join(profile_name).exists() {
return Err(anyhow!("Build project using `sozo build` first"));
}

Expand Down
4 changes: 2 additions & 2 deletions bin/sozo/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ pub enum Commands {
Init(InitArgs),
#[command(about = "Remove generated artifacts, manifests and abis")]
Clean(CleanArgs),
#[command(about = "Run a migration, declaring and deploying contracts as necessary to \
update the world")]
#[command(about = "Run a migration, declaring and deploying contracts as necessary to update \
the world")]
Migrate(Box<MigrateArgs>),
#[command(about = "Developer mode: watcher for building and migration")]
Dev(DevArgs),
Expand Down
4 changes: 2 additions & 2 deletions crates/benches/src/deployer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::{anyhow, bail, Context, Ok, Result};
use clap::Parser;
use dojo_lang::compiler::DojoCompiler;
use dojo_lang::plugin::CairoPluginRepository;
use dojo_world::manifest::{DeploymentManifest, DEPLOYMENTS_DIR, MANIFESTS_DIR};
use dojo_world::manifest::{DeploymentManifest, DEPLOYMENT_DIR, MANIFESTS_DIR};
use futures::executor::block_on;
use katana_runner::KatanaRunner;
use scarb::compiler::CompilerRepository;
Expand Down Expand Up @@ -97,7 +97,7 @@ async fn prepare_migration_args(args: SozoArgs) -> Result<Felt> {
let manifest_dir = manifest_path.parent().unwrap();

let manifest = DeploymentManifest::load_from_path(
&manifest_dir.join(MANIFESTS_DIR).join("dev").join(DEPLOYMENTS_DIR).with_extension("toml"),
&manifest_dir.join(MANIFESTS_DIR).join("dev").join(DEPLOYMENT_DIR).with_extension("toml"),
)
.expect("failed to load manifest");

Expand Down
4 changes: 2 additions & 2 deletions crates/dojo-core/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ dependencies = [

[[package]]
name = "dojo_plugin"
version = "0.4.1"
source = "git+https://github.com/dojoengine/dojo?tag=v0.7.2#3da5cad9fdd39b81551e0668015d88262e6c5fc4"
version = "0.7.2"
source = "git+https://github.com/dojoengine/dojo?tag=v0.7.3#e8539d5b199efbd51c89c75da32f6592de5d9262"
Loading

0 comments on commit e743f61

Please sign in to comment.