-
Notifications
You must be signed in to change notification settings - Fork 182
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
fix cairo file metadata for contracts and models #2175
Conversation
WalkthroughThe recent update to Changes
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 (
|
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 (1)
- crates/dojo-lang/src/compiler.rs (2 hunks)
Additional comments not posted (2)
crates/dojo-lang/src/compiler.rs (2)
23-23
: Import statement modification.The import statement for the
naming
module has been modified to useself
. This is a minor change and does not affect functionality.
556-573
: Improve error handling and file retrieval logic.The changes in the
save_expanded_source_file
function improve error handling and file retrieval logic. Ensure that the function correctly retrieves and writes the file content based on the contract name.
a7c5e00
to
6e26334
Compare
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 (1)
- crates/dojo-lang/src/compiler.rs (2 hunks)
Additional comments not posted (3)
crates/dojo-lang/src/compiler.rs (3)
23-23
: LGTM! Import statement modification is correct.The change to
use dojo_world::contracts::naming::{self};
is syntactically correct and does not impact functionality.
556-573
: LGTM! File retrieval logic is sound.The logic for retrieving the correct file content based on contract names is well-implemented. Error handling is appropriate.
574-574
: LGTM! File writing logic is correct.The logic for writing the file content to the specified directory is well-implemented. The use of
format_string
ensures proper formatting.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2175 +/- ##
=======================================
Coverage 67.21% 67.22%
=======================================
Files 334 334
Lines 43022 43033 +11
=======================================
+ Hits 28917 28928 +11
Misses 14105 14105 ☔ View full report in Codecov by Sentry. |
6e26334
to
fe145a2
Compare
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 (1)
- crates/dojo-lang/src/compiler.rs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- crates/dojo-lang/src/compiler.rs
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.
Good catch, and nice improvement. This will be perfect for automated contract verification. :)
Description
Cairo files of every models/contracts are stored in the
ResourceMetadata
model of the world.Unfortunately, for models, only the original file containing the model Cairo structure was stored instead of the file generated from Dojo plugins (with the model smart-contract).
Related issue
#2137
Tests
Added to documentation?
Checklist
scripts/prettier.sh
,scripts/rust_fmt.sh
,scripts/cairo_fmt.sh
)scripts/clippy.sh
,scripts/docs.sh
)Summary by CodeRabbit
Bug Fixes
Refactor