You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a Dojo project is compiled, some artifact files are produced in target/<profile_name>/models. Some of these artifacts are the Cairo source code used to build the corresponding model contract. These artifacts are then uploaded as model metadata during the project migration.
For example, in the spawn-and-move example, target/dev/models/dojo_examples-Position-1e145e26.cairo should contain the Cairo code of the Position model Starknet contract.
Unfortunately, at the moment, this source file only contains the original Cairo file. That means, the model contract is not visible at all, only the struct of the model is visible, which is useless.
To Reproduce
Just build the spawn-and-move project.
Expected behavior
Ideally, this source file should only contain the full model contract Cairo code, after code expansion done through Dojo plugins. But, as it might be complicated to isolate this part of code from a Cairo file containing several models, this source file should at least contain the corresponding full Cairo source file after code expansion.
Additional context
This part is done in the save_expanded_source_file function of crates/dojo-lang/src/compiler.rs. A lot of db/module_id methods are available to access to real/virtual files so it might be quite tricky to find the right way to handle this point.
Note that everything works fine for Dojo contract.
The text was updated successfully, but these errors were encountered:
glihm
changed the title
[BUG] Bad Cairo source file content stored in model metadata
Bad Cairo source file content stored in model metadata
Jul 4, 2024
@Ppixelbro thanks for the interest in contributing here! We've some check on the compiler side that needs to be realized first. This may delay this issue and @remybar will probably tackle it as it's bounded to something he is working on currently.
We should have some new good first issue coming soon.
Describe the bug
When a Dojo project is compiled, some artifact files are produced in
target/<profile_name>/models
. Some of these artifacts are the Cairo source code used to build the corresponding model contract. These artifacts are then uploaded as model metadata during the project migration.For example, in the
spawn-and-move
example,target/dev/models/dojo_examples-Position-1e145e26.cairo
should contain the Cairo code of thePosition
model Starknet contract.Unfortunately, at the moment, this source file only contains the original Cairo file. That means, the model contract is not visible at all, only the
struct
of the model is visible, which is useless.To Reproduce
Just build the
spawn-and-move
project.Expected behavior
Ideally, this source file should only contain the full model contract Cairo code, after code expansion done through Dojo plugins. But, as it might be complicated to isolate this part of code from a Cairo file containing several models, this source file should at least contain the corresponding full Cairo source file after code expansion.
Additional context
This part is done in the
save_expanded_source_file
function ofcrates/dojo-lang/src/compiler.rs
. A lot ofdb
/module_id
methods are available to access to real/virtual files so it might be quite tricky to find the right way to handle this point.Note that everything works fine for Dojo contract.
The text was updated successfully, but these errors were encountered: