-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for model from other libraries #2172
Conversation
WalkthroughRecent updates focus on improving contract selectors, upgrades, and namespace handling within the Dojo framework. Significant changes include the introduction of the Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2172 +/- ##
==========================================
- Coverage 68.12% 67.21% -0.91%
==========================================
Files 333 334 +1
Lines 42720 43022 +302
==========================================
- Hits 29101 28917 -184
- Misses 13619 14105 +486 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range, codebase verification and nitpick comments (5)
examples/game-lib/armory/src/lib.cairo (1)
1-2
: Ensure correct derivation attributes.The
Drop
trait is typically used to run code when a value goes out of scope. Ensure that this is intentional and necessary for theFlatbow
struct.examples/game-lib/bestiary/src/lib.cairo (1)
1-2
: Ensure correct derivation attributes.The
Drop
trait is typically used to run code when a value goes out of scope. Ensure that this is intentional and necessary for theRiverSkale
struct.examples/game-lib/manifests/dev/base/models/armory-Flatbow-f269a4c3.toml (1)
1-21
: Missing ABI file and potential metadata inconsistencyThe referenced ABI file
manifests/dev/base/abis/models/armory-Flatbow-f269a4c3.json
does not exist in the project. This needs to be corrected to ensure proper functionality. Additionally, theclass_hash
andoriginal_class_hash
values are not found elsewhere in the project, which might indicate they are unique identifiers, but this should be verified.
- ABI file does not exist:
manifests/dev/base/abis/models/armory-Flatbow-f269a4c3.json
- class_hash and original_class_hash: Only found in
examples/game-lib/manifests/dev/base/models/armory-Flatbow-f269a4c3.toml
Analysis chain
Ensure correctness and consistency of metadata.
The manifest file correctly specifies metadata for the Dojo model. Verify that the
class_hash
,original_class_hash
,abi
path, and member definitions are accurate and consistent with the rest of the project.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify metadata for the model in the manifest file. # Test: Search for the model's class hash, ABI path, and other metadata in the project. rg --type toml 'class_hash = "0x3a448f0a99ccf65cc1d2c888ba5fafb4a2f85c4e70d2e022147e5b1fe7ce1bf"' rg --type toml 'original_class_hash = "0x3a448f0a99ccf65cc1d2c888ba5fafb4a2f85c4e70d2e022147e5b1fe7ce1bf"' rg --type toml 'abi = "manifests/dev/base/abis/models/armory-Flatbow-f269a4c3.json"'Length of output: 916
Script:
#!/bin/bash # Verify if the class_hash and original_class_hash are used consistently across the project rg '0x3a448f0a99ccf65cc1d2c888ba5fafb4a2f85c4e70d2e022147e5b1fe7ce1bf' # Check if the ABI file exists if [ -f "manifests/dev/base/abis/models/armory-Flatbow-f269a4c3.json" ]; then echo "ABI file exists: manifests/dev/base/abis/models/armory-Flatbow-f269a4c3.json" else echo "ABI file does not exist: manifests/dev/base/abis/models/armory-Flatbow-f269a4c3.json" fiLength of output: 639
bin/sozo/tests/register_test.rs (1)
31-31
: Ensure proper error handling forprepare_migration
function.Consider adding error handling to provide more context in case of failure.
let migration = prepare_migration( config.manifest_path().parent().unwrap().into(), target_path, dojo_metadata.skip_migration, &default_namespace, ).expect("Failed to prepare migration.");examples/spawn-and-move/manifests/dev/deployment/abis/contracts/dojo_examples-actions-40b6994c.json (1)
299-310
: Test coverage missing forenter_dungeon
functionIt appears that the
enter_dungeon
function is not currently tested in the codebase. To ensure comprehensive test coverage, please add test cases for this function.
- Location to address:
examples/spawn-and-move/src/actions.cairo
Analysis chain
New function
enter_dungeon
added todojo_examples::actions::IActions
.The new function takes a
dungeon_address
as input and hasexternal
state mutability. Ensure that this new function is properly tested.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `enter_dungeon` function is tested. # Test: Search for test cases related to `enter_dungeon`. Expect: Test cases should be present. rg --type rust 'enter_dungeon'Length of output: 30
Script:
#!/bin/bash # Description: Verify that the `enter_dungeon` function is tested. # Test: Search for occurrences of `enter_dungeon` in all files to ensure it is tested somewhere. rg 'enter_dungeon'Length of output: 780
Script:
#!/bin/bash # Description: Verify if there are any test files that might include `enter_dungeon` indirectly. # Test: Search for test files that might contain references to `enter_dungeon`. fd --type f --name '*test*'Length of output: 280
Script:
#!/bin/bash # Description: Verify if there are any test files that might include `enter_dungeon` indirectly. # Corrected Test: Search for test files that might contain references to `enter_dungeon`. fd --type f testLength of output: 2042
Script:
#!/bin/bash # Description: Search for `enter_dungeon` references within identified test files. # Test: Search for occurrences of `enter_dungeon` in the identified test files. rg 'enter_dungeon' $(fd --type f test)Length of output: 2062
Script:
#!/bin/bash # Description: Search for indirect references to `enter_dungeon` within identified test files. # Test: Search for occurrences of related functions or modules that might invoke `enter_dungeon`. rg 'enter_dungeon' $(fd --type f test)Length of output: 2062
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (3)
examples/game-lib/Scarb.lock
is excluded by!**/*.lock
examples/game-lib/armory/Scarb.lock
is excluded by!**/*.lock
examples/spawn-and-move/Scarb.lock
is excluded by!**/*.lock
Files selected for processing (55)
- bin/sozo/src/commands/build.rs (2 hunks)
- bin/sozo/src/commands/clean.rs (3 hunks)
- bin/sozo/src/commands/migrate.rs (1 hunks)
- bin/sozo/tests/register_test.rs (3 hunks)
- bin/sozo/tests/test_migrate.rs (3 hunks)
- crates/dojo-bindgen/src/lib.rs (1 hunks)
- crates/dojo-bindgen/src/plugins/typescript_v2/mod.rs (2 hunks)
- crates/dojo-core/Scarb.toml (1 hunks)
- crates/dojo-lang/src/compiler.rs (1 hunks)
- crates/dojo-lang/src/contract.rs (2 hunks)
- crates/dojo-lang/src/model.rs (1 hunks)
- crates/dojo-lang/src/plugin.rs (8 hunks)
- crates/dojo-lang/src/plugin_test_data/print (1 hunks)
- crates/dojo-lang/src/plugin_test_data/system (2 hunks)
- crates/dojo-lang/src/semantics/test_data/get (3 hunks)
- crates/dojo-lang/src/semantics/test_data/set (3 hunks)
- crates/dojo-lang/src/utils.rs (2 hunks)
- crates/dojo-test-utils/src/compiler.rs (5 hunks)
- crates/dojo-world/src/contracts/model_test.rs (2 hunks)
- crates/dojo-world/src/contracts/world_test.rs (2 hunks)
- crates/dojo-world/src/manifest/manifest_test.rs (3 hunks)
- crates/sozo/ops/src/migration/mod.rs (5 hunks)
- crates/sozo/ops/src/tests/setup.rs (2 hunks)
- crates/torii/core/src/sql_test.rs (5 hunks)
- crates/torii/graphql/src/tests/mod.rs (4 hunks)
- crates/torii/grpc/src/server/tests/entities_test.rs (2 hunks)
- examples/game-lib/Scarb.toml (1 hunks)
- examples/game-lib/armory/Scarb.toml (1 hunks)
- examples/game-lib/armory/manifests/dev/base/abis/dojo-base.json (1 hunks)
- examples/game-lib/armory/manifests/dev/base/abis/dojo-world.json (1 hunks)
- examples/game-lib/armory/manifests/dev/base/abis/models/armory-ModelA-19290fb7.json (1 hunks)
- examples/game-lib/armory/manifests/dev/base/dojo-base.toml (1 hunks)
- examples/game-lib/armory/manifests/dev/base/dojo-world.toml (1 hunks)
- examples/game-lib/armory/manifests/dev/base/models/armory-ModelA-19290fb7.toml (1 hunks)
- examples/game-lib/armory/src/lib.cairo (1 hunks)
- examples/game-lib/bestiary/Scarb.toml (1 hunks)
- examples/game-lib/bestiary/src/lib.cairo (1 hunks)
- examples/game-lib/manifests/dev/base/abis/dojo-base.json (1 hunks)
- examples/game-lib/manifests/dev/base/abis/dojo-world.json (1 hunks)
- examples/game-lib/manifests/dev/base/abis/models/armory-Flatbow-f269a4c3.json (1 hunks)
- examples/game-lib/manifests/dev/base/abis/models/bestiary-RiverSkale-1bce2040.json (1 hunks)
- examples/game-lib/manifests/dev/base/dojo-base.toml (1 hunks)
- examples/game-lib/manifests/dev/base/dojo-world.toml (1 hunks)
- examples/game-lib/manifests/dev/base/models/armory-Flatbow-f269a4c3.toml (1 hunks)
- examples/game-lib/manifests/dev/base/models/bestiary-RiverSkale-1bce2040.toml (1 hunks)
- examples/spawn-and-move/Scarb.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-actions-40b6994c.json (1 hunks)
- examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-dungeon-6620e0e6.json (3 hunks)
- examples/spawn-and-move/manifests/dev/base/abis/models/dojo_examples-Flatbow-3632af69.json (1 hunks)
- examples/spawn-and-move/manifests/dev/base/abis/models/dojo_examples-RiverSkale-27fcbc29.json (1 hunks)
- examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-actions-40b6994c.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-dungeon-6620e0e6.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/base/models/dojo_examples-Flatbow-3632af69.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/base/models/dojo_examples-RiverSkale-27fcbc29.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/deployment/abis/contracts/dojo_examples-actions-40b6994c.json (1 hunks)
Files not processed due to max files limit (19)
- examples/spawn-and-move/manifests/dev/deployment/abis/contracts/dojo_examples-dungeon-6620e0e6.json
- examples/spawn-and-move/manifests/dev/deployment/abis/models/dojo_examples-Flatbow-3632af69.json
- examples/spawn-and-move/manifests/dev/deployment/abis/models/dojo_examples-ModelA-689f21bc.json
- examples/spawn-and-move/manifests/dev/deployment/abis/models/dojo_examples-RiverSkale-27fcbc29.json
- examples/spawn-and-move/manifests/dev/deployment/manifest.json
- examples/spawn-and-move/manifests/dev/deployment/manifest.toml
- examples/spawn-and-move/manifests/release/base/abis/contracts/dojo_examples-actions-40b6994c.json
- examples/spawn-and-move/manifests/release/base/abis/contracts/dojo_examples-dungeon-6620e0e6.json
- examples/spawn-and-move/manifests/release/base/abis/models/dojo_examples-Flatbow-3632af69.json
- examples/spawn-and-move/manifests/release/base/abis/models/dojo_examples-RiverSkale-27fcbc29.json
- examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-actions-40b6994c.toml
- examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-dungeon-6620e0e6.toml
- examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-something-71cfad55.toml
- examples/spawn-and-move/manifests/release/base/models/dojo_examples-Flatbow-3632af69.toml
- examples/spawn-and-move/manifests/release/base/models/dojo_examples-RiverSkale-27fcbc29.toml
- examples/spawn-and-move/src/actions.cairo
- examples/spawn-and-move/src/dungeon.cairo
- examples/spawn-and-move/src/lib.cairo
- examples/spawn-and-move/src/something.cairo
Files not summarized due to errors (1)
- crates/dojo-lang/src/plugin_test_data/system: Error: Message exceeds token limit
Files skipped from review due to trivial changes (9)
- bin/sozo/src/commands/migrate.rs
- crates/dojo-core/Scarb.toml
- examples/game-lib/Scarb.toml
- examples/game-lib/armory/Scarb.toml
- examples/game-lib/armory/manifests/dev/base/dojo-base.toml
- examples/game-lib/armory/manifests/dev/base/dojo-world.toml
- examples/game-lib/manifests/dev/base/dojo-base.toml
- examples/game-lib/manifests/dev/base/dojo-world.toml
- examples/spawn-and-move/manifests/dev/base/models/dojo_examples-RiverSkale-27fcbc29.toml
Additional comments not posted (182)
examples/game-lib/armory/src/lib.cairo (2)
2-2
: Check the usage ofdojo::model
.Verify if additional configuration for
dojo::model
is required, especially if there are specific attributes or namespace settings needed.
3-8
: LGTM!The struct definition looks good. Each field is defined with appropriate types and key annotations.
examples/game-lib/bestiary/src/lib.cairo (2)
2-2
: Check the usage ofdojo::model
.Verify if additional configuration for
dojo::model
is required, especially if there are specific attributes or namespace settings needed.
3-9
: LGTM!The struct definition looks good. Each field is defined with appropriate types and key annotations.
examples/game-lib/bestiary/Scarb.toml (3)
1-4
: LGTM!The package metadata is defined correctly.
6-8
: LGTM!The dependencies are set up correctly.
9-16
: Verify namespace usage.Ensure that the namespace configuration aligns with the new functionality for importing models/contracts.
examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-actions-40b6994c.toml (3)
1-1
: LGTM!The contract type is correctly specified.
2-3
: Verify class hashes.Ensure that the class hashes are correct and match the deployed contract.
4-4
: LGTM!The ABI path is correctly specified.
examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-dungeon-6620e0e6.toml (1)
1-11
: Ensure correctness and consistency of metadata.The manifest file correctly specifies metadata for the Dojo contract. Verify that the
class_hash
,original_class_hash
,base_class_hash
, andabi
path are accurate and consistent with the rest of the project.Verification successful
The metadata in the manifest file is accurate and consistent.
The
class_hash
,original_class_hash
,base_class_hash
, andabi
path specified in the manifest file are consistent with other parts of the project.
class_hash
andoriginal_class_hash
are correctly referenced in multiple manifest files.base_class_hash
value of "0x0" is consistently used across different manifest files.- The
abi
path is correctly specified in the given manifest file.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify metadata for the contract in the manifest file. # Test: Search for the contract's class hash, ABI path, and other metadata in the project. rg --type toml 'class_hash = "0x14b3096b82a761f63dd47277c2b5ac18925dea43586418483939a2f1f57f674"' rg --type toml 'original_class_hash = "0x14b3096b82a761f63dd47277c2b5ac18925dea43586418483939a2f1f57f674"' rg --type toml 'base_class_hash = "0x0"' rg --type toml 'abi = "manifests/dev/base/abis/contracts/dojo_examples-dungeon-6620e0e6.json"'Length of output: 3231
examples/game-lib/armory/manifests/dev/base/models/armory-ModelA-19290fb7.toml (1)
1-16
: Ensure correctness and consistency of metadata.The manifest file correctly specifies metadata for the Dojo model. Verify that the
class_hash
,original_class_hash
,abi
path, and member definitions are accurate and consistent with the rest of the project.Verification successful
Metadata is correctly specified and consistent.
- The
class_hash
,original_class_hash
, andabi
path are present and consistent within the fileexamples/game-lib/armory/manifests/dev/base/models/armory-ModelA-19290fb7.toml
.- These values are not duplicated elsewhere in the project, ensuring no inconsistencies.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify metadata for the model in the manifest file. # Test: Search for the model's class hash, ABI path, and other metadata in the project. rg --type toml 'class_hash = "0xc9cbc616fe628f80bb6d80181100c50e2053c811bcd1ae148bdaebc472a602"' rg --type toml 'original_class_hash = "0xc9cbc616fe628f80bb6d80181100c50e2053c811bcd1ae148bdaebc472a602"' rg --type toml 'abi = "manifests/dev/base/abis/models/armory-ModelA-19290fb7.json"'Length of output: 933
Script:
#!/bin/bash # Description: Verify metadata consistency for the model across the project. # Test: Search for the model's class hash, original class hash, and ABI path in the entire project. rg '0xc9cbc616fe628f80bb6d80181100c50e2053c811bcd1ae148bdaebc472a602' rg 'manifests/dev/base/abis/models/armory-ModelA-19290fb7.json'Length of output: 606
examples/spawn-and-move/manifests/dev/base/models/dojo_examples-Flatbow-3632af69.toml (1)
1-21
: Ensure correctness and consistency of metadata.The manifest file correctly specifies metadata for the Dojo model. Verify that the
class_hash
,original_class_hash
,abi
path, and member definitions are accurate and consistent with the rest of the project.Verification successful
Metadata verification successful.
The
class_hash
,original_class_hash
, andabi
path specified in the manifest file are consistent across the project.
class_hash
:0x452abb4fc0af6e0e08e6f652ce77d7330000d4e4bec995005785c7d3f12ea1a
original_class_hash
:0x452abb4fc0af6e0e08e6f652ce77d7330000d4e4bec995005785c7d3f12ea1a
abi
path:manifests/dev/base/abis/models/dojo_examples-Flatbow-3632af69.json
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify metadata for the model in the manifest file. # Test: Search for the model's class hash, ABI path, and other metadata in the project. rg --type toml 'class_hash = "0x452abb4fc0af6e0e08e6f652ce77d7330000d4e4bec995005785c7d3f12ea1a"' rg --type toml 'original_class_hash = "0x452abb4fc0af6e0e08e6f652ce77d7330000d4e4bec995005785c7d3f12ea1a"' rg --type toml 'abi = "manifests/dev/base/abis/models/dojo_examples-Flatbow-3632af69.json"'Length of output: 1963
examples/game-lib/manifests/dev/base/models/bestiary-RiverSkale-1bce2040.toml (2)
1-6
: Review Dojo model metadata.The metadata for the Dojo model includes the
class_hash
,original_class_hash
,abi
path,tag
, andmanifest_name
. Ensure these values are correct and correspond to the actual model and its ABI.Please verify that the class hashes, ABI path, tag, and manifest name are correct and correspond to the actual model.
8-26
: Review Dojo model members.The model members are defined with their names, types, and key status. Ensure that the member definitions are correct and consistent with the model's requirements.
The member definitions look correct and consistent with the model's requirements.
examples/spawn-and-move/Scarb.toml (2)
14-21
: Review new dependencies and build targets.The new dependencies for
armory
andbestiary
and thebuild-external-contracts
target are defined. Ensure these dependencies and targets are correctly defined and consistent with the project's requirements.The new dependencies and build targets are correctly defined and consistent with the project's requirements.
24-25
: Review feature definitions.The
default
anddungeon
features are defined. Ensure these features are correctly defined and consistent with the project's requirements.The feature definitions look correct and consistent with the project's requirements.
bin/sozo/tests/test_migrate.rs (2)
12-13
: Review test setup.The test setup uses
CompilerTestSetup
to configure the test environment. Ensure the setup is correctly defined and consistent with the migration functionality.The test setup using
CompilerTestSetup
is correctly defined and consistent with the migration functionality.
45-45
: Review test assertions.The test assertions check the output for expected values. Ensure the assertions are correct and consistent with the migration functionality.
The test assertions are correct and consistent with the migration functionality.
crates/dojo-lang/src/utils.rs (2)
13-15
: Ensure proper error handling in theget_default_namespace
function.The function should handle errors properly when reading and parsing the configuration file.
Ensure the function handles errors properly when reading and parsing the
Scarb.toml
file.
41-48
: Review namespace extraction logic.The logic for extracting the namespace from the configuration file is correct. Ensure the function correctly identifies and returns the namespace.
The namespace extraction logic is correct and consistent with the project's requirements.
examples/game-lib/armory/manifests/dev/base/abis/dojo-base.json (6)
3-5
: LGTM! EntityWorldProviderImpl
is correctly defined.The implementation of the interface
dojo::world::IWorldProvider
is accurate.
8-14
: LGTM! EntityIWorldDispatcher
is correctly defined.The struct
dojo::world::IWorldDispatcher
is accurate.
18-31
: LGTM! EntityIWorldProvider
is correctly defined.The interface
dojo::world::IWorldProvider
with the functionworld
is accurate.
35-37
: LGTM! EntityUpgradableImpl
is correctly defined.The implementation of the interface
dojo::components::upgradeable::IUpgradeable
is accurate.
40-54
: LGTM! EntityIUpgradeable
is correctly defined.The interface
dojo::components::upgradeable::IUpgradeable
with the functionupgrade
is accurate.
63-97
: LGTM! Event entities are correctly defined.The events
Upgraded
,Event
, andEvent
are accurately defined with the necessary fields and variants.examples/game-lib/manifests/dev/base/abis/dojo-base.json (6)
3-5
: LGTM! EntityWorldProviderImpl
is correctly defined.The implementation of the interface
dojo::world::IWorldProvider
is accurate.
8-14
: LGTM! EntityIWorldDispatcher
is correctly defined.The struct
dojo::world::IWorldDispatcher
is accurate.
18-31
: LGTM! EntityIWorldProvider
is correctly defined.The interface
dojo::world::IWorldProvider
with the functionworld
is accurate.
35-37
: LGTM! EntityUpgradableImpl
is correctly defined.The implementation of the interface
dojo::components::upgradeable::IUpgradeable
is accurate.
40-54
: LGTM! EntityIUpgradeable
is correctly defined.The interface
dojo::components::upgradeable::IUpgradeable
with the functionupgrade
is accurate.
63-97
: LGTM! Event entities are correctly defined.The events
Upgraded
,Event
, andEvent
are accurately defined with the necessary fields and variants.bin/sozo/tests/register_test.rs (1)
17-18
: LGTM! Configuration setup usingCompilerTestSetup
is correct.The usage of
CompilerTestSetup
to build the test configuration is accurate and improves code maintainability.crates/dojo-lang/src/plugin_test_data/print (1)
80-133
: LGTM! Expected diagnostics for missing namespace are correctly defined.The diagnostics provide meaningful error messages to help users identify and fix issues related to missing the default namespace in the
Scarb.toml
file.crates/sozo/ops/src/tests/setup.rs (2)
2-2
: ImportCompilerTestSetup
is correct.The import statement for
CompilerTestSetup
aligns with the objectives of streamlining configuration processes.
30-31
: Correct usage ofCompilerTestSetup
inload_config
.The
CompilerTestSetup::from_examples
method is used correctly to initialize the setup and build the test configuration.crates/dojo-world/src/contracts/model_test.rs (2)
1-1
: ImportCompilerTestSetup
is correct.The import statement for
CompilerTestSetup
aligns with the objectives of streamlining configuration processes.
20-21
: Correct usage ofCompilerTestSetup
intest_model
.The
CompilerTestSetup::from_examples
method is used correctly to initialize the setup and build the test configuration.examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-dungeon-6620e0e6.json (5)
131-132
: Addition ofIDungeonImpl
implementation.The
IDungeonImpl
implementation for thedojo_examples::dungeon::IDungeon
interface is correctly added.
136-140
: Addition ofIDungeon
interface.The
dojo_examples::dungeon::IDungeon
interface is correctly added with theenter
function.
150-150
: Addition ofIDojoInitImpl
implementation.The
IDojoInitImpl
implementation for thedojo_examples::dungeon::dungeon::IDojoInit
interface is correctly added.
154-154
: Addition ofIDojoInit
interface.The
dojo_examples::dungeon::dungeon::IDojoInit
interface is correctly added with thedojo_init
function.
214-214
: Addition ofEvent
fordojo_examples::dungeon::dungeon
.The
Event
enum fordojo_examples::dungeon::dungeon
is correctly added with theUpgradeableEvent
variant.crates/torii/grpc/src/server/tests/entities_test.rs (2)
4-4
: ImportCompilerTestSetup
is correct.The import statement for
CompilerTestSetup
aligns with the objectives of streamlining configuration processes.
39-40
: Correct usage ofCompilerTestSetup
intest_entities_queries
.The
CompilerTestSetup::from_examples
method is used correctly to initialize the setup and build the test configuration.crates/dojo-world/src/contracts/world_test.rs (3)
4-4
: LGTM!The import statement for
CompilerTestSetup
is consistent with the objective of centralizing and streamlining the configuration process.
22-23
: LGTM!The test setup using
CompilerTestSetup
improves code clarity and maintainability by centralizing the configuration process.
24-24
: LGTM!The usage of
config
to read the workspace and obtain the default namespace is consistent with the centralized configuration process and ensures the correct namespace is used.crates/sozo/ops/src/migration/mod.rs (3)
57-57
: LGTM!The change in the return type of the
migrate
function toResult<Option<MigrationOutput>>
allows the function to returnNone
when no migration is needed, improving flexibility.
119-119
: LGTM!The usage of
default_namespace
to update the order of the world diff ensures that the correct namespace is applied during the migration process.
182-182
: LGTM!The usage of
default_namespace
during auto-authorization ensures that the correct namespace is applied during this process.crates/dojo-bindgen/src/lib.rs (3)
216-216
: LGTM!The import statement for
CompilerTestSetup
is consistent with the objective of centralizing and streamlining the configuration process.
224-225
: LGTM!The test setup using
CompilerTestSetup
improves code clarity and maintainability by centralizing the configuration process.
233-238
: LGTM!The usage of
config
to read the workspace and obtain the dojo metadata is consistent with the centralized configuration process and ensures the correct metadata is used.examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-actions-40b6994c.json (1)
302-310
: LGTM!The addition of the
enter_dungeon
function to thedojo_examples::actions::IActions
interface is consistent with the interface structure and follows the correct format.bin/sozo/src/commands/clean.rs (2)
175-177
: Refactor: UseCompilerTestSetup
inall_profile_clean_works
test function.The introduction of
CompilerTestSetup
improves code clarity and maintainability. Ensure that the changes do not introduce any issues in the test setup or execution.
Line range hint
94-104
:
Refactor: UseCompilerTestSetup
indefault_clean_works
test function.The introduction of
CompilerTestSetup
improves code clarity and maintainability. Ensure that the changes do not introduce any issues in the test setup or execution.Verification successful
Refactor: Use
CompilerTestSetup
indefault_clean_works
test function.The introduction of
CompilerTestSetup
improves code clarity and maintainability. Ensure that the changes do not introduce any issues in the test setup or execution.
- The
Profile
enum is correctly used and referenced fromscarb::compiler::Profile
.- The
CompilerTestSetup
struct is correctly utilized in thedefault_clean_works
function.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `default_clean_works` test function executes correctly. # Test: Run the `default_clean_works` test. Expect: Test should pass. cargo test default_clean_worksLength of output: 105
Script:
#!/bin/bash # Description: Search for the `default_clean_works` function and its dependencies in the codebase. # Search for the `default_clean_works` function in the codebase rg -A 10 'fn default_clean_works' # Search for the `CompilerTestSetup` struct implementation rg 'struct CompilerTestSetup' # Search for the `Profile` enum or struct implementation rg 'enum Profile'Length of output: 1047
Script:
#!/bin/bash # Description: Verify the usage of `Profile` in `bin/sozo/src/commands/clean.rs` and related files. # Search for the usage of `Profile` in `bin/sozo/src/commands/clean.rs` rg 'Profile' bin/sozo/src/commands/clean.rs # Search for the usage of `Profile` in the entire codebase to confirm its correct implementation rg 'Profile'Length of output: 8955
crates/torii/core/src/sql_test.rs (2)
Line range hint
63-107
:
Refactor: UseCompilerTestSetup
intest_load_from_remote
test function.The introduction of
CompilerTestSetup
improves code clarity and maintainability. Ensure that the changes do not introduce any issues in the test setup or execution.
Line range hint
184-266
:
Refactor: UseCompilerTestSetup
intest_load_from_remote_del
test function.The introduction of
CompilerTestSetup
improves code clarity and maintainability. Ensure that the changes do not introduce any issues in the test setup or execution.examples/game-lib/armory/manifests/dev/base/abis/models/armory-ModelA-19290fb7.json (1)
1-407
: New models and interfaces added.The changes include various model interfaces, structures, and implementations. Ensure that these new models are properly tested and integrated.
examples/game-lib/manifests/dev/base/abis/models/armory-Flatbow-f269a4c3.json (21)
1-6
: Correct structure and type definitions forDojoModelImpl
.The JSON structure and type definitions for
DojoModelImpl
are correct.
7-24
: Correct structure and type definitions forByteArray
.The JSON structure and type definitions for
ByteArray
are correct.
25-38
: Correct structure and type definitions forOption::<core::integer::u32>
.The JSON structure and type definitions for
Option::<core::integer::u32>
are correct.
39-48
: Correct structure and type definitions forSpan::<core::integer::u8>
.The JSON structure and type definitions for
Span::<core::integer::u8>
are correct.
49-62
: Correct structure and type definitions forFieldLayout
.The JSON structure and type definitions for
FieldLayout
are correct.
63-72
: Correct structure and type definitions forSpan::<dojo::database::introspect::FieldLayout>
.The JSON structure and type definitions for
Span::<dojo::database::introspect::FieldLayout>
are correct.
73-82
: Correct structure and type definitions forSpan::<dojo::database::introspect::Layout>
.The JSON structure and type definitions for
Span::<dojo::database::introspect::Layout>
are correct.
83-112
: Correct structure and type definitions forLayout
.The JSON structure and type definitions for
Layout
are correct.
113-122
: Correct structure and type definitions forSpan::<core::felt252>
.The JSON structure and type definitions for
Span::<core::felt252>
are correct.
123-140
: Correct structure and type definitions forMember
.The JSON structure and type definitions for
Member
are correct.
141-150
: Correct structure and type definitions forSpan::<dojo::database::introspect::Member>
.The JSON structure and type definitions for
Span::<dojo::database::introspect::Member>
are correct.
151-168
: Correct structure and type definitions forStruct
.The JSON structure and type definitions for
Struct
are correct.
169-178
: Correct structure and type definitions forSpan::<(core::felt252, dojo::database::introspect::Ty)>
.The JSON structure and type definitions for
Span::<(core::felt252, dojo::database::introspect::Ty)>
are correct.
179-196
: Correct structure and type definitions forEnum
.The JSON structure and type definitions for
Enum
are correct.
197-206
: Correct structure and type definitions forSpan::<dojo::database::introspect::Ty>
.The JSON structure and type definitions for
Span::<dojo::database::introspect::Ty>
are correct.
207-236
: Correct structure and type definitions forTy
.The JSON structure and type definitions for
Ty
are correct.
237-363
: Correct structure and type definitions forIModel
.The JSON structure and type definitions for
IModel
are correct.
364-368
: Correct structure and type definitions forflatbowImpl
.The JSON structure and type definitions for
flatbowImpl
are correct.
369-386
: Correct structure and type definitions forFlatbow
.The JSON structure and type definitions for
Flatbow
are correct.
387-404
: Correct structure and type definitions forIflatbow
.The JSON structure and type definitions for
Iflatbow
are correct.
405-410
: Correct structure and type definitions forEvent
.The JSON structure and type definitions for
Event
are correct.examples/spawn-and-move/manifests/dev/base/abis/models/dojo_examples-RiverSkale-27fcbc29.json (21)
1-6
: LGTM: DojoModelImpl implementationThe implementation of
DojoModelImpl
with the interfacedojo::model::IModel
is correctly defined.
7-24
: LGTM: ByteArray structThe struct
core::byte_array::ByteArray
with membersdata
,pending_word
, andpending_word_len
is correctly defined.
25-37
: LGTM: Option enumThe enum
core::option::Option::<core::integer::u32>
with variantsSome
andNone
is correctly defined.
38-48
: LGTM: Span structThe struct
core::array::Span::<core::integer::u8>
with the membersnapshot
is correctly defined.
49-62
: LGTM: FieldLayout structThe struct
dojo::database::introspect::FieldLayout
with membersselector
andlayout
is correctly defined.
63-72
: LGTM: Span structThe struct
core::array::Span::<dojo::database::introspect::FieldLayout>
with the membersnapshot
is correctly defined.
73-82
: LGTM: Span structThe struct
core::array::Span::<dojo::database::introspect::Layout>
with the membersnapshot
is correctly defined.
83-111
: LGTM: Layout enumThe enum
dojo::database::introspect::Layout
with variantsFixed
,Struct
,Tuple
,Array
,ByteArray
, andEnum
is correctly defined.
112-121
: LGTM: Span structThe struct
core::array::Span::<core::felt252>
with the membersnapshot
is correctly defined.
122-140
: LGTM: Member structThe struct
dojo::database::introspect::Member
with membersname
,attrs
, andty
is correctly defined.
141-149
: LGTM: Span structThe struct
core::array::Span::<dojo::database::introspect::Member>
with the membersnapshot
is correctly defined.
150-167
: LGTM: Struct structThe struct
dojo::database::introspect::Struct
with membersname
,attrs
, andchildren
is correctly defined.
168-177
: LGTM: Span structThe struct
core::array::Span::<(core::felt252, dojo::database::introspect::Ty)>
with the membersnapshot
is correctly defined.
178-196
: LGTM: Enum structThe struct
dojo::database::introspect::Enum
with membersname
,attrs
, andchildren
is correctly defined.
197-205
: LGTM: Span structThe struct
core::array::Span::<dojo::database::introspect::Ty>
with the membersnapshot
is correctly defined.
206-235
: LGTM: Ty enumThe enum
dojo::database::introspect::Ty
with variantsPrimitive
,Struct
,Enum
,Tuple
,Array
, andByteArray
is correctly defined.
236-362
: LGTM: IModel interfaceThe interface
dojo::model::IModel
with functionsname
,namespace
,tag
,version
,selector
,name_hash
,namespace_hash
,unpacked_size
,packed_size
,layout
, andschema
is correctly defined.
363-368
: LGTM: river_skaleImpl implementationThe implementation of
river_skaleImpl
with the interfacebestiary::Iriver_skale
is correctly defined.
369-390
: LGTM: RiverSkale structThe struct
bestiary::RiverSkale
with membersid
,health
,armor
, andattack
is correctly defined.
391-408
: LGTM: Iriver_skale interfaceThe interface
bestiary::Iriver_skale
with the functionensure_abi
is correctly defined.
409-414
: Verify the event definitionThe event
bestiary::river_skale::Event
has an empty variants array. Ensure this is intentional and correct.crates/dojo-lang/src/semantics/test_data/set (3)
21-25
: LGTM: No params test caseThe test case for
no params
with the expressionset!()
and the expected result indicating a missing expression with appropriate diagnostics is correctly defined.
53-57
: LGTM: Incorrect args test caseThe test case for
incorrect args
with the expressionset!(world)
and the expected result indicating a missing expression with appropriate diagnostics is correctly defined.
237-266
: LGTM: Set successful expansion test caseThe test case for
set successful expansion
with the expressionset!(world, (Health{id: 0xb0b, health: 79}))
and the expected result indicating a block with several statements and the final type beingHealth
is correctly defined.crates/dojo-test-utils/src/compiler.rs (5)
19-24
: Struct Definition ApprovedThe struct
CompilerTestSetup
is well-defined with appropriate fields.
27-36
: Function Logic ApprovedThe function
from_examples
correctly processes the example paths to create aCompilerTestSetup
instance.
38-61
: Function Logic ApprovedThe function
from_paths
correctly processes the given paths to create aCompilerTestSetup
instance and handles temporary directories appropriately.
63-69
: Function Logic ApprovedThe function
build_test_config
correctly builds a test configuration from the manifest path and profile.
Line range hint
174-209
: Function Logic ApprovedThe function
copy_project_temp
correctly copies a project to a new location, excluding certain directories, and handles paths appropriately.crates/dojo-lang/src/model.rs (2)
Line range hint
102-161
: Function Logic ApprovedThe function
get_model_parameters
correctly extracts model parameters from the struct's AST and handles errors appropriately.
Line range hint
195-509
: Function Logic ApprovedThe function
handle_model_struct
correctly processes a model struct and generates aRewriteNode
with appropriate diagnostics.crates/dojo-lang/src/plugin.rs (3)
114-118
: Function Logic ApprovedThe function
handle_mod
correctly processes a module and returns aPluginResult
with appropriate handling ofdojo::contract
attributes.
Line range hint
153-179
: Function Logic ApprovedThe function
handle_fn
correctly processes a function and returns aPluginResult
with appropriate handling ofcomputed
attributes.
Line range hint
345-547
: Function Logic ApprovedThe function
generate_code
correctly generates code based on the given AST item and metadata, handling different module items appropriately.crates/dojo-lang/src/compiler.rs (3)
172-183
: Function Logic ApprovedThe function
find_project_contracts
correctly finds internal and external contracts in the project, ensuring proper handling of paths and contract selectors.
Line range hint
236-236
: Function Logic ApprovedThe function
update_files
correctly updates files with compiled artifacts and metadata, ensuring proper handling of paths and directories.
Line range hint
729-729
: Function Logic ApprovedThe function
get_dojo_model_artifacts
correctly retrieves model artifacts from the database, ensuring proper handling of paths and namespaces.crates/dojo-bindgen/src/plugins/typescript_v2/mod.rs (3)
630-630
: AddCompilerTestSetup
import.The
CompilerTestSetup
import is correctly added to facilitate the new test configuration setup.
649-650
: Replace manual path setup withCompilerTestSetup
.The new
CompilerTestSetup
correctly replaces the manual path setup, making the test configuration more concise and maintainable.
657-662
: UseCompilerTestSetup
for test configuration.The test configuration is correctly set up using
CompilerTestSetup
, ensuring consistency and reducing boilerplate code.crates/dojo-world/src/manifest/manifest_test.rs (7)
5-5
: AddCompilerTestSetup
import.The
CompilerTestSetup
import is correctly added to facilitate the new test configuration setup.
307-308
: Replace manual path setup withCompilerTestSetup
.The new
CompilerTestSetup
correctly replaces the manual path setup, making the test configuration more concise and maintainable.
315-315
: UseCompilerTestSetup
for test configuration.The test configuration is correctly set up using
CompilerTestSetup
, ensuring consistency and reducing boilerplate code.
323-324
: Pass configuration paths todeploy_world
.The updated paths are correctly passed to the
deploy_world
function, ensuring the correct deployment of the world for testing.
332-332
: Load the local manifest from the correct path.The local manifest is correctly loaded from the path set up by
CompilerTestSetup
, ensuring the correct manifest is used for testing.
340-340
: Load the overlay manifest if it exists.The overlay manifest is correctly loaded if it exists, ensuring the test handles overlays properly.
352-355
: Assert the correct number of models and contracts.The assertions for the number of models and contracts in the local and remote manifests are correctly set up, ensuring the manifests are correctly compared.
crates/dojo-lang/src/contract.rs (2)
43-44
: UpdateDojoContract
to usedefault_namespace
.The
from_module
method is updated to usedefault_namespace
, which is correctly passed as a parameter.
57-57
: Usedefault_namespace
ifnamespace
is not provided.The
default_namespace
is correctly used if thenamespace
parameter is not provided, ensuring that a namespace is always available.crates/dojo-lang/src/plugin_test_data/system (32)
358-358
: Clear error message for missing default namespaceThe error message clearly indicates that the default namespace is missing and provides guidance on the required configuration in the Scarb.toml file.
363-363
: Consistent error message for missing default namespaceThe error message is consistent with the previous one and provides clear guidance on the required configuration in the Scarb.toml file.
368-368
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
373-373
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
378-378
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
383-383
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
388-388
: Clear error message for unsupported attributeThe error message clearly indicates an unsupported attribute.
393-393
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
398-398
: Clear error message for unsupported attributeThe error message clearly indicates an unsupported attribute.
403-403
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
408-408
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
413-413
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
419-419
: Clear error message for unsupported attributeThe error message clearly indicates an unsupported attribute.
423-423
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
428-428
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
433-433
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
438-438
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
443-443
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
448-448
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
453-453
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
458-458
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
463-463
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
468-468
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
473-473
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
478-478
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
483-483
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
488-488
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
493-493
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
498-498
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
504-504
: Clear error message for unknown derive attributeThe error message clearly indicates an unknown derive attribute and suggests a missing plugin.
508-508
: Consistent error message for missing default namespaceThe error message is consistent with the previous ones and provides clear guidance on the required configuration in the Scarb.toml file.
514-514
: Clear error message for unsupported attributeThe error message clearly indicates an unsupported attribute.
examples/game-lib/armory/manifests/dev/base/abis/dojo-world.json (5)
1-6
: LGTM!The type
World
implements the interfacedojo::world::IWorld
correctly.
7-24
: LGTM!The struct
core::byte_array::ByteArray
is defined correctly with the appropriate members.
25-38
: LGTM!The struct
dojo::resource_metadata::ResourceMetadata
is defined correctly with the appropriate members.
39-48
: LGTM!The struct
core::array::Span::<core::felt252>
is defined correctly with the appropriate member.
137-524
: LGTM!The interface
dojo::world::IWorld
and its functions are defined correctly.examples/game-lib/manifests/dev/base/abis/dojo-world.json (5)
1-6
: LGTM!The type
World
implements the interfacedojo::world::IWorld
correctly.
7-24
: LGTM!The struct
core::byte_array::ByteArray
is defined correctly with the appropriate members.
25-38
: LGTM!The struct
dojo::resource_metadata::ResourceMetadata
is defined correctly with the appropriate members.
39-48
: LGTM!The struct
core::array::Span::<core::felt252>
is defined correctly with the appropriate member.
137-524
: LGTM!The interface
dojo::world::IWorld
and its functions are defined correctly.examples/spawn-and-move/manifests/dev/base/abis/models/dojo_examples-Flatbow-3632af69.json (1)
1-411
: Correctness of JSON structure.The JSON structure appears to be well-formed and follows the expected schema for defining models, enums, interfaces, and structs. Ensure that all fields and types are correctly defined and used in the project.
crates/torii/graphql/src/tests/mod.rs (3)
5-19
: Review new imports.The new imports appear to be necessary for the added functionality. Ensure that all imported modules and items are used correctly in the code.
276-294
: Use ofCompilerTestSetup
inspinup_types_test
.The setup and configuration for the test have been refactored to use
CompilerTestSetup
. This improves code clarity and maintainability. Ensure that the paths and configurations are correct.
Line range hint
317-340
:
Transaction handling and engine synchronization.The added code handles transactions and synchronizes the engine to the head. Ensure that the transaction handling and synchronization logic is correct.
examples/game-lib/manifests/dev/base/abis/models/bestiary-RiverSkale-1bce2040.json (1)
1-415
: Correctness of JSON structure.The JSON structure appears to be well-formed and follows the expected schema for defining models, enums, interfaces, and structs. Ensure that all fields and types are correctly defined and used in the project.
bin/sozo/src/commands/build.rs (1)
Line range hint
217-231
:
Use ofCompilerTestSetup
in tests.The test setup has been refactored to use
CompilerTestSetup
. This improves code clarity and maintainability. Ensure that the paths and configurations are correct.crates/dojo-lang/src/semantics/test_data/get (3)
32-66
: Useful error messages for missing namespaces.The added error messages provide clear guidance on ensuring the default namespace is specified in the
Scarb.toml
file. This will help users quickly identify and fix missing namespace issues.
115-149
: Consistent and useful error messages for missing namespaces.These error messages continue to provide clear and specific guidance on ensuring the default namespace is specified in the
Scarb.toml
file, maintaining consistency with the previous segment.
324-358
: Specific error message for missing trait implementation.The error message clearly indicates that the
dojo::model::Model
trait has no implementation in the context. This will help users identify and fix issues with missing trait implementations when using theget!
macro.
) | ||
.await | ||
}) | ||
.map(|_| ()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didnt understand why this was added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The outer function is expecting a result with ()
unit type, but in our case, we now return MigrationOutput
, which in other places can be very useful to access.
Using .map(|_| ())
ensures that whatever is returned with Ok
, we return the unit type discarding the returned value.
crates/dojo-lang/src/model.rs
Outdated
@@ -192,17 +192,14 @@ pub fn handle_model_struct( | |||
db: &dyn SyntaxGroup, | |||
aux_data: &mut DojoAuxData, | |||
struct_ast: ItemStruct, | |||
package_id: String, | |||
default_namespace: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc comment above this got outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 10
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
Files selected for processing (37)
- crates/dojo-core/Scarb.toml (1 hunks)
- crates/dojo-lang/src/compiler.rs (7 hunks)
- crates/dojo-lang/src/contract.rs (4 hunks)
- crates/dojo-lang/src/manifest_test_data/compiler_cairo/Scarb.toml (1 hunks)
- crates/dojo-lang/src/model.rs (5 hunks)
- crates/dojo-lang/src/plugin.rs (9 hunks)
- crates/dojo-lang/src/plugin_test_data/introspect (12 hunks)
- crates/dojo-lang/src/plugin_test_data/print (1 hunks)
- crates/dojo-lang/src/plugin_test_data/system (2 hunks)
- crates/dojo-lang/src/semantics/test_data/get (3 hunks)
- crates/dojo-lang/src/semantics/test_data/set (3 hunks)
- crates/dojo-lang/src/utils.rs (2 hunks)
- crates/dojo-world/Cargo.toml (1 hunks)
- crates/dojo-world/src/contracts/world_test.rs (3 hunks)
- crates/dojo-world/src/metadata.rs (5 hunks)
- crates/dojo-world/src/metadata_test.rs (4 hunks)
- crates/torii/graphql/src/tests/metadata_test.rs (1 hunks)
- crates/torii/types-test/Scarb.toml (1 hunks)
- examples/game-lib/armory/Scarb.toml (1 hunks)
- examples/game-lib/armory/src/lib.cairo (1 hunks)
- examples/game-lib/bestiary/Scarb.toml (1 hunks)
- examples/game-lib/bestiary/src/lib.cairo (1 hunks)
- examples/spawn-and-move/Scarb.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/base/abis/models/dojo_examples_foes-RiverSkale-39535c12.json (1 hunks)
- examples/spawn-and-move/manifests/dev/base/abis/models/dojo_examples_weapons-Flatbow-22f5bd16.json (1 hunks)
- examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-actions-40b6994c.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/base/models/dojo_examples_foes-RiverSkale-39535c12.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/base/models/dojo_examples_weapons-Flatbow-22f5bd16.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/deployment/abis/models/dojo_examples_foes-RiverSkale-39535c12.json (1 hunks)
- examples/spawn-and-move/manifests/dev/deployment/abis/models/dojo_examples_weapons-Flatbow-22f5bd16.json (1 hunks)
- examples/spawn-and-move/manifests/dev/deployment/manifest.json (4 hunks)
- examples/spawn-and-move/manifests/dev/deployment/manifest.toml (3 hunks)
- examples/spawn-and-move/manifests/release/base/abis/models/dojo_examples_foes-RiverSkale-39535c12.json (1 hunks)
- examples/spawn-and-move/manifests/release/base/abis/models/dojo_examples_weapons-Flatbow-22f5bd16.json (1 hunks)
- examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-actions-40b6994c.toml (1 hunks)
- examples/spawn-and-move/manifests/release/base/models/dojo_examples_foes-RiverSkale-39535c12.toml (1 hunks)
- examples/spawn-and-move/manifests/release/base/models/dojo_examples_weapons-Flatbow-22f5bd16.toml (1 hunks)
Files not summarized due to errors (2)
- crates/dojo-lang/src/plugin_test_data/introspect: Error: Message exceeds token limit
- crates/dojo-lang/src/plugin_test_data/system: Error: Message exceeds token limit
Files skipped from review due to trivial changes (3)
- crates/dojo-lang/src/manifest_test_data/compiler_cairo/Scarb.toml
- crates/torii/types-test/Scarb.toml
- examples/spawn-and-move/manifests/dev/base/models/dojo_examples_weapons-Flatbow-22f5bd16.toml
Files skipped from review as they are similar to previous changes (15)
- crates/dojo-core/Scarb.toml
- crates/dojo-lang/src/compiler.rs
- crates/dojo-lang/src/contract.rs
- crates/dojo-lang/src/model.rs
- crates/dojo-lang/src/plugin.rs
- crates/dojo-lang/src/plugin_test_data/print
- crates/dojo-lang/src/semantics/test_data/get
- crates/dojo-lang/src/semantics/test_data/set
- crates/dojo-lang/src/utils.rs
- crates/dojo-world/src/contracts/world_test.rs
- examples/game-lib/armory/Scarb.toml
- examples/game-lib/armory/src/lib.cairo
- examples/game-lib/bestiary/src/lib.cairo
- examples/spawn-and-move/Scarb.toml
- examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-actions-40b6994c.toml
Additional comments not posted (105)
examples/game-lib/bestiary/Scarb.toml (1)
16-16
: Namespace ConfigurationThe namespace configuration has been updated to include a default namespace. This change is consistent with the objective of enhancing namespace handling. Ensure that this namespace is correctly used in the rest of the codebase.
examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-actions-40b6994c.toml (1)
2-3
: Update Class Hashes and MetadataThe class hashes and metadata have been updated. Ensure these values are correct and match the actual class definitions.
Verify that these class hashes are correctly referenced in the rest of the codebase.
examples/spawn-and-move/manifests/release/base/models/dojo_examples_weapons-Flatbow-22f5bd16.toml (2)
8-21
: Verify Member DefinitionsThe member definitions have been updated. Ensure these values are correct and match the actual class definitions.
Verify that these member definitions are correctly referenced in the rest of the codebase.
2-3
: Update Class Hashes and MetadataThe class hashes and metadata have been updated. Ensure these values are correct and match the actual class definitions.
Verify that these class hashes are correctly referenced in the rest of the codebase.
examples/spawn-and-move/manifests/dev/base/models/dojo_examples_foes-RiverSkale-39535c12.toml (2)
2-3
: Update Class Hashes and MetadataThe class hashes and metadata have been updated. Ensure these values are correct and match the actual class definitions.
Verify that these class hashes are correctly referenced in the rest of the codebase.
Verification successful
Verified Class Hash References
The updated class hash
0x34e17c9bad7ccfa7286e07ed3a9af0b2922c7ee77a4889a1c59d0a6dd7aeacc
is correctly referenced in the following files:
examples/spawn-and-move/manifests/dev/deployment/manifest.toml
examples/spawn-and-move/manifests/release/base/models/dojo_examples_foes-RiverSkale-39535c12.toml
examples/spawn-and-move/manifests/dev/base/models/dojo_examples_foes-RiverSkale-39535c12.toml
examples/spawn-and-move/manifests/dev/deployment/manifest.json
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the updated class hashes are correctly referenced in the codebase. # Test: Search for the class hash usage. Expect: Only occurances of the new class hashes. rg --type toml --type yaml --type json '0x34e17c9bad7ccfa7286e07ed3a9af0b2922c7ee77a4889a1c59d0a6dd7aeacc'Length of output: 1442
8-26
: Verify Member DefinitionsThe member definitions have been updated. Ensure these values are correct and match the actual class definitions.
Verify that these member definitions are correctly referenced in the rest of the codebase.
Verification successful
Member Definitions Verified
The member definitions 'health', 'armor', and 'attack' are correctly referenced across various configuration and manifest files in the codebase.
examples/spawn-and-move/manifests/dev/base/models/dojo_examples_foes-RiverSkale-39535c12.toml
examples/spawn-and-move/manifests/release/base/models/dojo_examples_foes-RiverSkale-39535c12.toml
examples/spawn-and-move/manifests/dev/deployment/manifest.toml
examples/spawn-and-move/manifests/dev/deployment/manifest.json
examples/spawn-and-move/manifests/release/base/abis/models/dojo_examples_foes-RiverSkale-39535c12.json
examples/spawn-and-move/manifests/dev/deployment/abis/models/dojo_examples_foes-RiverSkale-39535c12.json
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the updated member definitions are correctly referenced in the codebase. # Test: Search for the member definitions usage. Expect: Only occurances of the new member definitions. rg --type toml --type yaml --type json 'health' 'armor' 'attack'Length of output: 153
Script:
#!/bin/bash # Description: Verify that the updated member definitions are correctly referenced in the codebase. # Test: Search for the member definitions usage across all file types. rg 'health' -t toml -t yaml -t json rg 'armor' -t toml -t yaml -t json rg 'attack' -t toml -t yaml -t jsonLength of output: 9103
Script:
#!/bin/bash # Description: Verify that the updated member definitions are correctly referenced in the codebase. # Test: Search for the member definitions usage across all relevant file types. rg 'health' -t toml -t yaml -t json -t js -t ts -t py rg 'armor' -t toml -t yaml -t json -t js -t ts -t py rg 'attack' -t toml -t yaml -t json -t js -t ts -t pyLength of output: 9157
examples/spawn-and-move/manifests/release/base/models/dojo_examples_foes-RiverSkale-39535c12.toml (2)
1-6
: Ensure Consistency of Metadata PropertiesThe metadata properties
kind
,class_hash
,original_class_hash
,abi
,tag
, andmanifest_name
appear consistent and correctly formatted. Ensure these values are consistent with the rest of the project.
8-26
: Verify Member DefinitionsThe member definitions
id
,health
,armor
, andattack
are correctly defined with appropriate data types and key designations. Ensure these definitions align with the project's requirements and data model.crates/dojo-world/Cargo.toml (1)
20-20
: Dependency Addition:regex
The addition of the
regex
dependency is correctly formatted and consistent with the existing workspace dependencies. Ensure that this dependency is necessary and used appropriately in the project.crates/torii/graphql/src/tests/metadata_test.rs (2)
60-60
: Verify Namespace Configuration in TestThe
namespace
configuration in thetest_metadata
function is correctly defined. Ensure that this configuration is consistent with the rest of the project and that the test covers all necessary cases.
60-60
: Ensure Complete Coverage in TestThe
test_empty_content
function correctly tests for empty content in metadata. Ensure that all edge cases are covered in this test.crates/dojo-world/src/metadata_test.rs (4)
13-13
: Verify Namespace Configuration in TestThe
namespace
configuration in thecheck_metadata_deserialization
function is correctly defined. Ensure that this configuration is consistent with the rest of the project and that the test covers all necessary cases.
76-76
: Verify Namespace Configuration in TestThe
namespace
configuration in theworld_metadata_hash_and_upload
function is correctly defined. Ensure that this configuration is consistent with the rest of the project and that the test covers all necessary cases.
109-109
: Verify Namespace Configuration in TestThe
namespace
configuration in theparse_world_metadata_without_socials
function is correctly defined. Ensure that this configuration is consistent with the rest of the project and that the test covers all necessary cases.
109-109
: Ensure Complete Coverage in TestThe
get_full_dojo_metadata_from_workspace
function correctly tests the retrieval of full metadata from the workspace. Ensure that all edge cases are covered in this test.examples/spawn-and-move/manifests/dev/deployment/manifest.toml (6)
27-28
: Verify the class hash.Ensure that the class hash value is correct and consistent with the contract's actual deployment.
41-45
: Verify the class hash.Ensure that the class hash value is correct and consistent with the contract's actual deployment.
Verification successful
Class hash verification successful
The class hash value "0x14b3096b82a761f63dd47277c2b5ac18925dea43586418483939a2f1f57f674" is consistently used across multiple manifest files within the repository, indicating it is correct.
- examples/spawn-and-move/manifests/dev/deployment/manifest.toml
- examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-dungeon-6620e0e6.toml
- examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-dungeon-6620e0e6.toml
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the class hash value for the contract. # Test: Search for the class hash value in the repository. Expect: Only occurances of the correct value. rg --type toml -A 5 $'class_hash = "0x14b3096b82a761f63dd47277c2b5ac18925dea43586418483939a2f1f57f674"'Length of output: 2825
Line range hint
65-66
:
Verify the class hash.Ensure that the class hash value is correct and consistent with the contract's actual deployment.
Verification successful
The class hash value is consistent across the relevant files.
examples/spawn-and-move/manifests/dev/deployment/manifest.toml
examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-others-61de2c18.toml
examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-others-61de2c18.toml
Please ensure that this class hash corresponds to the actual deployment details of the contract.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the class hash value for the contract. # Test: Search for the class hash value in the repository. Expect: Only occurances of the correct value. rg --type toml -A 5 $'class_hash = "0x479bfb12dcba5398d77303e7a665fc3fedb16f2d7f9cb1f5d7e2beb3b7e2ba7"'Length of output: 2808
266-272
: Verify the class hash.Ensure that the class hash value is correct and consistent with the model's actual deployment.
Verification successful
The class hash value is correct and consistent across the repository.
The class hash "0x34e17c9bad7ccfa7286e07ed3a9af0b2922c7ee77a4889a1c59d0a6dd7aeacc" appears consistently in the relevant files, confirming its accuracy.
examples/spawn-and-move/manifests/dev/deployment/manifest.toml
examples/spawn-and-move/manifests/release/base/models/dojo_examples_foes-RiverSkale-39535c12.toml
examples/spawn-and-move/manifests/dev/base/models/dojo_examples_foes-RiverSkale-39535c12.toml
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the class hash value for the model. # Test: Search for the class hash value in the repository. Expect: Only occurances of the correct value. rg --type toml -A 5 $'class_hash = "0x34e17c9bad7ccfa7286e07ed3a9af0b2922c7ee77a4889a1c59d0a6dd7aeacc"'Length of output: 2998
54-55
: Verify the class hash.Ensure that the class hash value is correct and consistent with the contract's actual deployment.
Verification successful
Class hash verification successful.
The class hash "0x97cd4fb3acfe9e6a024589ea34db2fc587586d699ef3732ce627e1771158ef" is consistent across multiple configuration files within the repository.
examples/spawn-and-move/manifests/dev/deployment/manifest.toml
examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-mock_token-31599eb2.toml
examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-mock_token-31599eb2.toml
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the class hash value for the contract. # Test: Search for the class hash value in the repository. Expect: Only occurances of the correct value. rg --type toml -A 5 $'class_hash = "0x97cd4fb3acfe9e6a024589ea34db2fc587586d699ef3732ce627e1771158ef"'Length of output: 2869
295-300
: Verify the class hash.Ensure that the class hash value is correct and consistent with the model's actual deployment.
Verification successful
Class hash value is correct and consistent.
The class hash "0x672ce1913b025af73d80030f0e7e8d5fa4debe9b011cf0a39a27514cac4a3b5" has been verified to be consistent across multiple files and environments in the repository.
examples/spawn-and-move/manifests/dev/deployment/manifest.toml
examples/spawn-and-move/manifests/release/base/models/dojo_examples_weapons-Flatbow-22f5bd16.toml
examples/spawn-and-move/manifests/dev/base/models/dojo_examples_weapons-Flatbow-22f5bd16.toml
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the class hash value for the model. # Test: Search for the class hash value in the repository. Expect: Only occurances of the correct value. rg --type toml -A 5 $'class_hash = "0x672ce1913b025af73d80030f0e7e8d5fa4debe9b011cf0a39a27514cac4a3b5"'Length of output: 2998
examples/spawn-and-move/manifests/dev/base/abis/models/dojo_examples_foes-RiverSkale-39535c12.json (1)
1-415
: Ensure ABI Consistency and CompletenessThe ABI file for
RiverSkale
looks comprehensive and well-structured. Verify that all necessary functions and members are included and correctly defined. Ensure that the types and state mutability are appropriately specified.examples/spawn-and-move/manifests/dev/deployment/abis/models/dojo_examples_foes-RiverSkale-39535c12.json (1)
1-415
: Ensure ABI Consistency and CompletenessThe ABI file for
RiverSkale
looks comprehensive and well-structured. Verify that all necessary functions and members are included and correctly defined. Ensure that the types and state mutability are appropriately specified.examples/spawn-and-move/manifests/release/base/abis/models/dojo_examples_foes-RiverSkale-39535c12.json (1)
1-415
: Ensure ABI Consistency and CompletenessThe ABI file for
RiverSkale
looks comprehensive and well-structured. Verify that all necessary functions and members are included and correctly defined. Ensure that the types and state mutability are appropriately specified.crates/dojo-world/src/metadata.rs (8)
58-60
: Ensure Correct Namespace ExtractionThe function
get_default_namespace_from_ws
extracts the default namespace from the workspace metadata. Ensure that this function is correctly extracting and returning the default namespace.
62-71
: Ensure Correct Namespace Configuration ExtractionThe function
get_namespace_config_from_ws
extracts the namespace configuration from the workspace metadata. Ensure that this function is correctly extracting and returning the namespace configuration.
266-269
: Validate Namespace FormatThe function
is_name_valid
uses a regex to validate the namespace format. Ensure that the regex correctly matches valid namespace formats and rejects invalid ones.
271-275
: Ensure Proper NamespaceConfig Struct DefinitionThe
NamespaceConfig
struct is defined with a default namespace and optional mappings. Ensure that this struct is correctly defined and used in the codebase.
278-355
: Validate NamespaceConfig MethodsThe methods in the
NamespaceConfig
implementation provide functionality for creating, adding mappings, getting mappings, and validating the namespace configuration. Ensure that these methods are correctly implemented and used in the codebase.
Line range hint
362-375
:
Ensure Proper ProjectWorldMetadata Struct DefinitionThe
ProjectWorldMetadata
struct is defined with various fields, including the namespace configuration. Ensure that this struct is correctly defined and used in the codebase.
375-375
: Ensure Proper WorldMetadata Struct DefinitionThe
WorldMetadata
struct is defined with various fields, including the namespace configuration. Ensure that this struct is correctly defined and used in the codebase.
564-650
: Ensure Comprehensive Unit TestsThe unit tests for the
NamespaceConfig
struct and related functions are comprehensive. Ensure that these tests cover all edge cases and provide sufficient test coverage for the namespace configuration functionality.crates/dojo-lang/src/plugin_test_data/introspect (68)
751-752
: Approve theCopy
andDrop
traits implementation forStructWithPrimitives
.The
Copy
andDrop
traits are correctly implemented for theStructWithPrimitives
struct.
753-754
: Approve theCopy
andDrop
traits implementation forStructWithStruct
.The
Copy
andDrop
traits are correctly implemented for theStructWithStruct
struct.
755-756
: Approve theCopy
andDrop
traits implementation forStructWithSimpleArray
.The
Copy
andDrop
traits are correctly implemented for theStructWithSimpleArray
struct.
757-758
: Approve theCopy
andDrop
traits implementation forStructWithByteArray
.The
Copy
andDrop
traits are correctly implemented for theStructWithByteArray
struct.
759-760
: Approve theCopy
andDrop
traits implementation forStructWithComplexArray
.The
Copy
andDrop
traits are correctly implemented for theStructWithComplexArray
struct.
761-762
: Approve theCopy
andDrop
traits implementation forStructWithSimpleTuple
.The
Copy
andDrop
traits are correctly implemented for theStructWithSimpleTuple
struct.
763-764
: Approve theCopy
andDrop
traits implementation forStructWithComplexTuple
.The
Copy
andDrop
traits are correctly implemented for theStructWithComplexTuple
struct.
765-766
: Approve theCopy
andDrop
traits implementation forStructWithNestedArrays
.The
Copy
andDrop
traits are correctly implemented for theStructWithNestedArrays
struct.
767-768
: Approve theCopy
andDrop
traits implementation forStructWithNestedTuples
.The
Copy
andDrop
traits are correctly implemented for theStructWithNestedTuples
struct.
769-770
: Approve theCopy
andDrop
traits implementation forStructWithNestedTuplesAndByteArray
.The
Copy
andDrop
traits are correctly implemented for theStructWithNestedTuplesAndByteArray
struct.
771-772
: Approve theCopy
andDrop
traits implementation forStructWithNestedEverything
.The
Copy
andDrop
traits are correctly implemented for theStructWithNestedEverything
struct.
773-774
: Approve theCopy
andDrop
traits implementation forGenericStruct
.The
Copy
andDrop
traits are correctly implemented for theGenericStruct
struct.
775-782
: Approve theSerde
trait implementation forGenericStruct
.The
Serde
trait is correctly implemented for theGenericStruct
struct.
785-786
: Approve theCopy
andDrop
traits implementation forStructWithBadOption
.The
Copy
andDrop
traits are correctly implemented for theStructWithBadOption
struct.
787-794
: Approve theSerde
trait implementation forStructWithBadOption
.The
Serde
trait is correctly implemented for theStructWithBadOption
struct.
797-810
: Approve theCopy
,Drop
, andSerde
traits implementation forEnumWithBadOption
.The
Copy
,Drop
, andSerde
traits are correctly implemented for theEnumWithBadOption
enum.
817-818
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
822-823
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
827-828
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
832-833
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
837-838
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
842-843
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
847-848
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
852-853
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
857-858
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
862-863
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
867-868
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
872-873
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
877-878
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
882-883
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
887-888
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
892-893
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
897-898
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
902-903
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
907-908
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
912-913
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
917-918
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
922-923
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
927-928
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
932-933
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
937-938
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
942-943
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
947-948
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
952-953
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
957-958
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
962-963
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
967-968
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
972-973
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
977-978
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
982-983
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
987-988
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
992-993
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
997-998
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1002-1003
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1007-1008
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1012-1013
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1017-1018
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1022-1023
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1027-1028
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1032-1033
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1037-1038
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1042-1043
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1047-1048
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1052-1053
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1057-1058
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1062-1063
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1067-1068
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
1072-1073
: Approve the diagnostic error message for missing or invalid namespace configuration.The error message accurately indicates that the namespace configuration is expected but not found or invalid.
examples/spawn-and-move/manifests/dev/deployment/manifest.json (5)
1133-1134
: LGTM!The class hashes and addresses for the
DojoContract
are correctly formatted.
1434-1445
: LGTM!The function
enter_dungeon
is correctly defined with appropriate inputs and state mutability.
1537-1541
: LGTM!The class hashes and addresses for the
DojoContract
are correctly formatted.
5781-5807
: LGTM!The model members and class hashes for the
DojoModel
are correctly defined and formatted.
6226-6246
: LGTM!The model members and class hashes for the
DojoModel
are correctly defined and formatted.
@@ -355,590 +355,330 @@ mod ctxnamed { | |||
} | |||
|
|||
//! > expected_diagnostics | |||
error: The contract namespace 'My@Namespace' can only contain characters (a-z/A-Z), numbers (0-9) and underscore (_) | |||
error: Namespace configuration expected at tool.dojo.world.namespace, but not found or invalid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace configuration expected.
Ensure that the namespace configuration is correctly specified in the Scarb.toml
file.
^***********^ | ||
|
||
error: Unsupported attribute. | ||
error: Namespace configuration expected at tool.dojo.world.namespace, but not found or invalid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace configuration expected.
Ensure that the namespace configuration is correctly specified in the Scarb.toml
file.
--> test_src/lib.cairo:11:1 | ||
#[dojo::contract(namespace: 'my_namespace')] | ||
^******************************************^ | ||
|
||
error: Unsupported attribute. | ||
error: Namespace configuration expected at tool.dojo.world.namespace, but not found or invalid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace configuration expected.
Ensure that the namespace configuration is correctly specified in the Scarb.toml
file.
--> test_src/lib.cairo:21:1 | ||
#[dojo::contract(namespace: "my_namespace")] | ||
^******************************************^ | ||
|
||
error: Unsupported attribute. | ||
error: Namespace configuration expected at tool.dojo.world.namespace, but not found or invalid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace configuration expected.
Ensure that the namespace configuration is correctly specified in the Scarb.toml
file.
--> test_src/lib.cairo:28:1 | ||
#[dojo::contract] | ||
^***************^ | ||
|
||
error: Unsupported attribute. | ||
error: Namespace configuration expected at tool.dojo.world.namespace, but not found or invalid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace configuration expected.
Ensure that the namespace configuration is correctly specified in the Scarb.toml
file.
--> test_src/lib.cairo:38:1 | ||
#[dojo::contract] | ||
^***************^ | ||
|
||
error: Namespace configuration expected at tool.dojo.world.namespace, but not found or invalid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsupported attribute.
Ensure that the attribute used is supported by the compiler.
#[starknet::component] | ||
^********************^ | ||
|
||
error: Unsupported attribute. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsupported attribute.
Ensure that the attribute used is supported by the compiler.
#[starknet::component] | ||
^********************^ | ||
|
||
error: Namespace configuration expected at tool.dojo.world.namespace, but not found or invalid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace configuration expected.
Ensure that the namespace configuration is correctly specified in the Scarb.toml
file.
error: Unsupported attribute. | ||
--> test_src/lib.cairo:58:1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsupported attribute.
Ensure that the attribute used is supported by the compiler.
#[starknet::component] | ||
^********************^ | ||
|
||
error: Namespace configuration expected at tool.dojo.world.namespace, but not found or invalid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Namespace configuration expected.
Ensure that the namespace configuration is correctly specified in the Scarb.toml
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
crates/dojo-lang/src/plugin_test_data/introspect (1)
514-514
: Ensure proper formatting and spacing.The
impl Vec2Copy
line should be properly spaced for readability.-}impl Vec2Copy of core::traits::Copy::<Vec2>; +} + +impl Vec2Copy of core::traits::Copy::<Vec2>;
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
Files selected for processing (8)
- crates/benches/contracts/Scarb.toml (1 hunks)
- crates/dojo-lang/Cargo.toml (1 hunks)
- crates/dojo-lang/src/plugin_test.rs (3 hunks)
- crates/dojo-lang/src/plugin_test_data/introspect (2 hunks)
- crates/dojo-lang/src/plugin_test_data/print (2 hunks)
- crates/dojo-lang/src/semantics/test_data/get (3 hunks)
- crates/dojo-lang/src/semantics/test_data/set (3 hunks)
- crates/dojo-lang/src/utils.rs (2 hunks)
Files skipped from review due to trivial changes (1)
- crates/benches/contracts/Scarb.toml
Files skipped from review as they are similar to previous changes (4)
- crates/dojo-lang/src/plugin_test_data/print
- crates/dojo-lang/src/semantics/test_data/get
- crates/dojo-lang/src/semantics/test_data/set
- crates/dojo-lang/src/utils.rs
Additional comments not posted (7)
crates/dojo-lang/Cargo.toml (1)
58-58
: Add context for the newly added dependency.The
assert_fs
dependency has been added. Ensure that its purpose is clear and justified.What is the specific use case for this dependency? Does it align with the project's goals and requirements?
crates/dojo-lang/src/plugin_test.rs (2)
10-14
: Import changes acknowledged.The import of
assert_fs
aligns with its addition inCargo.toml
. This indicates its use in the test setup.
100-136
: Verify the correctness and purpose of temporary directory setup and file creation.Ensure that the setup aligns with the test objectives and is error-free.
What specific scenarios are these changes testing? Are there any edge cases that need to be considered?
crates/dojo-lang/src/plugin_test_data/introspect (4)
2904-2904
: Ensure error messages provide clear guidance.The error message for
Option<T>
with tuples should suggest using a struct instead.
2914-2914
: Ensure error messages provide clear guidance.The error message for using
Introspect
andIntrospectPacked
attributes together is clear and accurate.
2934-2934
: Ensure error messages provide clear guidance.The error message for packing arrays is clear and accurate.
514-514
: Remove duplicate implementation ofVec2Introspect
.The
Vec2Introspect
implementation appears twice, which may cause issues.-impl Vec2Introspect<> of dojo::database::introspect::Introspect<Vec2<>> { +// Duplicate implementation, remove one of them. -impl Vec2Introspect<> of dojo::database::introspect::Introspect<Vec2<>> {Likely invalid or redundant comment.
The mappings are great, but we're still having an issue. Usually if a namespace is given in the attribute, this is because we want to override the default namespace... So we're still need to find a better solution. We could also add namespace mapping for models inside our crate into the Would be happy to have a discussion on that with you @remybar @lambda-0x or any contributor around. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- crates/dojo-core/src/world_test.cairo (2 hunks)
- crates/dojo-lang/src/contract.rs (5 hunks)
- crates/dojo-lang/src/model.rs (6 hunks)
Files skipped from review as they are similar to previous changes (2)
- crates/dojo-lang/src/contract.rs
- crates/dojo-lang/src/model.rs
Additional comments not posted (2)
crates/dojo-core/src/world_test.cairo (2)
48-50
: LGTM! Namespace and nomapping attributes are correctly applied.The
Buzz
struct has been correctly updated withnamespace: "another_namespace"
andnomapping: true
attributes.
943-945
: LGTM! Namespace and nomapping attributes are correctly applied.The
buzz_contract
module has been correctly updated withnamespace: "buzz_namespace"
andnomapping: true
attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (2)
examples/spawn-and-move/manifests/dev/deployment/manifest.json (2)
259-260
: Updateupgrade_contract
function input.The
upgrade_contract
function still usesoriginal_base_class_hash
instead ofselector
. Ensure that the function definition and all calls to this function are updated accordingly.
crates/sozo/ops/src/migration/migrate.rs
:
- Function definition
- Function call
Analysis chain
Update
upgrade_contract
function input.The
upgrade_contract
function now takes aselector
instead ofbase_address
. Ensure that all calls to this function are updated accordingly.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all calls to `upgrade_contract` are updated. # Test: Search for the function calls to `upgrade_contract`. Expect: Only occurances of the new function signature. rg --type rust 'upgrade_contract'Length of output: 381
Script:
#!/bin/bash # Extract lines around occurrences of `upgrade_contract` to verify the parameters being used. # Extract context around the function definition rg --type rust -A 5 -B 5 'async fn upgrade_contract' crates/sozo/ops/src/migration/migrate.rs # Extract context around the function call rg --type rust -A 5 -B 5 'upgrade_contract(' crates/sozo/ops/src/migration/migrate.rsLength of output: 523
Script:
#!/bin/bash # Extract lines around occurrences of `upgrade_contract` to verify the parameters being used. # Extract context around the function definition rg --type rust -A 5 -B 5 'async fn upgrade_contract' crates/sozo/ops/src/migration/migrate.rs # Extract context around the function call with corrected regex rg --type rust -A 5 -B 5 'upgrade_contract\(' crates/sozo/ops/src/migration/migrate.rsLength of output: 931
Ensure tests for
can_write_contract
andcan_write_namespace
functionsThe
can_write_contract
andcan_write_namespace
functions are implemented incrates/dojo-core/src/world.cairo
. However, no test cases were found for these functions. Please ensure that these functions are correctly tested to verify their functionality.
crates/dojo-core/src/world.cairo
: Implementation ofcan_write_contract
andcan_write_namespace
.Analysis chain
Line range hint
524-549
:
Addition ofcan_write_contract
andcan_write_namespace
functions.The
can_write_contract
andcan_write_namespace
functions have been added to theIWorld
interface. Ensure that these functions are correctly implemented and tested.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify implementation and testing of the `can_write_contract` and `can_write_namespace` functions. # Test: Search for the implementation and tests of the `can_write_contract` and `can_write_namespace` functions. Expect: Implementation and tests present. rg --type rust 'fn can_write_contract' rg --type rust 'fn can_write_namespace'Length of output: 82
Script:
#!/bin/bash # Description: Verify the presence and testing of the `can_write_contract` and `can_write_namespace` functions. # Search for the implementation of the `can_write_contract` function in all file types. rg 'fn can_write_contract' # Search for the implementation of the `can_write_namespace` function in all file types. rg 'fn can_write_namespace' # Search for test cases that might use the `can_write_contract` function. rg 'can_write_contract' --type test # Search for test cases that might use the `can_write_namespace` function. rg 'can_write_namespace' --type testLength of output: 567
Script:
#!/bin/bash # Description: Verify the presence of tests for the `can_write_contract` and `can_write_namespace` functions. # Search for test cases that might use the `can_write_contract` function in common test directories. rg 'can_write_contract' tests/ rg 'can_write_contract' test/ rg 'can_write_contract' spec/ # Search for test cases that might use the `can_write_namespace` function in common test directories. rg 'can_write_namespace' tests/ rg 'can_write_namespace' test/ rg 'can_write_namespace' spec/Length of output: 462
Script:
#!/bin/bash # Description: Verify the presence of tests for the `can_write_contract` and `can_write_namespace` functions. # Search for test cases that might use the `can_write_contract` function in the entire repository. rg 'can_write_contract' # Search for test cases that might use the `can_write_namespace` function in the entire repository. rg 'can_write_namespace'Length of output: 2133
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (26)
- crates/dojo-core/src/base_test.cairo (4 hunks)
- crates/dojo-core/src/world.cairo (12 hunks)
- crates/dojo-core/src/world_test.cairo (3 hunks)
- crates/dojo-lang/src/inline_macros/mod.rs (1 hunks)
- crates/dojo-lang/src/inline_macros/selector_from_tag.rs (1 hunks)
- crates/dojo-lang/src/manifest_test_data/compiler_cairo/manifests/dev/base/abis/dojo-world.json (4 hunks)
- crates/dojo-lang/src/manifest_test_data/compiler_cairo/manifests/dev/base/dojo-world.toml (1 hunks)
- crates/dojo-lang/src/plugin.rs (10 hunks)
- crates/dojo-lang/src/plugin_test_data/introspect (2 hunks)
- crates/dojo-lang/src/plugin_test_data/print (2 hunks)
- crates/dojo-lang/src/semantics/test_data/selector_from_tag (1 hunks)
- crates/dojo-lang/src/semantics/test_utils.rs (1 hunks)
- crates/dojo-lang/src/semantics/tests.rs (1 hunks)
- crates/dojo-lang/src/utils.rs (2 hunks)
- crates/dojo-world/src/contracts/abi/world.rs (4 hunks)
- crates/dojo-world/src/contracts/naming.rs (2 hunks)
- crates/sozo/ops/src/migration/migrate.rs (2 hunks)
- examples/spawn-and-move/Scarb.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/base/abis/dojo-world.json (4 hunks)
- examples/spawn-and-move/manifests/dev/base/dojo-world.toml (1 hunks)
- examples/spawn-and-move/manifests/dev/deployment/abis/dojo-world.json (4 hunks)
- examples/spawn-and-move/manifests/dev/deployment/manifest.json (29 hunks)
- examples/spawn-and-move/manifests/dev/deployment/manifest.toml (5 hunks)
- examples/spawn-and-move/manifests/release/base/abis/dojo-world.json (4 hunks)
- examples/spawn-and-move/manifests/release/base/dojo-world.toml (1 hunks)
- scripts/rebuild_test_artifacts.sh (1 hunks)
Files not summarized due to errors (1)
- examples/spawn-and-move/manifests/dev/deployment/manifest.json: Error: Message exceeds token limit
Files skipped from review due to trivial changes (5)
- crates/dojo-lang/src/inline_macros/mod.rs
- crates/dojo-lang/src/manifest_test_data/compiler_cairo/manifests/dev/base/dojo-world.toml
- examples/spawn-and-move/manifests/dev/base/dojo-world.toml
- examples/spawn-and-move/manifests/release/base/dojo-world.toml
- scripts/rebuild_test_artifacts.sh
Files skipped from review as they are similar to previous changes (6)
- crates/dojo-core/src/world_test.cairo
- crates/dojo-lang/src/plugin_test_data/introspect
- crates/dojo-lang/src/plugin_test_data/print
- crates/dojo-lang/src/utils.rs
- examples/spawn-and-move/Scarb.toml
- examples/spawn-and-move/manifests/dev/deployment/manifest.toml
Additional comments not posted (75)
crates/dojo-lang/src/semantics/tests.rs (1)
19-20
: Test case addition approved.The addition of the
selector_from_tag
test case to thetest_file_test!
macro is correct and follows the existing pattern.crates/dojo-lang/src/semantics/test_data/selector_from_tag (16)
1-2
: Test case approved: Valid tag.The test case for a valid tag correctly verifies the expected output.
6-7
: Test case approved: Valid tag expression.The test case for a valid tag expression correctly verifies the expected output.
9-15
: Test case approved: Expected output for valid tag.The expected output for a valid tag is correctly specified.
17-18
: Test case approved: No diagnostics for valid tag.The absence of diagnostics for a valid tag is correctly specified.
21-22
: Test case approved: No parameters.The test case for missing parameters correctly verifies the expected output and diagnostics.
26-27
: Test case approved: No parameters expression.The test case for missing parameters expression correctly verifies the expected output and diagnostics.
29-34
: Test case approved: Expected output for missing parameters.The expected output for missing parameters is correctly specified.
36-41
: Test case approved: Diagnostics for missing parameters.The diagnostics for missing parameters are correctly specified.
44-45
: Test case approved: Invalid tag.The test case for an invalid tag correctly verifies the expected output and diagnostics.
49-50
: Test case approved: Invalid tag expression.The test case for an invalid tag expression correctly verifies the expected output and diagnostics.
52-57
: Test case approved: Expected output for invalid tag.The expected output for an invalid tag is correctly specified.
59-64
: Test case approved: Diagnostics for invalid tag.The diagnostics for an invalid tag are correctly specified.
67-68
: Test case approved: Wrong parameter.The test case for wrong parameters correctly verifies the expected output and diagnostics.
72-73
: Test case approved: Wrong parameter expression.The test case for wrong parameters expression correctly verifies the expected output and diagnostics.
75-80
: Test case approved: Expected output for wrong parameters.The expected output for wrong parameters is correctly specified.
82-86
: Test case approved: Diagnostics for wrong parameters.The diagnostics for wrong parameters are correctly specified.
crates/dojo-lang/src/inline_macros/selector_from_tag.rs (3)
10-11
: Struct addition approved.The addition of the
SelectorFromTagMacro
struct with a default implementation is correct.
13-15
: NamedPlugin implementation approved.The implementation of the
NamedPlugin
trait forSelectorFromTagMacro
with theNAME
constant is correct.
17-71
: InlineMacroExprPlugin implementation approved.The implementation of the
InlineMacroExprPlugin
trait forSelectorFromTagMacro
with thegenerate_code
method is correct. The method handles various cases for generating selectors from tags.crates/dojo-world/src/contracts/naming.rs (3)
32-41
: Function addition approved.The addition of the
is_valid_tag
function for validating tags based on a regex pattern is correct.
155-160
: Test cases approved: Success scenarios.The test cases for
is_valid_tag
success scenarios are correctly specified.
162-169
: Test cases approved: Failure scenarios.The test cases for
is_valid_tag
failure scenarios are correctly specified.crates/dojo-core/src/base_test.cairo (2)
71-72
: LGTM!The change to use
selector_from_tag!("dojo-test_contract")
instead of a direct address is a good practice. It improves readability and maintainability.
92-93
: LGTM!The change to use
selector_from_tag!("dojo-test_contract")
instead of a direct address is a good practice. It improves readability and maintainability.crates/dojo-lang/src/semantics/test_utils.rs (1)
60-64
: LGTM!The changes to ensure the crate configuration for the core crate and initialize the development core library are good improvements. They enhance the setup process for the semantic database.
crates/dojo-lang/src/plugin.rs (5)
116-120
: LGTM!The change to use
namespace_config
instead ofpackage_id
aligns with the new namespace handling approach. This is a good improvement.
Line range hint
155-182
:
LGTM!The change to use
namespace_config
to get the tag for the model aligns with the new namespace handling approach. This is a good improvement.
Line range hint
348-365
:
LGTM!The change to use
namespace_config
to handle namespaces aligns with the new namespace handling approach. This is a good improvement.
505-510
: LGTM!The change to use
namespace_config
to handle namespaces aligns with the new namespace handling approach. This is a good improvement.
268-269
: LGTM!The addition of the
SelectorFromTagMacro
to the plugin suite enhances its functionality. This is a good improvement.crates/dojo-lang/src/manifest_test_data/compiler_cairo/manifests/dev/base/abis/dojo-world.json (3)
185-200
: LGTM!The addition of the
contract
function to thedojo::world::IWorld
interface aligns with the new namespace handling approach. This is a good improvement.
254-255
: LGTM!The modification to use a
selector
instead of a direct address in theupgrade_contract
function aligns with the new namespace handling approach. This is a good improvement.
504-510
: LGTM!The addition of the
can_write_model
,can_write_contract
, andcan_write_namespace
functions to thedojo::world::IWorld
interface enhances its functionality. This is a good improvement.Also applies to: 519-524, 544-548
examples/spawn-and-move/manifests/dev/base/abis/dojo-world.json (4)
185-200
: Addition ofcontract
function looks good.The
contract
function is correctly defined and consistent with other functions in the ABI.
504-518
: Addition ofcan_write_model
function looks good.The
can_write_model
function is correctly defined and consistent with other functions in the ABI.
Line range hint
519-528
: Addition ofcan_write_contract
function looks good.The
can_write_contract
function is correctly defined and consistent with other functions in the ABI.
Line range hint
544-553
: Addition ofcan_write_namespace
function looks good.The
can_write_namespace
function is correctly defined and consistent with other functions in the ABI.examples/spawn-and-move/manifests/dev/deployment/abis/dojo-world.json (4)
185-200
: Addition ofcontract
function looks good.The
contract
function is correctly defined and consistent with other functions in the ABI.
504-518
: Addition ofcan_write_model
function looks good.The
can_write_model
function is correctly defined and consistent with other functions in the ABI.
Line range hint
519-528
: Addition ofcan_write_contract
function looks good.The
can_write_contract
function is correctly defined and consistent with other functions in the ABI.
Line range hint
544-553
: Addition ofcan_write_namespace
function looks good.The
can_write_namespace
function is correctly defined and consistent with other functions in the ABI.examples/spawn-and-move/manifests/release/base/abis/dojo-world.json (3)
185-200
: Addition ofcontract
function in IWorld interface looks good.The function
contract
takes a selector and returns a tuple of class hash and contract address, which aligns with the existing interface structure.
254-255
: Change inupgrade_contract
function signature looks good.The function now takes a selector as an input, which is consistent with the namespace handling improvements.
504-524
: Addition ofcan_write_model
function looks good.The function checks write permissions for models, which is consistent with the existing permission-checking functions.
crates/dojo-world/src/contracts/abi/world.rs (3)
191-206
: Addition ofcontract
function in IWorld interface looks good.The function
contract
takes a selector and returns a tuple of class hash and contract address, which aligns with the existing interface structure.
260-261
: Change inupgrade_contract
function signature looks good.The function now takes a selector as an input, which is consistent with the namespace handling improvements.
510-524
: Addition ofcan_write_model
function looks good.The function checks write permissions for models, which is consistent with the existing permission-checking functions.
crates/sozo/ops/src/migration/migrate.rs (2)
8-8
: Verify the usage ofget_namespace_from_tag
.Ensure that the new import
get_namespace_from_tag
is correctly used in the file.Verification successful
Verified the usage of
get_namespace_from_tag
.The function
get_namespace_from_tag
is correctly used in the filecrates/sozo/ops/src/migration/migrate.rs
for mapping operations onstrategy.models
andstrategy.contracts
.
crates/sozo/ops/src/migration/migrate.rs
: Correct usage in mapping operations forstrategy.models
andstrategy.contracts
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `get_namespace_from_tag` in the file. # Test: Search for the function usage. Expect: Correct usage of the function. rg --type rust 'get_namespace_from_tag'Length of output: 740
362-362
: Verify the correctness of thenaming::compute_selector_from_tag
usage.Ensure that the
naming
module is correctly imported and the function call is valid.Verification successful
Verify the import statement for
naming::compute_selector_from_tag
incrates/sozo/ops/src/migration/migrate.rs
.Ensure that the
naming
module is correctly imported in the file where the function is used.
Verify the import statement for the
naming
module incrates/sozo/ops/src/migration/migrate.rs
.Ensure that the
naming
module is correctly imported in the file where the function is used.
The
naming::compute_selector_from_tag
function is correctly used and thenaming
module is properly imported.
crates/sozo/ops/src/migration/migrate.rs
: Thenaming
module is imported fromdojo_world::contracts
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the `naming::compute_selector_from_tag` usage. # Test: Search for the `naming` module import and the function usage. Expect: Correct import and usage. rg --type rust 'naming::compute_selector_from_tag'Length of output: 381
Script:
#!/bin/bash # Description: Verify the import statement for `naming::compute_selector_from_tag` in `crates/sozo/ops/src/migration/migrate.rs`. # Test: Search for the import statement in the specified file. Expect: Correct import statement. rg --type rust 'use .*naming::compute_selector_from_tag;' crates/sozo/ops/src/migration/migrate.rsLength of output: 100
Script:
#!/bin/bash # Description: Verify the import statement for the `naming` module in `crates/sozo/ops/src/migration/migrate.rs`. # Test: Search for any import statements related to `naming` in the specified file. Expect: Correct import statement. rg --type rust 'use .*naming' crates/sozo/ops/src/migration/migrate.rsLength of output: 109
crates/dojo-core/src/world.cairo (8)
481-497
: LGTM! Verify_check_model_write_access
function.The implementation of the
can_write_model
function looks good. Ensure that the_check_model_write_access
function is correctly defined and used.Verification successful
Let's perform a more extensive search to locate the
_check_model_write_access
function and verify its implementation.
LGTM! The
_check_model_write_access
function is correctly defined and used.The implementation of the
can_write_model
function and the_check_model_write_access
function looks good. No further issues were found.
_check_model_write_access
is defined and performs necessary permission checks.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `_check_model_write_access` function is correctly defined and used. # Test: Search for the `_check_model_write_access` function definition. Expect: The function is correctly defined and used. rg --type rust '_check_model_write_access' -A 5Length of output: 47
Script:
#!/bin/bash # Search for the `_check_model_write_access` function definition in the entire codebase. rg '_check_model_write_access' -A 10Length of output: 2869
657-663
: LGTM! VerifyResourceData
enum.The implementation of the
contract
function looks good. Ensure that theResourceData
enum is correctly defined and includes theContract
variant.Verification successful
Verified: The
ResourceData
enum includes theContract
variant.The
ResourceData
enum is correctly defined in thecrates/dojo-core/src/world.cairo
file and includes theContract
variant, ensuring thecontract
function implementation is correct.
crates/dojo-core/src/world.cairo
:enum ResourceData { Model: (ClassHash, ContractAddress), Contract: (ClassHash, ContractAddress), Namespace, World, #[default] None, }Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `ResourceData` enum includes the `Contract` variant. # Test: Search for the `ResourceData` enum definition. Expect: The enum includes the `Contract` variant. rg --type rust 'enum ResourceData' -A 10Length of output: 42
Script:
#!/bin/bash # Description: Verify the `ResourceData` enum includes the `Contract` variant in Cairo files. # Test: Search for the `ResourceData` enum definition in Cairo files. Expect: The enum includes the `Contract` variant. rg --type cairo 'enum ResourceData' -A 10Length of output: 73
Script:
#!/bin/bash # Description: Verify the `ResourceData` enum includes the `Contract` variant in all files. # Test: Search for the `ResourceData` enum definition in all files. Expect: The enum includes the `Contract` variant. rg 'enum ResourceData' -A 10Length of output: 667
533-545
: LGTM! Verify_check_basic_write_access
function.The implementation of the
can_write_namespace
function looks good. Ensure that the_check_basic_write_access
function is correctly defined and used.Verification successful
The
_check_basic_write_access
function is correctly defined and used.The function
_check_basic_write_access
is properly implemented and checks if the provided contract can write to the model by verifying if the contract is a writer, the account owner, or an account writer for the given resource ID.
- Location:
crates/dojo-core/src/world.cairo
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `_check_basic_write_access` function is correctly defined and used. # Test: Search for the `_check_basic_write_access` function definition. Expect: The function is correctly defined and used. rg --type rust '_check_basic_write_access' -A 5Length of output: 47
Script:
#!/bin/bash # Description: Verify the `_check_basic_write_access` function is correctly defined and used. # Test: Search for the `_check_basic_write_access` function definition in all file types, with a focus on Cairo files. rg '_check_basic_write_access' -A 5Length of output: 2316
701-713
: LGTM! Verifyinitialized_contract
map.The implementation of the
deploy_contract
function looks good. Ensure that theinitialized_contract
map is correctly defined and used.Verification successful
The
initialized_contract
map is correctly defined and used.The
initialized_contract
map is defined asMap::<felt252, bool>
incrates/dojo-core/src/world.cairo
and is appropriately used in thedeploy_contract
function to manage contract initialization status.
- Definition:
crates/dojo-core/src/world.cairo: initialized_contract: Map::<felt252, bool>
- Usage:
crates/dojo-core/src/world.cairo
in thedeploy_contract
functionScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `initialized_contract` map is correctly defined and used. # Test: Search for the `initialized_contract` map definition. Expect: The map is correctly defined and used. rg --type rust 'initialized_contract' -A 5Length of output: 42
Script:
#!/bin/bash # Description: Verify the `initialized_contract` map is correctly defined and used. # Test: Search for the `initialized_contract` map definition and usage across all file types. rg 'initialized_contract' -A 5Length of output: 1311
499-520
: LGTM! Verify_check_contract_write_access
function.The implementation of the
can_write_contract
function looks good. Ensure that the_check_contract_write_access
function is correctly defined and used.Verification successful
Verification Successful:
_check_contract_write_access
FunctionThe
_check_contract_write_access
function is correctly defined and used withincrates/dojo-core/src/world.cairo
. It performs the necessary checks to determine if a contract has write access.
- Location:
crates/dojo-core/src/world.cairo
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `_check_contract_write_access` function is correctly defined and used. # Test: Search for the `_check_contract_write_access` function definition. Expect: The function is correctly defined and used. rg --type rust '_check_contract_write_access' -A 5Length of output: 50
Script:
#!/bin/bash # Description: Verify the `_check_contract_write_access` function is correctly defined and used. # Test: Search for the `_check_contract_write_access` function definition in the entire repository. rg '_check_contract_write_access' -A 5Length of output: 1513
Script:
#!/bin/bash # Description: Extract the full implementation of the `_check_contract_write_access` function from `crates/dojo-core/src/world.cairo`. # Test: Extract lines around the `_check_contract_write_access` function definition. rg '_check_contract_write_access' -A 20 -B 5 crates/dojo-core/src/world.cairoLength of output: 3619
465-468
: LGTM! Verify_check_*_write_access
functions.The implementation of the
can_write_resource
function looks good. Ensure that the_check_*_write_access
functions are correctly defined and used.Verification successful
Verification Successful:
_check_*_write_access
functions are correctly defined and used.The
_check_model_write_access
,_check_contract_write_access
, and_check_basic_write_access
functions are properly defined and utilized within thecrates/dojo-core/src/world.cairo
file. The implementation of thecan_write_resource
function is validated.
_check_model_write_access
: Defined at line 465_check_contract_write_access
: Defined at line 478_check_basic_write_access
: Defined at line 491Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `_check_*_write_access` functions are correctly defined and used. # Test: Search for the `_check_*_write_access` functions definitions. Expect: The functions are correctly defined and used. rg --type rust '_check_.*_write_access' -A 5Length of output: 46
Script:
#!/bin/bash # Description: Verify the `_check_*_write_access` functions are correctly defined and used. # Test: Search for the `_check_*_write_access` functions definitions across all files. rg '_check_.*_write_access' -A 5Length of output: 4412
Line range hint
992-1007
:
LGTM! Verifyis_writer
,is_account_owner
, andis_account_writer
functions.The implementation of the
_check_model_write_access
function looks good. Ensure that theis_writer
,is_account_owner
, andis_account_writer
functions are correctly defined and used.Verification successful
Functions
is_writer
,is_account_owner
, andis_account_writer
are correctly defined and used.The functions
is_writer
,is_account_owner
, andis_account_writer
are defined in thecrates/dojo-core/src/world.cairo
file and appear to be implemented correctly.
is_writer
:fn is_writer(self: @ContractState, resource: felt252, contract: ContractAddress) -> bool { self.writers.read((resource, contract)) }
is_account_owner
:fn is_account_owner(self: @ContractState, resource: felt252) -> bool { IWorld::is_owner(self, self._get_account_address(), resource) || self.is_account_world_owner() }
is_account_writer
:fn is_account_writer(self: @ContractState, resource: felt252) -> bool { IWorld::is_writer(self, resource, self._get_account_address()) }These functions are correctly defined and used within the codebase.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the `is_writer`, `is_account_owner`, and `is_account_writer` functions are correctly defined and used. # Test: Search for the `is_writer`, `is_account_owner`, and `is_account_writer` functions definitions. Expect: The functions are correctly defined and used. rg --type rust 'fn is_writer' -A 5 rg --type rust 'fn is_account_owner' -A 5 rg --type rust 'fn is_account_writer' -A 5Length of output: 125
Script:
#!/bin/bash # Description: Verify the `is_writer`, `is_account_owner`, and `is_account_writer` functions are correctly defined and used. # Test: Search for the `is_writer`, `is_account_owner`, and `is_account_writer` functions definitions using ast-grep. ast-grep --lang rust --pattern 'fn is_writer($$) { $$$ }' ast-grep --lang rust --pattern 'fn is_account_owner($$) { $$$ }' ast-grep --lang rust --pattern 'fn is_account_writer($$) { $$$ }'Length of output: 194
Script:
#!/bin/bash # Description: Verify the `is_writer`, `is_account_owner`, and `is_account_writer` functions are correctly defined and used in Cairo files. # Test: Search for the `is_writer`, `is_account_owner`, and `is_account_writer` functions definitions in Cairo files using ast-grep. ast-grep --lang cairo --pattern 'fn is_writer($$) { $$$ }' ast-grep --lang cairo --pattern 'fn is_account_owner($$) { $$$ }' ast-grep --lang cairo --pattern 'fn is_account_writer($$) { $$$ }'Length of output: 530
Script:
#!/bin/bash # Description: Verify the `is_writer`, `is_account_owner`, and `is_account_writer` functions are correctly defined and used in Cairo files. # Test: Search for the `is_writer`, `is_account_owner`, and `is_account_writer` functions definitions in Cairo files using rg. rg --type cairo 'fn is_writer' -A 5 rg --type cairo 'fn is_account_owner' -A 5 rg --type cairo 'fn is_account_writer' -A 5Length of output: 218
Script:
#!/bin/bash # Description: Verify the `is_writer`, `is_account_owner`, and `is_account_writer` functions are correctly defined and used. # Test: Search for the `is_writer`, `is_account_owner`, and `is_account_writer` functions definitions using rg without specifying the file type. rg 'fn is_writer' -A 5 rg 'fn is_account_owner' -A 5 rg 'fn is_account_writer' -A 5Length of output: 2157
727-741
: LGTM! Verifycontract
function.The implementation of the
upgrade_contract
function looks good. Ensure that thecontract
function is correctly defined and used.examples/spawn-and-move/manifests/dev/deployment/manifest.json (17)
4-5
: Ensure consistency of class hashes.The
class_hash
andoriginal_class_hash
have been updated. Verify that these values are correct and consistent with the intended contract deployment.
1147-1148
: Ensure correctness of address and transaction hash.The
address
andtransaction_hash
values have been updated. Verify that these values are correct and consistent with the intended contract deployment.
190-205
: Addition ofcontract
function.The
contract
function has been added to theIWorld
interface. Ensure that this function is correctly implemented and tested.
2030-2033
: Ensure correctness of contract address and class hashes.The
address
,class_hash
, andoriginal_class_hash
values have been updated for theDojoContract
. Verify that these values are correct and consistent with the intended contract deployment.
6694-6695
: Ensure correctness of model configuration.A new
DojoModel
has been added. Verify that the model configuration is correct and consistent with the intended deployment.
1812-1814
: Ensure correctness of contract address and class hashes.The
address
,class_hash
, andoriginal_class_hash
values have been updated for theDojoContract
. Verify that these values are correct and consistent with the intended contract deployment.
509-523
: Addition ofcan_write_model
function.The
can_write_model
function has been added to theIWorld
interface. Ensure that this function is correctly implemented and tested.
4510-4511
: Ensure correctness of model configuration.A new
DojoModel
has been added. Verify that the model configuration is correct and consistent with the intended deployment.
4957-4958
: Ensure correctness of model configuration.A new
DojoModel
has been added. Verify that the model configuration is correct and consistent with the intended deployment.Verification successful
Model configuration verified.
The
DojoModel
configuration in themanifest.json
file appears to be correct and consistent with the intended deployment. The structure and content of the model configuration are comprehensive and well-formed.
- The
class_hash
andoriginal_class_hash
are correctly included.- The
members
section defines the model's attributes, including their names, types, and key status.- The
abi
section specifies the implementation details.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of model configuration. # Test: Search for the model configuration in the codebase. Expect: Only occurances of the new model configuration. rg --type json '0x7104c882f56f62ef1f2453319bf6a1f5784b5f33b63b65506c38d62c3e3fd40'Length of output: 395
Script:
#!/bin/bash # Description: Display the context around the identified lines in the manifest.json file to inspect the model configuration. # Show 10 lines before and after the identified lines for better context. rg --type json -A 10 -B 10 '0x7104c882f56f62ef1f2453319bf6a1f5784b5f33b63b65506c38d62c3e3fd40'Length of output: 2125
Script:
#!/bin/bash # Description: Extract and inspect the entire model configuration block from the manifest.json file. # Search for the beginning of the model configuration block and display its context. rg --type json -A 50 -B 50 '"class_hash": "0x7104c882f56f62ef1f2453319bf6a1f5784b5f33b63b65506c38d62c3e3fd40"'Length of output: 9192
2265-2267
: Ensure correctness of model configuration.A new
DojoModel
has been added. Verify that the model configuration is correct and consistent with the intended deployment.Verification successful
Model configuration is correct and consistent.
The
DojoModelImpl
has been correctly integrated into the system, with extensive references across various manifest files and proper implementation in the Rust source files.
examples/spawn-and-move/manifests/dev/deployment/manifest.json
crates/dojo-lang/src/model.rs
- Various other manifest files and Rust source files.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of model configuration. # Test: Search for the model configuration in the codebase. Expect: Only occurances of the new model configuration. rg --type json '0x1da39caefeb15d61baa9d1d71f21ed79cf5650aa215b583e7f453c0d7d4ee65'Length of output: 395
Script:
#!/bin/bash # Extract the context around the class_hash and original_class_hash in the manifest.json file. rg --type json -A 10 -B 10 '0x1da39caefeb15d61baa9d1d71f21ed79cf5650aa215b583e7f453c0d7d4ee65' examples/spawn-and-move/manifests/dev/deployment/manifest.jsonLength of output: 805
Script:
#!/bin/bash # Search for the definition and usage of DojoModelImpl in the codebase. rg 'DojoModelImpl'Length of output: 83032
1575-1577
: Ensure correctness of contract address and class hashes.The
address
,class_hash
, andoriginal_class_hash
values have been updated for theDojoContract
. Verify that these values are correct and consistent with the intended contract deployment.
5842-5843
: Ensure correctness of model configuration.A new
DojoModel
has been added. Verify that the model configuration is correct and consistent with the intended deployment.Verification successful
Model configuration is correct and consistent.
The
DojoModel
configuration withclass_hash
0x34e17c9bad7ccfa7286e07ed3a9af0b2922c7ee77a4889a1c59d0a6dd7aeacc
is correctly referenced and consistent with other model configurations in the deployment manifest.
- The
class_hash
appears only once in the relevant context.- The configuration aligns with other
DojoModel
entries.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of model configuration. # Test: Search for the model configuration in the codebase. Expect: Only occurances of the new model configuration. rg --type json '0x34e17c9bad7ccfa7286e07ed3a9af0b2922c7ee77a4889a1c59d0a6dd7aeacc'Length of output: 395
Script:
#!/bin/bash # Search for the term 'DojoModel' in the codebase to identify all related configurations. rg --type json 'DojoModel'Length of output: 5940
Script:
#!/bin/bash # Extract the relevant sections from the JSON files where 'DojoModel' and 'DojoModelImpl' are mentioned. rg --type json -A 5 -B 5 'DojoModel' examples/spawn-and-move/manifests/dev/deployment/manifest.jsonLength of output: 6967
3586-3587
: Ensure correctness of model configuration.A new
DojoModel
has been added. Verify that the model configuration is correct and consistent with the intended deployment.Verification successful
Ensure correctness of model configuration.
The
DojoModelImpl
configuration appears correct and consistent with the intended deployment. Theclass_hash
andoriginal_class_hash
fields are likely part of deployment metadata and do not conflict with the model definition.
- examples/spawn-and-move/manifests/dev/deployment/manifest.json: Lines 3586-3587
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of model configuration. # Test: Search for the model configuration in the codebase. Expect: Only occurances of the new model configuration. rg --type json '0x36b7886db455f41fac4263da9f0d21190bb575c8555bde1c3357486495c0be1'Length of output: 395
Script:
#!/bin/bash # Search for any references to DojoModel in the codebase to find documentation or schema defining its correct structure. rg --type json --type md --type yaml 'DojoModel'Length of output: 5962
Script:
#!/bin/bash # Extract and review the structure of a DojoModelImpl from one of the JSON files. rg --type json --json 'DojoModelImpl' examples/spawn-and-move/manifests/dev/deployment/abis/models/dojo_examples-Position-1e145e26.jsonLength of output: 1180
Script:
#!/bin/bash # Retrieve the full content of the JSON file to examine the structure of the DojoModel. cat examples/spawn-and-move/manifests/dev/deployment/abis/models/dojo_examples-Position-1e145e26.jsonLength of output: 9153
6281-6282
: Ensure correctness of model configuration.A new
DojoModel
has been added. Verify that the model configuration is correct and consistent with the intended deployment.Verification successful
The
DojoModel
configuration is correct and consistent.The
class_hash
andoriginal_class_hash
values are correctly placed within theDojoModel
entries, and the overall structure appears to be properly configured.
manifest.json
contains consistent and correctDojoModel
configurations.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of model configuration. # Test: Search for the model configuration in the codebase. Expect: Only occurances of the new model configuration. rg --type json '0x672ce1913b025af73d80030f0e7e8d5fa4debe9b011cf0a39a27514cac4a3b5'Length of output: 395
Script:
#!/bin/bash # Description: Verify the correctness of DojoModel configuration. # Test: Search for the DojoModel configuration in the codebase. rg --type json 'DojoModel'Length of output: 5940
Script:
#!/bin/bash # Description: Extract DojoModel configurations from manifest.json for verification. # Extract lines around DojoModel entries in manifest.json rg --type json -A 5 -B 5 '"kind": "DojoModel"' examples/spawn-and-move/manifests/dev/deployment/manifest.jsonLength of output: 2739
Script:
#!/bin/bash # Description: Extract lines containing class_hash and original_class_hash from manifest.json for verification. # Extract lines around class_hash and original_class_hash entries in manifest.json rg --type json -A 5 -B 5 '"class_hash"' examples/spawn-and-move/manifests/dev/deployment/manifest.jsonLength of output: 10118
5402-5403
: Ensure correctness of model configuration.A new
DojoModel
has been added. Verify that the model configuration is correct and consistent with the intended deployment.Verification successful
Model configuration verified.
The
DojoModel
and its implementationDojoModelImpl
are correctly configured and consistent with the intended deployment. Theclass_hash
andoriginal_class_hash
are appropriately associated with the correct model implementation and interface.
manifest.json
correctly associatesclass_hash
andoriginal_class_hash
withDojoModelImpl
anddojo::model::IModel
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of model configuration. # Test: Search for the model configuration in the codebase. Expect: Only occurances of the new model configuration. rg --type json '0x48dfe99daae31ced8d121079c148d084311483f047519d2d3fae363f15c7a1f'Length of output: 395
Script:
#!/bin/bash # Description: Verify the configuration and usage of the DojoModel. # Search for references to DojoModel in the codebase to understand its configuration and usage. rg --type json 'DojoModel'Length of output: 5940
Script:
#!/bin/bash # Extract relevant sections from the manifest.json and related files to inspect the configuration of DojoModel and DojoModelImpl. # Extract sections from manifest.json rg --type json -A 10 '"kind": "DojoModel"' examples/spawn-and-move/manifests/dev/deployment/manifest.json # Extract sections from other related files rg --type json -A 10 '"name": "DojoModelImpl"' examples/spawn-and-move/manifests/dev/base/abis/models/Length of output: 15802
Script:
#!/bin/bash # Extract sections from manifest.json where class_hash and original_class_hash are defined to ensure they are correctly associated with DojoModel configurations. # Extract sections from manifest.json rg --type json -A 10 '"class_hash": "0x48dfe99daae31ced8d121079c148d084311483f047519d2d3fae363f15c7a1f"' examples/spawn-and-move/manifests/dev/deployment/manifest.jsonLength of output: 590
4043-4044
: Ensure correctness of model configuration.A new
DojoModel
has been added. Verify that the model configuration is correct and consistent with the intended deployment.Verification successful
Model configuration is correct and consistent.
The
DojoModel
andDojoModelImpl
are extensively referenced and consistently implemented across the codebase. The methods implemented inDojoModelImpl
align with the expected functionality, indicating that the model configuration is correct and consistent with the intended deployment.
- The
DojoModel
andDojoModelImpl
are referenced in various manifest files and thecrates
directory.- The implementation details of
DojoModelImpl
include methods likename
,namespace
,tag
,version
, andselector
, which are consistent across different models.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify correctness of model configuration. # Test: Search for the model configuration in the codebase. Expect: Only occurances of the new model configuration. rg --type json '0x23ec6500e0f3e8c64c6fb3ee3ed3259d81c0bde627c8c9c1177da098189dd89'Length of output: 395
Script:
#!/bin/bash # Description: Extract context around the model configuration entries in the manifest.json file. # Extract 10 lines before and after the first occurrence of the class hash in the manifest.json file. rg --type json -A 10 -B 10 '0x23ec6500e0f3e8c64c6fb3ee3ed3259d81c0bde627c8c9c1177da098189dd89' examples/spawn-and-move/manifests/dev/deployment/manifest.jsonLength of output: 809
Script:
#!/bin/bash # Description: Search for the DojoModel implementation and references in the codebase. # Search for the DojoModel implementation. rg --type json 'DojoModel' # Search for references to DojoModel in the codebase. rg 'DojoModel'Length of output: 99403
Script:
#!/bin/bash # Description: Extract the implementation details of DojoModelImpl from the crates/dojo-lang/src/plugin_test_data/model file. # Extract the implementation details of DojoModelImpl. rg --type rust 'impl DojoModelImpl' -A 20 crates/dojo-lang/src/plugin_test_data/modelLength of output: 14139
1168-1170
: Ensure correctness of contract address and class hashes.The
address
,class_hash
, andoriginal_class_hash
values have been updated for theDojoContract
. Verify that these values are correct and consistent with the intended contract deployment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- crates/dojo-lang/src/plugin_test.rs (4 hunks)
- crates/torii/core/src/sql_test.rs (5 hunks)
- crates/torii/graphql/src/tests/metadata_test.rs (1 hunks)
- crates/torii/graphql/src/tests/mod.rs (4 hunks)
- crates/torii/grpc/src/server/tests/entities_test.rs (2 hunks)
Files skipped from review as they are similar to previous changes (3)
- crates/dojo-lang/src/plugin_test.rs
- crates/torii/graphql/src/tests/metadata_test.rs
- crates/torii/grpc/src/server/tests/entities_test.rs
Additional comments not posted (26)
crates/torii/core/src/sql_test.rs (16)
3-3
: ImportCompilerTestSetup
The
CompilerTestSetup
import is introduced to set up the compiler for the test environment. This is necessary for building the test configuration.
10-12
: Importmigration
andConnectedAccount
The
migration
module andConnectedAccount
are imported to handle migrations and account connections, respectively. These imports are essential for the test setup and execution.
63-64
: InitializeCompilerTestSetup
The
CompilerTestSetup
is initialized with paths to the core and examples directories. This sets up the environment for the test.
66-66
: Build Test ConfigurationThe test configuration is built using the
build_test_config
method. This configuration is necessary for the subsequent steps in the test.
68-69
: Start Katana Runner and Get AccountThe
KatanaRunner
is started, and an account is retrieved from the runner. This sets up the environment for executing transactions.
71-82
: Run MigrationThe
migration::migrate
function is called to run the migration. This step is crucial for setting up the test environment with the necessary contracts and data.
102-103
: Wait for TransactionThe
TransactionWaiter
is used to wait for the transaction to complete. This ensures that the transaction is fully processed before moving on to the next steps.
104-113
: InitializeWorldContractReader
andSql
The
WorldContractReader
andSql
instances are initialized with the necessary parameters. These instances are used to interact with the world contract and the database.
117-118
: Bootstrap EngineThe
bootstrap_engine
function is called to initialize the engine with the necessary components. This sets up the engine for the test.
122-122
: Assert Models LengthThe length of the models is asserted to ensure that the correct number of models have been loaded. This is a crucial validation step in the test.
195-196
: InitializeCompilerTestSetup
The
CompilerTestSetup
is initialized with paths to the core and examples directories. This sets up the environment for the test.
200-201
: Start Katana Runner and Get AccountThe
KatanaRunner
is started, and an account is retrieved from the runner. This sets up the environment for executing transactions.
203-214
: Run MigrationThe
migration::migrate
function is called to run the migration. This step is crucial for setting up the test environment with the necessary contracts and data.
274-275
: InitializeWorldContractReader
The
WorldContractReader
instance is initialized with the necessary parameters. This instance is used to interact with the world contract.
278-283
: InitializeSql
The
Sql
instance is initialized with the necessary parameters. This instance is used to interact with the database.
288-288
: Bootstrap EngineThe
bootstrap_engine
function is called to initialize the engine with the necessary components. This sets up the engine for the test.crates/torii/graphql/src/tests/mod.rs (10)
5-5
: ImportCompilerTestSetup
The
CompilerTestSetup
import is introduced to set up the compiler for the test environment. This is necessary for building the test configuration.
16-19
: Importmigration
andConnectedAccount
The
migration
module andConnectedAccount
are imported to handle migrations and account connections, respectively. These imports are essential for the test setup and execution.
276-277
: InitializeCompilerTestSetup
The
CompilerTestSetup
is initialized with paths to the core and types-test directories. This sets up the environment for the test.
279-279
: Build Test ConfigurationThe test configuration is built using the
build_test_config
method. This configuration is necessary for the subsequent steps in the test.
284-296
: Run MigrationThe
migration::migrate
function is called to run the migration. This step is crucial for setting up the test environment with the necessary contracts and data.
Line range hint
299-317
: Executecreate
TransactionThe
create
transaction is executed to insert records into the storage. This step is necessary for setting up the test data.
330-331
: Wait for TransactionThe
TransactionWaiter
is used to wait for the transaction to complete. This ensures that the transaction is fully processed before moving on to the next steps.
332-333
: InitializeWorldContractReader
The
WorldContractReader
instance is initialized with the necessary parameters. This instance is used to interact with the world contract.
334-334
: InitializeSql
The
Sql
instance is initialized with the necessary parameters. This instance is used to interact with the database.
340-340
: Bootstrap EngineThe
bootstrap_engine
function is called to initialize the engine with the necessary components. This sets up the engine for the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (2)
crates/dojo-lang/src/plugin_test_data/introspect (1)
Line range hint
297-376
:
Address unknown deriveThe diagnostics indicate that the
crates/dojo-lang/src/plugin_test_data/system (1)
Line range hint
262-263
:
Fix the namespace format inbad_namespace_format
module.The namespace format in the
bad_namespace_format
module is incorrect. Use a valid namespace format.- #[dojo::contract(namespace: "My@Namespace")] + #[dojo::contract(namespace: "my_namespace")]
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- crates/dojo-lang/src/plugin_test_data/introspect (1 hunks)
- crates/dojo-lang/src/plugin_test_data/print (2 hunks)
- crates/dojo-lang/src/plugin_test_data/system (1 hunks)
Files not summarized due to errors (1)
- crates/dojo-lang/src/plugin_test_data/introspect: Error: Message exceeds token limit
Files skipped from review as they are similar to previous changes (1)
- crates/dojo-lang/src/plugin_test_data/print
Additional comments not posted (9)
crates/dojo-lang/src/plugin_test_data/introspect (5)
262-263
: Ensure that theSerde
andPrintTrait
imports are necessary.The imports for
Serde
andPrintTrait
have been added. Verify that these imports are required and used in the code.
265-270
: DefinePosition
struct withThe
Position
struct is defined with the
273-275
: DefineRoles
struct withThe
Roles
struct is defined with the
278-286
: DefinePlayer
struct withThe
Player
struct is defined with the
289-293
: DefineEnemy
enum withThe
Enemy
enum is defined with thecrates/dojo-lang/src/plugin_test_data/system (4)
Line range hint
265-270
:
Definespawn
module withnamespace
attribute.The
spawn
module is defined with thenamespace
attribute. Ensure that the namespace is correctly used and matches the expected format.
Line range hint
273-275
:
Defineproxy
module withnamespace
attribute.The
proxy
module is defined with thenamespace
attribute. Ensure that the namespace is correctly used and matches the expected format.
Line range hint
278-286
:
Definectxnamed
module withoutnamespace
attribute.The
ctxnamed
module is defined without thenamespace
attribute. Ensure that this is intentional and does not cause issues with the namespace configuration.
Line range hint
289-293
:
Definewithevent
module with event definitions.The
withevent
module includes event definitions. Ensure that the events are correctly defined and used.
error: Unknown derive `Print` - a plugin might be missing. | ||
--> /tmp/plugin_test/src/lib.cairo:4:10 | ||
#[derive(Print)] | ||
^***^ | ||
|
||
error: Unknown derive `Print` - a plugin might be missing. | ||
--> /tmp/plugin_test/src/lib.cairo:12:10 | ||
#[derive(Print)] | ||
^***^ | ||
|
||
error: Unknown derive `Print` - a plugin might be missing. | ||
--> /tmp/plugin_test/src/lib.cairo:19:10 | ||
#[derive(Print)] | ||
^***^ | ||
|
||
error: Unknown derive `Print` - a plugin might be missing. | ||
--> /tmp/plugin_test/src/lib.cairo:28:10 | ||
#[derive(Print)] | ||
^***^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address unknown derive Print
errors.
The diagnostics indicate that the Print
derive is unknown and a plugin might be missing. Ensure that the required plugin is included and correctly configured.
Description
This PR enables Dojo models/contracts from an other projects to be imported with current project namespace. This opens door to more reusability of models, like Origami.
The current limitation is that, when writing a library of Dojo models/contracts, the
namespace
argument of thedojo::model
ordojo::contract
must be specified. This is because insidedojo-lang
, when the model/contract is processed by the Dojo plugin, we don't have any relationship between the code and the crates from which it comes from.Doing so, anytime a model/contract is processed by the Dojo plugin, we can know the origin of the model/contract, and apply some mappings.
To use a model from a library, the steps are:
build-external-contracts
must be used, with the exact same casing that was defined, and the fully qualified path of the model/contract. We force the snake case under the hood to follow the compiler nomenclature, but the user can use the exact same casing.NamespaceConfig
, where one must define the default namespace and some mappings can be added. If no mapping is used, the default namespace of the crate root is used. For the namespace mapping, we use the model/contract tag.Example
If the whole models of a library may go in the same namespace, then only the namespace
can be specified in the mapping:
Finally, anything that is not found into the mappings, will use the default namespace.
This means, any library model without a specified namespace in the attribute will use the default namespace of the crate root.
Related issue
Closes #1786.
Closes #2151.
Closes #2111.
Tests
Compiler utility function has been reworked to support multi package copying to the tmp folder. This also support namespace to enable compilation of workspaces in tests.
Summary by CodeRabbit
New Features
Refactor
package_id
withnamespace_config
across various modules to streamline namespace handling.Bug Fixes
Chores
dojo-world.json
anddojo-world.toml
files to improve function clarity and update class hashes.Tests