Skip to content
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

Sozo model layout and commands #2002

Merged
merged 17 commits into from
May 29, 2024
Merged

Conversation

remybar
Copy link
Contributor

@remybar remybar commented May 26, 2024

Dojo layout improvements:

  • automatically add Introspect attribute to dojo::model if not yet present
  • update sozo model commands with:
    • sozo model schema <MODEL_NAME> to get the full model schema,
    • sozo model layout <MODEL_NAME to get the full model layout used to store,
      model records in the Dojo world storage,
    • sozo model get <MODEL_NAME> <KEYS> to get the full values of a model record.
  • improvement of the Enum layout.

remybar added 3 commits May 26, 2024 14:30
- update sozo model commands with:
    - `sozo model schema <MODEL_NAME>` to get the full model schema,
    - `sozo model layout <MODEL_NAME` to get the full model layout used to store,
      model records in the Dojo world storage,
    - `sozo model get <MODEL_NAME> <KEYS>` to get the full values of a model record.
- improvement of the Enum layout.
@remybar remybar force-pushed the sozo-commands-update branch from a9658fc to 296a204 Compare May 27, 2024 06:27
Copy link
Collaborator

@glihm glihm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, it will be great to have such details from the CLI to debug / introspect models.

Some feedback:

  1. world address must be updated to 0x7a2b168dbd3ebada04c0ea21b787f5ef00ff234af9705afe4e147638cb671b7.
  2. Would you mind adding a model to showcase IntrospectPacked into the spawn-and-move example to also have some quick examples to show different layouts?

crates/sozo/ops/src/model.rs Outdated Show resolved Hide resolved
crates/sozo/ops/src/model.rs Outdated Show resolved Hide resolved
bin/sozo/src/commands/model.rs Outdated Show resolved Hide resolved
@remybar remybar force-pushed the sozo-commands-update branch from 46e121a to 4f4f11e Compare May 28, 2024 09:35
@remybar
Copy link
Contributor Author

remybar commented May 28, 2024

2. Would you mind adding a model to showcase `IntrospectPacked` into the `spawn-and-move` example to also have some quick examples to show different layouts?

I've added IntrospectPacked on Vec2 but I can think about several models to add to show the main possibilities with the new layout system like inner struct/array/enum ...
But the update of this example could be in a dedicated PR, what do you think ?

@glihm
Copy link
Collaborator

glihm commented May 28, 2024

2. Would you mind adding a model to showcase `IntrospectPacked` into the `spawn-and-move` example to also have some quick examples to show different layouts?

I've added IntrospectPacked on Vec2 but I can think about several models to add to show the main possibilities with the new layout system like inner struct/array/enum ... But the update of this example could be in a dedicated PR, what do you think ?

Sounds great, let's do that in a subsequent PR. Also, the documentation will showcase some edge cases.

Copy link

codecov bot commented May 29, 2024

Codecov Report

Attention: Patch coverage is 25.75039% with 470 lines in your changes are missing coverage. Please review.

Project coverage is 67.50%. Comparing base (3aae095) to head (a49cdaf).

Files Patch % Lines
crates/sozo/ops/src/model.rs 0.00% 463 Missing ⚠️
bin/sozo/src/commands/model.rs 0.00% 5 Missing ⚠️
crates/dojo-lang/src/introspect/layout.rs 98.82% 1 Missing ⚠️
crates/dojo-types/src/schema.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2002      +/-   ##
==========================================
- Coverage   68.27%   67.50%   -0.77%     
==========================================
  Files         318      318              
  Lines       37352    37880     +528     
==========================================
+ Hits        25502    25572      +70     
- Misses      11850    12308     +458     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@glihm
Copy link
Collaborator

glihm commented May 29, 2024

Added a fix on the go for #2007.

Copy link
Collaborator

@glihm glihm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work @remybar!

@glihm glihm merged commit 6153192 into dojoengine:main May 29, 2024
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants