Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
tarrencev committed Dec 9, 2023
2 parents bf1fdcb + fff037f commit 4e0407c
Show file tree
Hide file tree
Showing 67 changed files with 951 additions and 780 deletions.
574 changes: 372 additions & 202 deletions Cargo.lock

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,29 @@ anyhow = "1.0.75"
assert_matches = "1.5.0"
async-trait = "0.1.68"
base64 = "0.21.2"
blockifier = { git = "https://github.com/starkware-libs/blockifier" }
cairo-lang-casm = "2.3.1"
cairo-lang-compiler = "2.3.1"
cairo-lang-debug = "2.3.1"
cairo-lang-defs = "2.3.1"
cairo-lang-diagnostics = "2.3.1"
cairo-lang-filesystem = "2.3.1"
cairo-lang-formatter = "2.3.1"
cairo-lang-language-server = "2.3.1"
cairo-lang-lowering = "2.3.1"
cairo-lang-parser = "2.3.1"
cairo-lang-plugins = "2.3.1"
cairo-lang-project = "2.3.1"
cairo-lang-semantic = { version = "2.3.1", features = [ "testing" ] }
cairo-lang-sierra = "2.3.1"
cairo-lang-sierra-generator = "2.3.1"
cairo-lang-sierra-to-casm = "2.3.1"
cairo-lang-starknet = "2.3.1"
cairo-lang-syntax = "2.3.1"
cairo-lang-test-plugin = "2.3.1"
cairo-lang-test-runner = "2.3.1"
cairo-lang-test-utils = "2.3.1"
cairo-lang-utils = "2.3.1"
blockifier = { git = "https://github.com/starkware-libs/blockifier", tag = "v0.4.0-rc9.2" }
cairo-lang-casm = "2.4.0"
cairo-lang-compiler = "2.4.0"
cairo-lang-debug = "2.4.0"
cairo-lang-defs = "2.4.0"
cairo-lang-diagnostics = "2.4.0"
cairo-lang-filesystem = "2.4.0"
cairo-lang-formatter = "2.4.0"
cairo-lang-language-server = "2.4.0"
cairo-lang-lowering = "2.4.0"
cairo-lang-parser = "2.4.0"
cairo-lang-plugins = "2.4.0"
cairo-lang-project = "2.4.0"
cairo-lang-semantic = { version = "2.4.0", features = [ "testing" ] }
cairo-lang-sierra = "2.4.0"
cairo-lang-sierra-generator = "2.4.0"
cairo-lang-sierra-to-casm = "2.4.0"
cairo-lang-starknet = "2.4.0"
cairo-lang-syntax = "2.4.0"
cairo-lang-test-plugin = "2.4.0"
cairo-lang-test-runner = "2.4.0"
cairo-lang-test-utils = "2.4.0"
cairo-lang-utils = "2.4.0"
cairo-vm = "0.8.2"
camino = { version = "1.1.2", features = [ "serde1" ] }
chrono = { version = "0.4.24", features = [ "serde" ] }
Expand All @@ -88,17 +88,17 @@ parking_lot = "0.12.1"
pretty_assertions = "1.2.1"
rayon = "1.8.0"
salsa = "0.16.1"
scarb = { git = "https://github.com/software-mansion/scarb", rev = "0c8def3" }
scarb-ui = { git = "https://github.com/software-mansion/scarb", rev = "0c8def3" }
scarb = { git = "https://github.com/software-mansion/scarb", tag = "v2.4.0" }
scarb-ui = { git = "https://github.com/software-mansion/scarb", tag = "v2.4.0" }
semver = "1.0.5"
serde = { version = "1.0.156", features = [ "derive" ] }
serde_json = "1.0"
serde_with = "2.3.1"
smol_str = { version = "0.2.0", features = [ "serde" ] }
sqlx = { version = "0.7.2", features = [ "chrono", "macros", "runtime-async-std", "runtime-tokio", "sqlite", "uuid", "regexp" ] }
sqlx = { version = "0.7.2", features = [ "chrono", "macros", "regexp", "runtime-async-std", "runtime-tokio", "sqlite", "uuid" ] }
starknet = "0.7.0"
starknet-crypto = "0.6.1"
starknet_api = { git = "https://github.com/starkware-libs/starknet-api", rev = "ecc9b6946ef13003da202838e4124a9ad2efabb0" }
starknet_api = "0.6.0-rc3"
strum = "0.25"
strum_macros = "0.25"
test-log = "0.2.11"
Expand Down Expand Up @@ -127,7 +127,7 @@ wasm-tonic = { version = "0.9.2", default-features = false, features = [ "codege
wasm-tonic-build = { version = "0.9.2", default-features = false, features = [ "prost" ], package = "tonic-build" }

[patch."https://github.com/starkware-libs/blockifier"]
blockifier = { git = "https://github.com/dojoengine/blockifier", rev = "3357e69" }
blockifier = { git = "https://github.com/dojoengine/blockifier", rev = "e6e9c90" }

[patch.crates-io]
cairo-felt = { git = "https://github.com/dojoengine/cairo-rs.git", rev = "262b7eb4b11ab165a2a936a5f914e78aa732d4a2" }
Expand Down
2 changes: 1 addition & 1 deletion crates/benches/contracts/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
cairo-version = "2.2.0"
cairo-version = "2.4.0"
name = "benches"
version = "0.3.2"

Expand Down
4 changes: 2 additions & 2 deletions crates/dojo-core/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
cairo-version = "2.3.1"
cairo-version = "2.4.0"
description = "The Dojo Core library for autonomous worlds."
name = "dojo"
version = "0.4.0-rc0"

[dependencies]
dojo_plugin = { git = "https://github.com/dojoengine/dojo", tag = "v0.3.11" }
starknet = "2.3.1"
starknet = "2.4.0"
1 change: 1 addition & 0 deletions crates/dojo-lang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ cairo-lang-semantic.workspace = true
cairo-lang-sierra-generator.workspace = true
cairo-lang-starknet.workspace = true
cairo-lang-syntax.workspace = true
cairo-lang-test-plugin.workspace = true
cairo-lang-utils.workspace = true
camino.workspace = true
convert_case.workspace = true
Expand Down
6 changes: 5 additions & 1 deletion crates/dojo-lang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ To run the tests, run:
cargo test --package dojo-lang --lib -- plugin::test::expand_contract::model --exact --nocapture
```

To regenerate, set `CAIRO_FIX_TESTS=1`.
To regenerate, set `CAIRO_FIX_TESTS=1`:

```
CAIRO_FIX_TESTS=1 cargo test --package dojo-lang
```
2 changes: 1 addition & 1 deletion crates/dojo-lang/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "dojo_plugin"
version = "0.3.11"
version = "0.4.0"

[cairo-plugin]
19 changes: 7 additions & 12 deletions crates/dojo-lang/src/compiler_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ use cairo_lang_utils::ordered_hash_map::OrderedHashMap;
use dojo_test_utils::compiler::build_test_config;
use dojo_world::manifest::{BASE_CONTRACT_NAME, EXECUTOR_CONTRACT_NAME, WORLD_CONTRACT_NAME};
use scarb::core::TargetKind;
use scarb::ops::{self, CompileOpts};
use scarb::ops::CompileOpts;
use smol_str::SmolStr;
use starknet::macros::felt;

use super::do_update_manifest;
use crate::scarb_internal::{self};

fn build_mock_manifest() -> dojo_world::manifest::Manifest {
dojo_world::manifest::Manifest {
Expand Down Expand Up @@ -152,13 +153,10 @@ fn update_manifest_correctly() {
#[test]
fn test_compiler() {
let config = build_test_config("../../examples/spawn-and-move/Scarb.toml").unwrap();
let ws = ops::read_workspace(config.manifest_path(), &config).unwrap();
let packages = ws.members().map(|p| p.id).collect();
assert!(
ops::compile(
packages,
scarb_internal::compile_workspace(
&config,
CompileOpts { include_targets: vec![], exclude_targets: vec![TargetKind::TEST] },
&ws
)
.is_ok(),
"compilation failed"
Expand All @@ -179,15 +177,12 @@ pub fn test_manifest_file(
_args: &OrderedHashMap<String, String>,
) -> TestRunnerResult {
let config = build_test_config("./src/manifest_test_data/spawn-and-move/Scarb.toml").unwrap();
let ws = ops::read_workspace(config.manifest_path(), &config).unwrap();

let packages = ws.members().map(|p| p.id).collect();
ops::compile(
packages,
scarb_internal::compile_workspace(
&config,
CompileOpts { include_targets: vec![], exclude_targets: vec![TargetKind::TEST] },
&ws,
)
.unwrap_or_else(|op| panic!("Error compiling: {op:?}"));
.unwrap_or_else(|err| panic!("Error compiling: {err:?}"));

let target_dir = config.target_dir_override().unwrap();

Expand Down
14 changes: 8 additions & 6 deletions crates/dojo-lang/src/inline_macros/emit.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
use cairo_lang_defs::patcher::PatchBuilder;
use cairo_lang_defs::plugin::{
InlineMacroExprPlugin, InlinePluginResult, PluginDiagnostic, PluginGeneratedFile,
InlineMacroExprPlugin, InlinePluginResult, NamedPlugin, PluginDiagnostic, PluginGeneratedFile,
};
use cairo_lang_semantic::inline_macros::unsupported_bracket_diagnostic;
use cairo_lang_syntax::node::{ast, TypedSyntaxNode};

#[derive(Debug)]
#[derive(Debug, Default)]
pub struct EmitMacro;
impl EmitMacro {
pub const NAME: &'static str = "emit";

impl NamedPlugin for EmitMacro {
const NAME: &'static str = "emit";
}

impl InlineMacroExprPlugin for EmitMacro {
fn generate_code(
&self,
Expand All @@ -26,13 +28,13 @@ impl InlineMacroExprPlugin for EmitMacro {
let mut data = Default::<array::Array>::default();",
);

let args = arg_list.args(db).elements(db);
let args = arg_list.arguments(db).elements(db);

if args.len() != 2 {
return InlinePluginResult {
code: None,
diagnostics: vec![PluginDiagnostic {
stable_ptr: arg_list.args(db).stable_ptr().untyped(),
stable_ptr: arg_list.arguments(db).stable_ptr().untyped(),
message: "Invalid arguments. Expected \"emit!(world, event)\"".to_string(),
}],
};
Expand Down
12 changes: 7 additions & 5 deletions crates/dojo-lang/src/inline_macros/get.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use cairo_lang_defs::patcher::PatchBuilder;
use cairo_lang_defs::plugin::{
InlineMacroExprPlugin, InlinePluginResult, PluginDiagnostic, PluginGeneratedFile,
InlineMacroExprPlugin, InlinePluginResult, NamedPlugin, PluginDiagnostic, PluginGeneratedFile,
};
use cairo_lang_semantic::inline_macros::unsupported_bracket_diagnostic;
use cairo_lang_syntax::node::ast::{Expr, ItemModule};
Expand All @@ -11,11 +11,13 @@ use itertools::Itertools;
use super::utils::{parent_of_kind, SYSTEM_READS};
use super::{extract_models, unsupported_arg_diagnostic, CAIRO_ERR_MSG_LEN};

#[derive(Debug)]
#[derive(Debug, Default)]
pub struct GetMacro;
impl GetMacro {
pub const NAME: &'static str = "get";

impl NamedPlugin for GetMacro {
const NAME: &'static str = "get";
}

impl InlineMacroExprPlugin for GetMacro {
fn generate_code(
&self,
Expand All @@ -31,7 +33,7 @@ impl InlineMacroExprPlugin for GetMacro {
let mut __get_macro_keys__ = array::ArrayTrait::new();\n",
);

let args = arg_list.args(db).elements(db);
let args = arg_list.arguments(db).elements(db);

if args.len() != 3 {
return InlinePluginResult {
Expand Down
18 changes: 10 additions & 8 deletions crates/dojo-lang/src/inline_macros/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::HashMap;

use cairo_lang_defs::patcher::PatchBuilder;
use cairo_lang_defs::plugin::{
InlineMacroExprPlugin, InlinePluginResult, PluginDiagnostic, PluginGeneratedFile,
InlineMacroExprPlugin, InlinePluginResult, NamedPlugin, PluginDiagnostic, PluginGeneratedFile,
};
use cairo_lang_semantic::inline_macros::unsupported_bracket_diagnostic;
use cairo_lang_syntax::node::ast::{ExprPath, ExprStructCtorCall, FunctionWithBody, ItemModule};
Expand All @@ -12,10 +12,11 @@ use cairo_lang_syntax::node::{ast, TypedSyntaxNode};
use super::unsupported_arg_diagnostic;
use super::utils::{parent_of_kind, SystemRWOpRecord, SYSTEM_WRITES};

#[derive(Debug)]
#[derive(Debug, Default)]
pub struct SetMacro;
impl SetMacro {
pub const NAME: &'static str = "set";

impl NamedPlugin for SetMacro {
const NAME: &'static str = "set";
// Parents of set!()
// -----------------
// StatementExpr
Expand All @@ -31,6 +32,7 @@ impl SetMacro {
// ItemList
// SyntaxFile
}

impl InlineMacroExprPlugin for SetMacro {
fn generate_code(
&self,
Expand All @@ -43,13 +45,13 @@ impl InlineMacroExprPlugin for SetMacro {
let mut builder = PatchBuilder::new(db);
builder.add_str("{");

let args = arg_list.args(db).elements(db);
let args = arg_list.arguments(db).elements(db);

if args.len() != 2 {
return InlinePluginResult {
code: None,
diagnostics: vec![PluginDiagnostic {
stable_ptr: arg_list.args(db).stable_ptr().untyped(),
stable_ptr: arg_list.arguments(db).stable_ptr().untyped(),
message: "Invalid arguments. Expected \"(world, (models,))\"".to_string(),
}],
};
Expand Down Expand Up @@ -83,7 +85,7 @@ impl InlineMacroExprPlugin for SetMacro {
code: None,
diagnostics: vec![PluginDiagnostic {
message: "Invalid arguments. Expected \"(world, (models,))\"".to_string(),
stable_ptr: arg_list.args(db).stable_ptr().untyped(),
stable_ptr: arg_list.arguments(db).stable_ptr().untyped(),
}],
};
}
Expand All @@ -94,7 +96,7 @@ impl InlineMacroExprPlugin for SetMacro {
code: None,
diagnostics: vec![PluginDiagnostic {
message: "Invalid arguments: No models provided.".to_string(),
stable_ptr: arg_list.args(db).stable_ptr().untyped(),
stable_ptr: arg_list.arguments(db).stable_ptr().untyped(),
}],
};
}
Expand Down
4 changes: 4 additions & 0 deletions crates/dojo-lang/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ pub mod plugin;
pub mod print;
pub mod semantics;
pub(crate) mod version;

// Copy of non pub functions from scarb + extension.
// Also used by `sozo`.
pub mod scarb_internal;
Loading

0 comments on commit 4e0407c

Please sign in to comment.