From 078bd8400c8c904f626b2254c153167bb4868529 Mon Sep 17 00:00:00 2001 From: Tarrence van As Date: Sat, 9 Dec 2023 14:05:56 -0500 Subject: [PATCH 1/3] Prepare v0.4.0-rc1 --- Cargo.lock | 42 +++++++++---------- Cargo.toml | 2 +- crates/dojo-core/Scarb.lock | 2 +- crates/dojo-core/Scarb.toml | 2 +- .../simple_crate/Scarb.toml | 2 +- examples/spawn-and-move/Scarb.lock | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 318961f903..ac3197b40e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2544,7 +2544,7 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "dojo-lang" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -2592,7 +2592,7 @@ dependencies = [ [[package]] name = "dojo-language-server" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -2614,7 +2614,7 @@ dependencies = [ [[package]] name = "dojo-signers" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "starknet", @@ -2622,7 +2622,7 @@ dependencies = [ [[package]] name = "dojo-test-utils" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "assert_fs", @@ -2653,7 +2653,7 @@ dependencies = [ [[package]] name = "dojo-types" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "crypto-bigint", "hex", @@ -2668,7 +2668,7 @@ dependencies = [ [[package]] name = "dojo-world" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "assert_fs", @@ -5248,7 +5248,7 @@ dependencies = [ [[package]] name = "katana" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "assert_matches", "clap", @@ -5266,7 +5266,7 @@ dependencies = [ [[package]] name = "katana-core" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "assert_matches", @@ -5300,7 +5300,7 @@ dependencies = [ [[package]] name = "katana-db" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "bincode 1.3.3", @@ -5315,7 +5315,7 @@ dependencies = [ [[package]] name = "katana-executor" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "blockifier", @@ -5331,7 +5331,7 @@ dependencies = [ [[package]] name = "katana-primitives" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "blockifier", @@ -5348,7 +5348,7 @@ dependencies = [ [[package]] name = "katana-provider" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "auto_impl", @@ -5365,7 +5365,7 @@ dependencies = [ [[package]] name = "katana-rpc" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "assert_matches", @@ -5397,7 +5397,7 @@ dependencies = [ [[package]] name = "katana-rpc-types" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "derive_more", @@ -5410,7 +5410,7 @@ dependencies = [ [[package]] name = "katana-rpc-types-builder" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "katana-executor", @@ -8088,7 +8088,7 @@ dependencies = [ [[package]] name = "sozo" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "assert_fs", @@ -9272,7 +9272,7 @@ dependencies = [ [[package]] name = "torii-client" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "async-trait", "camino", @@ -9298,7 +9298,7 @@ dependencies = [ [[package]] name = "torii-core" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "async-trait", @@ -9334,7 +9334,7 @@ dependencies = [ [[package]] name = "torii-graphql" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "async-graphql", @@ -9373,7 +9373,7 @@ dependencies = [ [[package]] name = "torii-grpc" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "bytes", "crypto-bigint", @@ -9411,7 +9411,7 @@ dependencies = [ [[package]] name = "torii-server" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index f1b8d8955f..037ca5f196 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ edition = "2021" license = "Apache-2.0" license-file = "LICENSE" repository = "https://github.com/dojoengine/dojo/" -version = "0.4.0-rc0" +version = "0.4.0-rc1" [profile.performance] codegen-units = 1 diff --git a/crates/dojo-core/Scarb.lock b/crates/dojo-core/Scarb.lock index 9e87daaffa..ea08cb38bc 100644 --- a/crates/dojo-core/Scarb.lock +++ b/crates/dojo-core/Scarb.lock @@ -3,7 +3,7 @@ version = 1 [[package]] name = "dojo" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "dojo_plugin", ] diff --git a/crates/dojo-core/Scarb.toml b/crates/dojo-core/Scarb.toml index 8790f62c3d..a20f23a2e7 100644 --- a/crates/dojo-core/Scarb.toml +++ b/crates/dojo-core/Scarb.toml @@ -2,7 +2,7 @@ cairo-version = "2.4.0" description = "The Dojo Core library for autonomous worlds." name = "dojo" -version = "0.4.0-rc0" +version = "0.4.0-rc1" [dependencies] dojo_plugin = { git = "https://github.com/dojoengine/dojo", tag = "v0.3.11" } diff --git a/crates/dojo-lang/src/manifest_test_data/simple_crate/Scarb.toml b/crates/dojo-lang/src/manifest_test_data/simple_crate/Scarb.toml index b6861d3661..b14f7dd921 100644 --- a/crates/dojo-lang/src/manifest_test_data/simple_crate/Scarb.toml +++ b/crates/dojo-lang/src/manifest_test_data/simple_crate/Scarb.toml @@ -1,7 +1,7 @@ [package] cairo-version = "2.3.1" name = "test_crate" -version = "0.4.0-rc0" +version = "0.4.0-rc1" [cairo] sierra-replace-ids = true diff --git a/examples/spawn-and-move/Scarb.lock b/examples/spawn-and-move/Scarb.lock index b5b1412454..09cafa61e4 100644 --- a/examples/spawn-and-move/Scarb.lock +++ b/examples/spawn-and-move/Scarb.lock @@ -3,7 +3,7 @@ version = 1 [[package]] name = "dojo" -version = "0.4.0-rc0" +version = "0.4.0-rc1" dependencies = [ "dojo_plugin", ] From 210a1375c0692d60ae4739bbcc7306f1b16375ed Mon Sep 17 00:00:00 2001 From: glihm Date: Sat, 9 Dec 2023 18:52:27 -0600 Subject: [PATCH 2/3] tests(dojo-lang): add compiler test for cairo v2.4.0 (#1249) * add new test for cairo v2.4.0 compatibility * fix: fmt --- crates/dojo-core/src/lib.cairo | 2 +- crates/dojo-lang/src/compiler_test.rs | 35 + .../src/manifest_test_data/cairo_v240 | 973 ++++++++++++++++++ .../compiler_cairo_v240/.gitignore | 1 + .../compiler_cairo_v240/Scarb.lock | 20 + .../compiler_cairo_v240/Scarb.toml | 23 + .../compiler_cairo_v240/src/lib.cairo | 57 + .../graphql/src/tests/types-test/Scarb.lock | 5 +- 8 files changed, 1113 insertions(+), 3 deletions(-) create mode 100644 crates/dojo-lang/src/manifest_test_data/cairo_v240 create mode 100644 crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/.gitignore create mode 100644 crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/Scarb.lock create mode 100644 crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/Scarb.toml create mode 100644 crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/src/lib.cairo diff --git a/crates/dojo-core/src/lib.cairo b/crates/dojo-core/src/lib.cairo index 8a8ba0918d..6f4abe6691 100644 --- a/crates/dojo-core/src/lib.cairo +++ b/crates/dojo-core/src/lib.cairo @@ -21,4 +21,4 @@ mod test_utils; #[cfg(test)] mod benchmarks; -mod components; \ No newline at end of file +mod components; diff --git a/crates/dojo-lang/src/compiler_test.rs b/crates/dojo-lang/src/compiler_test.rs index e124ac014d..97772627c2 100644 --- a/crates/dojo-lang/src/compiler_test.rs +++ b/crates/dojo-lang/src/compiler_test.rs @@ -196,3 +196,38 @@ pub fn test_manifest_file( generated_file, )])) } + +cairo_lang_test_utils::test_file_test!( + compiler_cairo_v240, + "src/manifest_test_data/", + { + cairo_v240: "cairo_v240", + }, + test_compiler_cairo_v240 +); + +pub fn test_compiler_cairo_v240( + _inputs: &OrderedHashMap, + _args: &OrderedHashMap, +) -> TestRunnerResult { + let config = + build_test_config("./src/manifest_test_data/compiler_cairo_v240/Scarb.toml").unwrap(); + + scarb_internal::compile_workspace( + &config, + CompileOpts { include_targets: vec![], exclude_targets: vec![TargetKind::TEST] }, + ) + .unwrap_or_else(|err| panic!("Error compiling: {err:?}")); + + let target_dir = config.target_dir_override().unwrap(); + + let generated_manifest_path = + Path::new(target_dir).join(config.profile().as_str()).join("manifest.json"); + + let generated_file = fs::read_to_string(generated_manifest_path).unwrap(); + + TestRunnerResult::success(OrderedHashMap::from([( + "expected_manifest_file".into(), + generated_file, + )])) +} diff --git a/crates/dojo-lang/src/manifest_test_data/cairo_v240 b/crates/dojo-lang/src/manifest_test_data/cairo_v240 new file mode 100644 index 0000000000..8841c3876a --- /dev/null +++ b/crates/dojo-lang/src/manifest_test_data/cairo_v240 @@ -0,0 +1,973 @@ +//! > Test for cairo v2.4.0 compatibility + +//! > test_runner_name +test_compiler_cairo_v240 + +//! > expected_manifest_file +{ + "world": { + "name": "world", + "address": null, + "class_hash": "0x5ac623f0c96059936bd2d0904bdd31799e430fe08a0caff7a5f497260b16497", + "abi": [ + { + "type": "impl", + "name": "World", + "interface_name": "dojo::world::IWorld" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "enum", + "name": "core::option::Option::", + "variants": [ + { + "name": "Some", + "type": "core::felt252" + }, + { + "name": "None", + "type": "()" + } + ] + }, + { + "type": "struct", + "name": "core::array::Span::>", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::>" + } + ] + }, + { + "type": "enum", + "name": "core::bool", + "variants": [ + { + "name": "False", + "type": "()" + }, + { + "name": "True", + "type": "()" + } + ] + }, + { + "type": "interface", + "name": "dojo::world::IWorld", + "items": [ + { + "type": "function", + "name": "metadata_uri", + "inputs": [ + { + "name": "resource", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_metadata_uri", + "inputs": [ + { + "name": "resource", + "type": "core::felt252" + }, + { + "name": "uri", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "model", + "inputs": [ + { + "name": "name", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::starknet::class_hash::ClassHash" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "register_model", + "inputs": [ + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "deploy_contract", + "inputs": [ + { + "name": "salt", + "type": "core::felt252" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "upgrade_contract", + "inputs": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [ + { + "type": "core::starknet::class_hash::ClassHash" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "uuid", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u32" + } + ], + "state_mutability": "external" + }, + { + "type": "function", + "name": "emit", + "inputs": [ + { + "name": "keys", + "type": "core::array::Array::" + }, + { + "name": "values", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "view" + }, + { + "type": "function", + "name": "entity", + "inputs": [ + { + "name": "model", + "type": "core::felt252" + }, + { + "name": "keys", + "type": "core::array::Span::" + }, + { + "name": "offset", + "type": "core::integer::u8" + }, + { + "name": "length", + "type": "core::integer::u32" + }, + { + "name": "layout", + "type": "core::array::Span::" + } + ], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_entity", + "inputs": [ + { + "name": "model", + "type": "core::felt252" + }, + { + "name": "keys", + "type": "core::array::Span::" + }, + { + "name": "offset", + "type": "core::integer::u8" + }, + { + "name": "values", + "type": "core::array::Span::" + }, + { + "name": "layout", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "entities", + "inputs": [ + { + "name": "model", + "type": "core::felt252" + }, + { + "name": "index", + "type": "core::option::Option::" + }, + { + "name": "values", + "type": "core::array::Span::" + }, + { + "name": "values_length", + "type": "core::integer::u32" + }, + { + "name": "values_layout", + "type": "core::array::Span::" + } + ], + "outputs": [ + { + "type": "(core::array::Span::, core::array::Span::>)" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "entity_ids", + "inputs": [ + { + "name": "model", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "set_executor", + "inputs": [ + { + "name": "contract_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "executor", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "base", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::class_hash::ClassHash" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "delete_entity", + "inputs": [ + { + "name": "model", + "type": "core::felt252" + }, + { + "name": "keys", + "type": "core::array::Span::" + }, + { + "name": "layout", + "type": "core::array::Span::" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "is_owner", + "inputs": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "resource", + "type": "core::felt252" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "grant_owner", + "inputs": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "resource", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "revoke_owner", + "inputs": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "resource", + "type": "core::felt252" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "is_writer", + "inputs": [ + { + "name": "model", + "type": "core::felt252" + }, + { + "name": "system", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::bool" + } + ], + "state_mutability": "view" + }, + { + "type": "function", + "name": "grant_writer", + "inputs": [ + { + "name": "model", + "type": "core::felt252" + }, + { + "name": "system", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + }, + { + "type": "function", + "name": "revoke_writer", + "inputs": [ + { + "name": "model", + "type": "core::felt252" + }, + { + "name": "system", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "impl", + "name": "UpgradeableWorld", + "interface_name": "dojo::world::IUpgradeableWorld" + }, + { + "type": "interface", + "name": "dojo::world::IUpgradeableWorld", + "items": [ + { + "type": "function", + "name": "upgrade", + "inputs": [ + { + "name": "new_class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [ + { + "name": "executor", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "contract_base", + "type": "core::starknet::class_hash::ClassHash" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::WorldSpawned", + "kind": "struct", + "members": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "creator", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::ContractDeployed", + "kind": "struct", + "members": [ + { + "name": "salt", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + }, + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::ContractUpgraded", + "kind": "struct", + "members": [ + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + }, + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::WorldUpgraded", + "kind": "struct", + "members": [ + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::MetadataUpdate", + "kind": "struct", + "members": [ + { + "name": "resource", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "uri", + "type": "core::array::Span::", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::ModelRegistered", + "kind": "struct", + "members": [ + { + "name": "name", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + }, + { + "name": "prev_class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::StoreSetRecord", + "kind": "struct", + "members": [ + { + "name": "table", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "keys", + "type": "core::array::Span::", + "kind": "data" + }, + { + "name": "offset", + "type": "core::integer::u8", + "kind": "data" + }, + { + "name": "values", + "type": "core::array::Span::", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::StoreDelRecord", + "kind": "struct", + "members": [ + { + "name": "table", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "keys", + "type": "core::array::Span::", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::WriterUpdated", + "kind": "struct", + "members": [ + { + "name": "model", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "system", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "value", + "type": "core::bool", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::OwnerUpdated", + "kind": "struct", + "members": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "resource", + "type": "core::felt252", + "kind": "data" + }, + { + "name": "value", + "type": "core::bool", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::ExecutorUpdated", + "kind": "struct", + "members": [ + { + "name": "address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + }, + { + "name": "prev_address", + "type": "core::starknet::contract_address::ContractAddress", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::world::world::Event", + "kind": "enum", + "variants": [ + { + "name": "WorldSpawned", + "type": "dojo::world::world::WorldSpawned", + "kind": "nested" + }, + { + "name": "ContractDeployed", + "type": "dojo::world::world::ContractDeployed", + "kind": "nested" + }, + { + "name": "ContractUpgraded", + "type": "dojo::world::world::ContractUpgraded", + "kind": "nested" + }, + { + "name": "WorldUpgraded", + "type": "dojo::world::world::WorldUpgraded", + "kind": "nested" + }, + { + "name": "MetadataUpdate", + "type": "dojo::world::world::MetadataUpdate", + "kind": "nested" + }, + { + "name": "ModelRegistered", + "type": "dojo::world::world::ModelRegistered", + "kind": "nested" + }, + { + "name": "StoreSetRecord", + "type": "dojo::world::world::StoreSetRecord", + "kind": "nested" + }, + { + "name": "StoreDelRecord", + "type": "dojo::world::world::StoreDelRecord", + "kind": "nested" + }, + { + "name": "WriterUpdated", + "type": "dojo::world::world::WriterUpdated", + "kind": "nested" + }, + { + "name": "OwnerUpdated", + "type": "dojo::world::world::OwnerUpdated", + "kind": "nested" + }, + { + "name": "ExecutorUpdated", + "type": "dojo::world::world::ExecutorUpdated", + "kind": "nested" + } + ] + } + ], + "reads": [], + "writes": [], + "computed": [] + }, + "executor": { + "name": "executor", + "address": null, + "class_hash": "0x585507fa2818fe78e66da6ea4c5915376739f4abf509d41153f60a16cb1f68d", + "abi": [ + { + "type": "impl", + "name": "Executor", + "interface_name": "dojo::executor::IExecutor" + }, + { + "type": "struct", + "name": "core::array::Span::", + "members": [ + { + "name": "snapshot", + "type": "@core::array::Array::" + } + ] + }, + { + "type": "interface", + "name": "dojo::executor::IExecutor", + "items": [ + { + "type": "function", + "name": "call", + "inputs": [ + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash" + }, + { + "name": "entrypoint", + "type": "core::felt252" + }, + { + "name": "calldata", + "type": "core::array::Span::" + } + ], + "outputs": [ + { + "type": "core::array::Span::" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "event", + "name": "dojo::executor::executor::Event", + "kind": "enum", + "variants": [] + } + ], + "reads": [], + "writes": [], + "computed": [] + }, + "base": { + "name": "base", + "class_hash": "0x6c458453d35753703ad25632deec20a29faf8531942ec109e6eb0650316a2bc", + "abi": [ + { + "type": "impl", + "name": "WorldProviderImpl", + "interface_name": "dojo::world::IWorldProvider" + }, + { + "type": "struct", + "name": "dojo::world::IWorldDispatcher", + "members": [ + { + "name": "contract_address", + "type": "core::starknet::contract_address::ContractAddress" + } + ] + }, + { + "type": "interface", + "name": "dojo::world::IWorldProvider", + "items": [ + { + "type": "function", + "name": "world", + "inputs": [], + "outputs": [ + { + "type": "dojo::world::IWorldDispatcher" + } + ], + "state_mutability": "view" + } + ] + }, + { + "type": "impl", + "name": "UpgradableImpl", + "interface_name": "dojo::components::upgradeable::IUpgradeable" + }, + { + "type": "interface", + "name": "dojo::components::upgradeable::IUpgradeable", + "items": [ + { + "type": "function", + "name": "upgrade", + "inputs": [ + { + "name": "new_class_hash", + "type": "core::starknet::class_hash::ClassHash" + } + ], + "outputs": [], + "state_mutability": "external" + } + ] + }, + { + "type": "constructor", + "name": "constructor", + "inputs": [] + }, + { + "type": "event", + "name": "dojo::components::upgradeable::upgradeable::Upgraded", + "kind": "struct", + "members": [ + { + "name": "class_hash", + "type": "core::starknet::class_hash::ClassHash", + "kind": "data" + } + ] + }, + { + "type": "event", + "name": "dojo::components::upgradeable::upgradeable::Event", + "kind": "enum", + "variants": [ + { + "name": "Upgraded", + "type": "dojo::components::upgradeable::upgradeable::Upgraded", + "kind": "nested" + } + ] + }, + { + "type": "event", + "name": "dojo::base::base::Event", + "kind": "enum", + "variants": [ + { + "name": "UpgradeableEvent", + "type": "dojo::components::upgradeable::upgradeable::Event", + "kind": "nested" + } + ] + } + ] + }, + "contracts": [ + { + "name": "cairo_v240", + "address": null, + "class_hash": "0x714353d2a54cfd74820f89c19d8911a379214d5d4ccf369d74b5f5844dc565f", + "abi": [ + { + "type": "event", + "name": "cairo_v240::cairo_v240::Event", + "kind": "enum", + "variants": [] + } + ], + "reads": [], + "writes": [], + "computed": [] + } + ], + "models": [] +} diff --git a/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/.gitignore b/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/.gitignore new file mode 100644 index 0000000000..eb5a316cbd --- /dev/null +++ b/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/.gitignore @@ -0,0 +1 @@ +target diff --git a/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/Scarb.lock b/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/Scarb.lock new file mode 100644 index 0000000000..c4e6511205 --- /dev/null +++ b/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/Scarb.lock @@ -0,0 +1,20 @@ +# Code generated by scarb DO NOT EDIT. +version = 1 + +[[package]] +name = "cairo_v240" +version = "0.1.0" +dependencies = [ + "dojo", +] + +[[package]] +name = "dojo" +version = "0.4.0-rc0" +dependencies = [ + "dojo_plugin", +] + +[[package]] +name = "dojo_plugin" +version = "0.4.0" diff --git a/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/Scarb.toml b/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/Scarb.toml new file mode 100644 index 0000000000..d04b4e8e47 --- /dev/null +++ b/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/Scarb.toml @@ -0,0 +1,23 @@ +[package] +name = "cairo_v240" +version = "0.1.0" +edition = "2023_10" +cairo-version = "2.4.0" + +# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html + +[cairo] +sierra-replace-ids = true + +[dependencies] +dojo = { path = "../../../../dojo-core" } + +[[target.dojo]] +build-external-contracts = [ ] + +[tool.dojo.world] +description = "Cairo 240 features" +name = "compiler_cairo_240" + +[tool.dojo.env] +rpc_url = "http://localhost:5050/" diff --git a/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/src/lib.cairo b/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/src/lib.cairo new file mode 100644 index 0000000000..e3a0cb13f3 --- /dev/null +++ b/crates/dojo-lang/src/manifest_test_data/compiler_cairo_v240/src/lib.cairo @@ -0,0 +1,57 @@ +//! Cairo 2.4.0 feature testing. +#[starknet::contract] +mod cairo_v240 { + use core::fmt::Formatter; + + #[storage] + struct Storage {} + + fn byte_array(self: @ContractState) -> ByteArray { + let mut ba: ByteArray = ""; + ba.append_word('ABCDEFGHIJKLMNOPQRSTUVWXYZ12345', 31); + ba.append_byte(0x65); + + let mut bc: ByteArray = ""; + bc.append(@ba); + + bc + } + + fn formatter(self: @ContractState) { + let var = 5; + let mut formatter: Formatter = Default::default(); + write!(formatter, "test"); + write!(formatter, "{var:?}"); + println!("{}", formatter.buffer); //prints test5 + } + + fn format(self: @ContractState) { + let var1 = 5; + let var2: ByteArray = "hello"; + let var3 = 5_u32; + let ba = format!("{},{},{}", var1, var2, var3); + let ba = format!("{var1}{var2}{var3}"); + let ba = format!("{var1:?}{var2:?}{var3:?}"); + } + + fn long_panic(self: @ContractState) { + panic!("this should not be reached, but at least I'm not limited to 31 characters anymore") + } + + #[derive(Drop, Debug, PartialEq)] + struct MyStruct { + a: u8, + b: u8 + } + + fn asserts(self: @ContractState) { + let var1 = 5; + let var2 = 6; + assert!(var1 != var2, "should not be equal"); + assert!(var1 != var2, "{},{} should not be equal", var1, var2); + + let first = MyStruct { a: 1, b: 2 }; + let second = MyStruct { a: 1, b: 2 }; + assert_eq!(first, second, "{:?},{:?} should be equal", first, second); + } +} diff --git a/crates/torii/graphql/src/tests/types-test/Scarb.lock b/crates/torii/graphql/src/tests/types-test/Scarb.lock index e229ddf091..a61afd0460 100644 --- a/crates/torii/graphql/src/tests/types-test/Scarb.lock +++ b/crates/torii/graphql/src/tests/types-test/Scarb.lock @@ -3,14 +3,15 @@ version = 1 [[package]] name = "dojo" -version = "0.3.15" +version = "0.4.0-rc0" dependencies = [ "dojo_plugin", ] [[package]] name = "dojo_plugin" -version = "0.4.0" +version = "0.3.11" +source = "git+https://github.com/dojoengine/dojo?tag=v0.3.11#1e651b5d4d3b79b14a7d8aa29a92062fcb9e6659" [[package]] name = "types_test" From a08f2cbd7ea7bacc5e40f83eff0e69b3183501ca Mon Sep 17 00:00:00 2001 From: Tarrence van As Date: Sat, 9 Dec 2023 20:32:27 -0500 Subject: [PATCH 3/3] Dojoup in devcontainer --- .devcontainer/Dockerfile | 30 +++++++--------- .devcontainer/devcontainer.json | 2 +- .github/workflows/devcontainer.yml | 16 ++++----- README.md | 58 +----------------------------- 4 files changed, 21 insertions(+), 85 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b82f63fde9..34193ffd83 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,6 @@ # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/rust/.devcontainer/base.Dockerfile -# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): buster, bullseye +# [Choice] Debian OS version (use bookworm on local arm64/Apple Silicon): buster, bullseye, bookworm ARG VARIANT FROM mcr.microsoft.com/vscode/devcontainers/rust:${VARIANT} @@ -10,27 +10,21 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ RUN apt install -y libgmp3-dev -RUN rustup toolchain install 1.70.0 && \ - rustup default 1.70.0 && rustup component add clippy && rustup component add rustfmt +COPY rust-toolchain.toml . -# Install Python -ARG PYTHON_PATH=/usr/local/python -ENV PIPX_HOME=/usr/local/py-utils \ - PIPX_BIN_DIR=/usr/local/py-utils/bin -ENV PATH=${PYTHON_PATH}/bin:${PATH}:${PIPX_BIN_DIR} -COPY .devcontainer/library-scripts/python-debian.sh /tmp/library-scripts/ -RUN apt-get update && bash /tmp/library-scripts/python-debian.sh "3.9.6" "${PYTHON_PATH}" "${PIPX_HOME}" +# 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 -# Install nodejs -ENV NVM_DIR="/usr/local/share/nvm" -ENV NVM_SYMLINK_CURRENT=true \ - PATH=${NVM_DIR}/current/bin:${PATH} -COPY .devcontainer/library-scripts/node-debian.sh /tmp/library-scripts/ -RUN apt-get update && bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" +RUN rustup toolchain install $(cat rust-toolchain.toml | grep channel | cut -d\" -f2) && \ + rustup default $(cat rust-toolchain.toml | grep channel | cut -d\" -f2) && \ + rustup component add clippy && \ + rustup component add rustfmt + +RUN cargo binstall cargo-nextest --secure -y # Install dojoup and scarb for vscode user USER vscode 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}:/workspaces/dojo/target/release +ENV PATH=${PATH}:/workspaces/dojo/target/release:/home/vscode/.dojo/bin +RUN /home/vscode/.dojo/bin/dojoup diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d07a3d1460..d5e2cd4424 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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:72f7bc2220f0438e435052f807e58c09b7b61cbe", + "image": "ghcr.io/dojoengine/dojo-dev:affacdd", "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index acd7b3f6ca..8e68287856 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -9,7 +9,7 @@ on: jobs: build-and-push: - runs-on: ubuntu-latest + runs-on: ubuntu-latest-4-cores env: DOCKER_TAG: latest @@ -42,7 +42,7 @@ jobs: run: | SHORT_SHA=$(echo "${{ github.sha }}" | cut -c 1-7) echo "DOCKER_TAG=$SHORT_SHA" >> $GITHUB_ENV - + - name: Set outputs id: release_info run: | @@ -55,10 +55,9 @@ jobs: file: .devcontainer/Dockerfile tags: ghcr.io/${{ github.repository }}-dev:latest,ghcr.io/${{ github.repository }}-dev:${{ env.DOCKER_TAG }} build-args: | - VARIANT=bullseye + VARIANT=bookworm platforms: linux/amd64,linux/arm64 cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-dev:latest - cache-to: type=registry,ref=ghcr.io/${{ github.repository }}-dev:cache propose-update-pr: needs: build-and-push @@ -70,8 +69,7 @@ jobs: uses: actions/checkout@v2 - name: Update devcontainer.json - run: | - sed -i "s|ghcr.io/dojoengine/dojo-dev:[a-zA-Z0-9._-]*|ghcr.io/dojoengine/dojo-dev:${{ needs.build-and-push.outputs.tag_name }}|" .devcontainer/devcontainer.json + run: sed -i "s|ghcr.io/dojoengine/dojo-dev:[a-zA-Z0-9._-]*|ghcr.io/dojoengine/dojo-dev:${{ needs.build-and-push.outputs.tag_name }}|" .devcontainer/devcontainer.json - name: Setup Git credentials run: | @@ -83,14 +81,14 @@ jobs: git add .devcontainer/devcontainer.json git commit -m "Update devcontainer image hash: ${{ needs.build-and-push.outputs.tag_name }}" git checkout -b devcontainer-${{ needs.build-and-push.outputs.tag_name }} - git push --set-upstream origin devcontainer--${{ needs.build-and-push.outputs.tag_name }} + git push --set-upstream origin devcontainer-${{ needs.build-and-push.outputs.tag_name }} - name: Create Pull Request uses: peter-evans/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} title: "Update devcontainer image hash: ${{ needs.build-and-push.outputs.tag_name }}" - commit-message: "Update devcontainer image hash" - branch: update-devcontainer-image-hash + commit-message: "Update devcontainer image hash: ${{ needs.build-and-push.outputs.tag_name }}" + branch: devcontainer-${{ needs.build-and-push.outputs.tag_name }} base: main delete-branch: true diff --git a/README.md b/README.md index 849598b475..2fdde944ff 100644 --- a/README.md +++ b/README.md @@ -67,60 +67,4 @@ We welcome contributions of all kinds from anyone. See our [Contribution Guide]( ## ✏️ Enviroment -See our [Enviroment setup](https://book.dojoengine.org/getting-started/setup.html) for more information. - -## Contributors ✨ - -Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tarrence van As
Tarrence van As

💻
Mathieu
Mathieu

💻
Shramee Srivastav
Shramee Srivastav

💻
omahs
omahs

💻
Larko
Larko

💻
Loaf
Loaf

💻
Milan Cermak
Milan Cermak

💻
drspacemn
drspacemn

💻
greged93
greged93

💻
Junichi Sugiura
Junichi Sugiura

💻
Thomas Belloc
Thomas Belloc

💻
Yun
Yun

💻
Ammar Arif
Ammar Arif

💻
ftupas
ftupas

💻
whatthedev.eth
whatthedev.eth

💻
raschel
raschel

💻
sparqet
sparqet

💻
Pia
Pia

💻
bing
bing

💻
ptisserand
ptisserand

💻
glihm
glihm

💻
Caspar Oostendorp
Caspar Oostendorp

💻
Jonathan LEI
Jonathan LEI

💻
Paweł
Paweł

💻
lambda-0x
lambda-0x

💻
Harsh Bajpai
Harsh Bajpai

💻
johann bestowrous
johann bestowrous

💻
- - - - - - -This project follows the -[all-contributors](https://github.com/all-contributors/all-contributors) -specification. Contributions of any kind welcome! +See our [Enviroment setup](https://book.dojoengine.org/getting-started/setup.html) for more information. \ No newline at end of file