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

fix: use name for contract interface to be consistent #2482

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

glihm
Copy link
Collaborator

@glihm glihm commented Sep 27, 2024

Required to sozo to build the new core.

Summary by CodeRabbit

  • New Features

    • Updated method naming for improved clarity: contract_name is now name in the IContract trait and DojoContract.
    • Updated various configuration files to reflect new class_hash and original_class_hash values.
  • Bug Fixes

    • No specific bug fixes were noted in this release.
  • Documentation

    • Enhanced clarity in method naming conventions to improve consistency across the codebase.

Copy link

coderabbitai bot commented Sep 27, 2024

Walkthrough

Ohayo, sensei! The changes in this pull request primarily involve renaming the contract_name method to name across various implementations and interfaces in the codebase. This modification preserves the original functionality of the methods, which continue to return a ByteArray. The updates enhance clarity and consistency in the naming conventions used throughout the code.

Changes

File Path Change Summary
crates/dojo-core/src/contract/contract.cairo, crates/dojo-lang/src/contract.rs, crates/dojo-core/src/tests/world/resources.cairo, crates/dojo-core/src/world/world_contract.cairo, crates/dojo-lang/src/plugin_test_data/system Renamed method contract_name to name; functionality remains unchanged across all instances.
crates/dojo-lang/src/manifest_test_data/compiler_cairo/manifests/dev/base/dojo-world.toml, examples/spawn-and-move/dojo_dev.toml, examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-actions-40b6994c.json, examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-dungeon-6620e0e6.json, examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-mock_token-31599eb2.json, examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-others-61de2c18.json, 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/contracts/dojo_examples-mock_token-31599eb2.json, examples/spawn-and-move/manifests/release/base/abis/contracts/dojo_examples-others-61de2c18.json Updated function name from contract_name to name in various ABI JSON files; functionality remains unchanged.
examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-actions-40b6994c.toml, examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-dungeon-6620e0e6.toml, examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-mock_token-31599eb2.toml, examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-others-61de2c18.toml, 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-mock_token-31599eb2.toml, examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-others-61de2c18.toml Updated class_hash and original_class_hash values across multiple TOML files; no other changes made.

Possibly related PRs

  • fix: avoid model classhash conflicts when some models have a same name #2457: The changes in this PR involve renaming the contract_name method to name in the DojoModelImpl, which is directly related to the renaming of the contract_name method to name in the IContract trait within the main PR. Both PRs modify the same method name in their respective implementations, indicating a strong connection at the code level.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 881e1aa and 175dc4a.

📒 Files selected for processing (2)
  • crates/dojo-core/src/contract/contract.cairo (1 hunks)
  • crates/dojo-lang/src/contract.rs (1 hunks)
🔇 Additional comments (1)
crates/dojo-lang/src/contract.rs (1)

188-190: Ohayo, sensei! The name change looks good.

The renaming of contract_name to name improves consistency and aligns with the PR objective. Nice work!

To ensure this change doesn't break anything, let's check for any remaining usages of contract_name:

@@ -1,9 +1,8 @@
#[starknet::interface]
pub trait IContract<T> {
fn contract_name(self: @T) -> ByteArray;
fn name(self: @T) -> ByteArray;
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Ohayo, sensei!
It looks like there are still a couple of places where contract_name is being used. You'll need to update these to ensure consistency across the codebase:

  • crates/dojo-core/src/world/world_contract.cairo
  • crates/dojo-core/src/tests/world/resources.cairo
🔗 Analysis chain

Ohayo, sensei! The name change looks good!

The renaming of contract_name to name aligns well with our consistency goals. It's a cleaner and more idiomatic approach. Nice work!

Let's make sure this change doesn't cause any unexpected issues elsewhere in the dojo, sensei. Here's a quick check we can run:


Ohayo, sensei!
The initial scripts faced some hiccups, but don't worry—we've got this! Let's run the updated checks to ensure contract_name has been fully replaced and name is being used correctly throughout the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining uses of 'contract_name' and verify 'name' usage

echo "Checking for any remaining 'contract_name' occurrences:"
rg --type cairo 'contract_name'

echo "\nVerifying 'name' method usage in IContract implementations:"
ast-grep --lang cairo --pattern 'impl $_ of IContract<$_> {
  $$$
  fn name($$$) -> ByteArray {
    $$$
  }
  $$$
}'

Length of output: 557


Script:

#!/bin/bash
# Description: Check for any remaining uses of 'contract_name' in .cairo files

echo "Searching for 'contract_name' in .cairo files:"
fd --extension cairo --type f | xargs rg 'contract_name'

echo "\nVerifying 'name' method usage in IContract implementations:"
fd --extension cairo --type f | xargs rg 'fn name\(.*\) -> ByteArray'

Length of output: 1601

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 175dc4a and d174af1.

⛔ Files ignored due to path filters (2)
  • spawn-and-move-db.tar.gz is excluded by !**/*.gz
  • types-test-db.tar.gz is excluded by !**/*.gz
📒 Files selected for processing (30)
  • crates/dojo-core/src/tests/world/resources.cairo (1 hunks)
  • crates/dojo-core/src/world/world_contract.cairo (1 hunks)
  • crates/dojo-lang/src/manifest_test_data/compiler_cairo/manifests/dev/base/dojo-world.toml (1 hunks)
  • crates/dojo-lang/src/plugin_test_data/system (40 hunks)
  • crates/sozo/ops/src/tests/model.rs (1 hunks)
  • examples/spawn-and-move/dojo_dev.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 (1 hunks)
  • examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-mock_token-31599eb2.json (1 hunks)
  • examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-others-61de2c18.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/contracts/dojo_examples-mock_token-31599eb2.toml (1 hunks)
  • examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-others-61de2c18.toml (1 hunks)
  • examples/spawn-and-move/manifests/dev/base/dojo-world.toml (1 hunks)
  • examples/spawn-and-move/manifests/dev/deployment/abis/contracts/dojo_examples-actions-40b6994c.json (1 hunks)
  • examples/spawn-and-move/manifests/dev/deployment/abis/contracts/dojo_examples-dungeon-6620e0e6.json (1 hunks)
  • examples/spawn-and-move/manifests/dev/deployment/abis/contracts/dojo_examples-mock_token-31599eb2.json (1 hunks)
  • examples/spawn-and-move/manifests/dev/deployment/abis/contracts/dojo_examples-others-61de2c18.json (1 hunks)
  • examples/spawn-and-move/manifests/dev/deployment/manifest.json (10 hunks)
  • examples/spawn-and-move/manifests/dev/deployment/manifest.toml (5 hunks)
  • examples/spawn-and-move/manifests/release/base/abis/contracts/dojo_examples-actions-40b6994c.json (1 hunks)
  • examples/spawn-and-move/manifests/release/base/abis/contracts/dojo_examples-dungeon-6620e0e6.json (1 hunks)
  • examples/spawn-and-move/manifests/release/base/abis/contracts/dojo_examples-mock_token-31599eb2.json (1 hunks)
  • examples/spawn-and-move/manifests/release/base/abis/contracts/dojo_examples-others-61de2c18.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/contracts/dojo_examples-dungeon-6620e0e6.toml (1 hunks)
  • examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-mock_token-31599eb2.toml (1 hunks)
  • examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-others-61de2c18.toml (1 hunks)
  • examples/spawn-and-move/manifests/release/base/dojo-world.toml (1 hunks)
✅ Files skipped from review due to trivial changes (8)
  • crates/dojo-core/src/world/world_contract.cairo
  • examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-actions-40b6994c.json
  • examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-others-61de2c18.json
  • examples/spawn-and-move/manifests/dev/deployment/abis/contracts/dojo_examples-actions-40b6994c.json
  • examples/spawn-and-move/manifests/dev/deployment/abis/contracts/dojo_examples-mock_token-31599eb2.json
  • examples/spawn-and-move/manifests/dev/deployment/abis/contracts/dojo_examples-others-61de2c18.json
  • 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-others-61de2c18.json
🔇 Additional comments (31)
crates/dojo-lang/src/manifest_test_data/compiler_cairo/manifests/dev/base/dojo-world.toml (1)

2-3: Ohayo, sensei! Verify the new hash values and their implications.

The class_hash and original_class_hash have been updated to a new value:

0x6f38d5d9507c5d9546290e1a27e309efe5a9af3770b6cc1627db4a1b90a7dce

This change appears to align with the PR objective of ensuring consistency for the new core. However, please consider the following:

  1. Confirm that this new hash value is correct and corresponds to the updated contract interface.
  2. Ensure that all dependent systems and components are aware of this change, as it may affect how they interact with the Dojo World class.
  3. Verify that the class_hash and original_class_hash should indeed be identical. If they represent different concepts, consider if they should have distinct values.

To ensure the correctness of this change, you might want to run the following verification:

This will help ensure that the old hash value has been completely replaced and the new one is used consistently across the project.

examples/spawn-and-move/manifests/dev/base/dojo-world.toml (1)

2-3: Ohayo, sensei! Please verify the updated hash values.

The class_hash and original_class_hash have been updated to a new value. This change appears to be in line with the PR objectives for consistency. However, it's crucial to ensure that this modification is intentional and doesn't have any unexpected implications on the system.

Could you please confirm that this update is expected and explain its significance? Also, run the following script to check if these hash values are used consistently across the project:

✅ Verification successful

Hash values updated consistently across the project.

Ohayo, sensei! I have verified that the class_hash and original_class_hash have been updated consistently across all relevant configuration files. No occurrences of the old hash value were found, ensuring the update's integrity.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistency of the new hash value across the project

# Test: Search for the old and new hash values
echo "Occurrences of the old hash value:"
rg "0x5c4271c8cd454ceb8049d2b0724c99d12c2ef8077fc6ad325b18978f614aab0"

echo "Occurrences of the new hash value:"
rg "0x6f38d5d9507c5d9546290e1a27e309efe5a9af3770b6cc1627db4a1b90a7dce"

Length of output: 1842

examples/spawn-and-move/manifests/release/base/dojo-world.toml (1)

2-3: Ohayo, sensei! The class hash update looks good!

The changes to both class_hash and original_class_hash seem to be in line with the PR objectives. This update likely reflects changes in the underlying implementation of the Dojo World class.

To ensure consistency across the system, please run the following verification:

This will help ensure that the new hash is used consistently and that there are no lingering references to the old hash.

✅ Verification successful

Ohayo, sensei! The class hash updates have been successfully verified.

All instances of the new class_hash and original_class_hash are correctly updated across the project, and there are no references to the old class hash.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new class hash is used consistently across the project

# Test: Search for occurrences of the new class hash
echo "Occurrences of the new class hash:"
rg "0x6f38d5d9507c5d9546290e1a27e309efe5a9af3770b6cc1627db4a1b90a7dce"

# Test: Search for any remaining occurrences of the old class hash
echo "Occurrences of the old class hash (should be none):"
rg "0x5c4271c8cd454ceb8049d2b0724c99d12c2ef8077fc6ad325b18978f614aab0"

Length of output: 1876

examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-others-61de2c18.toml (1)

2-3: Ohayo, sensei! Verify the updated contract hashes.

The class_hash and original_class_hash have been updated to a new value. This change likely reflects an update in the contract's implementation.

To ensure consistency, let's check if this new hash is used elsewhere in the codebase:

Also, please confirm that this update is intentional and aligns with any recent changes to the contract implementation.

✅ Verification successful

Ohayo, sensei! The updated contract hashes are consistent across the codebase.

Both class_hash and original_class_hash have been successfully updated in all relevant manifest files, ensuring consistency across dev and release environments.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for the new hash value in other files

# Test: Look for the new hash value in other files
rg --type toml "0x2331b72955719869459bdacf66061a55975d6c2bc379349b082ee9d9a350a18"

Length of output: 1081

examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-others-61de2c18.toml (2)

1-1: Ohayo again, sensei! The rest of the configuration looks good.

The remaining parts of the configuration file are unchanged and appear to be consistent with the contract's structure. This includes the kind, base_class_hash, abi, reads, writes, and other fields.

Also applies to: 4-13


2-3: Ohayo, sensei! Verify the updated class hash.

The class_hash and original_class_hash have been updated to a new value. This change could have significant implications for contract deployments and interactions.

Please confirm that this update is intentional and aligns with the PR objectives. Also, consider running the following script to ensure the new hash is consistently used across the codebase:

This will help ensure that all references to the class hash have been updated consistently.

✅ Verification successful

Ohayo, sensei! Class hash update verified.

All instances of the old class hash are no longer present, and the new class hash is consistently used across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for occurrences of both the old and new class hash values

echo "Searching for old hash..."
rg "0x40e824b8814bafef18cce2cf68f5765e9c9a1c86f55a8491b0c2a4faebdcc87"

echo "Searching for new hash..."
rg "0x2331b72955719869459bdacf66061a55975d6c2bc379349b082ee9d9a350a18"

Length of output: 1575

examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-dungeon-6620e0e6.toml (1)

2-3: Ohayo, sensei! The hash values have been updated.

The class_hash and original_class_hash have been changed to a new value. This update appears to be consistent and targeted.

Let's make sure this change is consistent across the codebase:

✅ Verification successful

Ohayo, sensei! The updated contract hashes have been successfully verified and are consistent across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new hash is consistent across the codebase

# Test: Search for occurrences of the old and new hash values
echo "Occurrences of the old hash:"
rg "0x67edb33671cd2f5b766d073e3dec53b03400761a20f349ea9628cf4c883b393"

echo "Occurrences of the new hash:"
rg "0x3ad65950996d7b0bc6c04a94d401cdb19bda3ab2cffc2098d90e25077dfa11a"

# Test: Check if the new hash is used consistently in other relevant files
echo "Files containing the new hash:"
rg -l "0x3ad65950996d7b0bc6c04a94d401cdb19bda3ab2cffc2098d90e25077dfa11a"

Length of output: 2062

examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-dungeon-6620e0e6.toml (2)

Line range hint 1-13: Ohayo again, sensei! The changes look good overall.

The update to the hash values appears to be the only modification in this file. The rest of the configuration remains unchanged, which is good for maintaining consistency. Just ensure that this hash update aligns with any related changes in the contract implementation.


2-3: Ohayo, sensei! Please verify the updated hash values.

The class_hash and original_class_hash have been updated to a new value. This change appears to be consistent with the PR objectives of ensuring naming consistency for contract interfaces.

Could you please confirm that this new hash value is correct and intentional? It would be beneficial to document the reason for this change in the commit message or PR description.

examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-mock_token-31599eb2.toml (1)

2-3: Ohayo, sensei! The class hash update looks good!

The changes to class_hash and original_class_hash seem to be in line with the PR objectives. This update likely reflects a new implementation of the contract interface, which is consistent with the goal of building the new core.

To ensure the correctness of this change, please run the following verification script:

This will help ensure that the new class hash is used consistently across the project, sensei!

✅ Verification successful

Ohayo, sensei! The class hash update has been successfully verified and everything looks good!

The new class_hash is consistently used across the project, and there are no remaining instances of the old class hash.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new class hash is used consistently across the project

# Test: Search for any remaining occurrences of the old class hash
rg --type toml "0x67edb33671cd2f5b766d073e3dec53b03400761a20f349ea9628cf4c883b393"

# Test: Confirm that the new class hash is used in other relevant files
rg --type toml "0x3ad65950996d7b0bc6c04a94d401cdb19bda3ab2cffc2098d90e25077dfa11a"

Length of output: 1180

examples/spawn-and-move/manifests/dev/base/contracts/dojo_examples-actions-40b6994c.toml (1)

2-3: Ohayo, sensei! Verify the updated contract hashes.

The class_hash and original_class_hash have been updated to a new value. This change likely reflects an update in the contract's implementation.

Please confirm that this update is intentional and consistent with other parts of the system. Also, note that both hashes are now identical, which might be worth double-checking.

✅ Verification successful

Hash Update Successfully Verified, Sensei!
Both class_hash and original_class_hash have been consistently updated across the codebase, and no instances of the old hash remain.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the new hash across the codebase

# Test: Search for occurrences of the new hash
echo "Occurrences of the new hash:"
rg --type toml "0x2aaecb3ded9ebb721f13780007e9704cba0d96b48195f357a35f4969d1b1941"

# Test: Search for any remaining occurrences of the old hash
echo "Occurrences of the old hash (should be none):"
rg --type toml "0x67a20ea91a4b9bb9cdb46cefc41dd6ca4c07c22d4d413205720963944fd817d"

Length of output: 1336

examples/spawn-and-move/manifests/release/base/contracts/dojo_examples-actions-40b6994c.toml (1)

2-3: Ohayo, sensei! The hash update looks good, but let's double-check.

The changes to class_hash and original_class_hash seem straightforward. However, it's crucial to ensure this new hash value is correct and consistent with the updated contract implementation.

Could you please run the following script to verify the new hash value across the codebase?

✅ Verification successful

Ohayo, sensei! Everything looks great with the hash updates.
All instances of the old hash have been successfully replaced with the new one across the codebase. No issues detected.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new hash value usage and consistency

# Test: Search for the new hash value across the codebase
rg --type toml "0x2aaecb3ded9ebb721f13780007e9704cba0d96b48195f357a35f4969d1b1941"

# Test: Check if the old hash value is still present anywhere (which might indicate missed updates)
rg --type toml "0x67a20ea91a4b9bb9cdb46cefc41dd6ca4c07c22d4d413205720963944fd817d"

Length of output: 1168

examples/spawn-and-move/dojo_dev.toml (1)

17-17: Ohayo, sensei! Verify the new world address.

The world_address has been updated to a new value. This change looks straightforward, but it's crucial to ensure it's intentional and properly propagated.

Could you confirm if this new address needs to be updated in other parts of the project? Let's run a quick check:

This will help us ensure consistency across the project, sensei.

✅ Verification successful

Ohayo, sensei!

The world_address has been successfully updated across the necessary configuration files without any residual references to the old address. Everything looks good!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for occurrences of the old and new world addresses in the project.

echo "Searching for the old world address:"
rg "0x15b584f1132fe386a0aa7a447e7073233a545ac4b84b361ed797edaa8f0f14" --type toml --type rust

echo "Searching for the new world address:"
rg "0x46c1fd10836a8426197bf412fc5f26ea10f11a8d5c61474407f03f82c096593" --type toml --type rust

Length of output: 617

examples/spawn-and-move/manifests/dev/base/abis/contracts/dojo_examples-mock_token-31599eb2.json (1)

31-31: Ohayo, sensei! The name change looks good!

The renaming of "contract_name" to "name" in the IContract interface is consistent with the PR objective. This change improves the naming consistency across the codebase while maintaining the function's functionality. Great job on enhancing the clarity of the contract interface!

examples/spawn-and-move/manifests/release/base/abis/contracts/dojo_examples-dungeon-6620e0e6.json (1)

31-31: Ohayo, sensei! The name change looks good!

The update from "contract_name" to "name" in the IContract interface aligns well with our goal of maintaining consistent naming conventions. This change preserves the original functionality while improving clarity.

To ensure consistency across the codebase, please run the following script:

This will help us catch any inconsistencies that might have been missed.

crates/sozo/ops/src/tests/model.rs (1)

57-57: Ohayo, sensei! Please verify the updated contract address.

The expected contract address for the "dojo_examples-Moves" model has been updated. This change aligns with our goal of ensuring consistency in naming conventions for contract interfaces.

To ensure this change is correct and consistent, please run the following verification:

Consider adding a comment explaining the reason for this address change to improve maintainability and clarity for future developers, sensei.

✅ Verification successful

Ohayo, sensei!

Verification Successful!

The updated contract address for the "dojo_examples-Moves" model is consistently used across the codebase, and the old address is no longer present.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new contract address is consistent across the codebase

# Test 1: Check if the new address is used consistently
rg --type rust "0x60d4450c23606e0e9bdd4f1b146ef50e5bc4dde5034946b54c3012bae1add02"

# Test 2: Ensure the old address is not used anywhere else
rg --type rust "0x237386e1b35190b45c7d0aa29b3957d84ba2d4d22c2c10f7511b3abf0d7bd73"

Length of output: 292

examples/spawn-and-move/manifests/dev/deployment/manifest.toml (3)

3-4: Ohayo, sensei! WorldContract deployment info updated.

The class hashes, address, and transaction hash for the WorldContract have been updated. These changes appear to be consistent with a new deployment of the contract.

Also applies to: 6-7


26-28: DojoContract deployment info updated, sensei!

The address and class hashes for this DojoContract have been updated. These changes align with the expected updates for a new contract deployment.


50-52: Ohayo! Another DojoContract's deployment info refreshed.

The address and class hashes for this DojoContract have been updated, sensei. These modifications are in line with the expected changes for a new contract deployment.

crates/dojo-core/src/tests/world/resources.cairo (1)

357-357: Ohayo, sensei! The contract name retrieval looks good now.

The change from dispatcher.contract_name() to dispatcher.name() aligns well with our goal of maintaining consistent naming conventions across contract interfaces. This modification preserves the original functionality while improving code clarity.

Let's make sure this change is consistent throughout our dojo, sensei:

✅ Verification successful

Ohayo, sensei! Let's adjust our search to target .cairo files directly.


Ohayo, sensei! The renaming looks spot on.

All instances of dispatcher.contract_name() have been successfully replaced with dispatcher.name(), and the usage of name is consistent throughout the codebase. Great job on maintaining clarity and consistency!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining instances of 'contract_name' method
# and confirm that 'name' method is used consistently.

echo "Checking for any remaining 'contract_name' usage:"
rg --type cairo 'contract_name\s*\(' -g '!vendor/'

echo "Verifying consistent usage of 'name' method:"
rg --type cairo '\.name\s*\(' -g '!vendor/'

Length of output: 378


Script:

#!/bin/bash
# Description: Check for any remaining instances of 'contract_name' method
# and confirm that 'name' method is used consistently within .cairo files.

echo "Checking for any remaining 'contract_name' usage in .cairo files:"
rg 'contract_name\s*\(' -g '*.cairo' -g '!vendor/'

echo "Verifying consistent usage of 'name' method in .cairo files:"
rg '\.name\s*\(' -g '*.cairo' -g '!vendor/'

Length of output: 655

examples/spawn-and-move/manifests/dev/deployment/manifest.json (4)

1258-1260: Function renaming across multiple contracts, sensei!

The function contract_name has been consistently renamed to name across several Dojo contracts. This is a significant change that affects multiple parts of the codebase.

Please ensure that all contract interfaces, implementations, and any code calling these contracts are updated to use the new function name. Run the following script to check for any remaining instances of contract_name:

#!/bin/bash
# Search for remaining instances of contract_name
echo "Searching for remaining instances of contract_name:"
rg --type-add 'cairo:*.cairo' --type cairo --type rust --type typescript 'contract_name'

Also, verify that all contract addresses have been updated correctly in your deployment scripts and configuration files.

Also applies to: 1292-1292, 1689-1691, 1723-1723, 1928-1930, 1962-1962, 2149-2151, 2183-2183


Line range hint 1-6440: Ohayo, sensei! Let's wrap up this manifest review.

This update includes significant changes across the World Contract, multiple Dojo contracts, and various models. Key points to remember:

  1. The World Contract has a new address and class hash.
  2. The function contract_name has been renamed to name across several contracts.
  3. Multiple model class hashes have been updated.

These changes may have far-reaching effects throughout your project. Please ensure that all references to contract addresses, function names, and model interactions are updated accordingly.

As a final check, run this script to identify files that might need updates based on the changes we've observed:

#!/bin/bash
echo "Files potentially affected by manifest changes:"
rg --type-add 'cairo:*.cairo' --type cairo --type rust --type typescript -l '0x15b584f1132fe386a0aa7a447e7073233a545ac4b84b361ed797edaa8f0f14|contract_name|ContractInitialized|Message|MockToken|Moved|Moves|PlayerConfig|Position|ServerProfile|RiverSkale|Flatbow'

Review the output files carefully to ensure all necessary updates have been made. Good luck with the deployment, sensei!


4-5: Ohayo, sensei! The World Contract has been updated.

The class hash, address, and transaction hash for the WorldContract have been modified. This suggests a new deployment or update of the contract.

Please ensure all references to the old address (0x15b584f1132fe386a0aa7a447e7073233a545ac4b84b361ed797edaa8f0f14) are updated throughout the project to the new address (0x46c1fd10836a8426197bf412fc5f26ea10f11a8d5c61474407f03f82c096593).

Also applies to: 1237-1238

✅ Verification successful

Ohayo, sensei! It looks like the old address isn’t referenced anywhere in the codebase based on our automated searches. 🎉

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for old address references
echo "Searching for old address references:"
rg --type-add 'cairo:*.cairo' --type cairo --type json '0x15b584f1132fe386a0aa7a447e7073233a545ac4b84b361ed797edaa8f0f14'

Length of output: 206


Script:

#!/bin/bash
# Comprehensive search for old address references across all file types
echo "Performing a comprehensive search for old address references:"
rg '0x15b584f1132fe386a0aa7a447e7073233a545ac4b84b361ed797edaa8f0f14'

Length of output: 202


Line range hint 2370-2371: Model updates detected, sensei!

Multiple model class hashes have been updated, including:

  • ContractInitialized
  • Message
  • MockToken
  • Moved
  • Moves
  • PlayerConfig
  • Position
  • ServerProfile
  • RiverSkale
  • Flatbow

While the structure of these models remains unchanged, the hash updates suggest modifications to their implementations.

Please ensure that all code interacting with these models is still functioning correctly. Run the following script to identify files that might need attention:

Review the output files and verify that they are compatible with the updated model implementations.

Also applies to: 2777-2778, 3184-3185, 3591-3592, 3998-3999, 4405-4406, 4812-4813, 5219-5220, 5626-5627, 6033-6034

crates/dojo-lang/src/plugin_test_data/system (5)

664-666: Ohayo, sensei! LGTM: Consistent renaming of contract_name to name.

The change aligns perfectly with the PR objectives, maintaining the existing functionality while ensuring consistency in naming conventions.


Line range hint 924-928: Ohayo again, sensei! LGTM: Wrapper function updated consistently.

The wrapper function has been updated to reflect the new method name while preserving its implementation. This change maintains consistency with the interface modification.


934-937: Ohayo once more, sensei! LGTM: Function call updated in wrapper.

The function call within the wrapper has been correctly updated to use the new method name name. This change ensures consistency throughout the implementation.


1082-1085: Ohayo yet again, sensei! LGTM: External module export updated.

The external module export has been correctly updated to use the new method name name. This change ensures that the new method name is properly exposed for external use.


1489-1491: Ohayo for the last time, sensei! LGTM: Consistent renaming across all implementations.

The changes have been consistently applied across all implementations, wrapper functions, and external module exports. This comprehensive update ensures that the renaming from contract_name to name is uniform throughout the codebase, aligning perfectly with the PR objectives.

Key observations:

  1. All ContractImpl implementations have been updated.
  2. Corresponding wrapper functions have been modified.
  3. Function calls within wrappers have been adjusted.
  4. External module exports have been revised.

These changes maintain the existing functionality while improving naming consistency, which should enhance code readability and maintainability.

Also applies to: 1749-1753, 1759-1762, 1907-1910, 2314-2316, 2571-2575, 2581-2584, 2729-2732, 3136-3138, 3396-3400, 3406-3409, 3554-3557, 3961-3963, 4254-4258, 4264-4267, 4412-4415, 4819-4821, 4974-4978, 4984-4987, 5132-5135, 5755-5757, 6024-6028, 6034-6037, 6336-6339, 6750-6752, 7030-7034, 7040-7043, 7353-7356, 7768-7770, 8042-8046, 8052-8055, 8211-8214, 8618-8620, 8872-8876, 8882-8885, 9030-9033

@@ -28,7 +28,7 @@
"items": [
{
"type": "function",
"name": "contract_name",
"name": "name",
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Ohayo, sensei!

It looks like there are still several instances of contract_name present in the codebase. To ensure the renaming is complete and to prevent any potential issues, please update all remaining references from contract_name to name. This will help maintain consistency and avoid any breaking changes.

  • Update all contract_name references in the Rust files listed in the script output.
🔗 Analysis chain

Ohayo, sensei! The name change looks good!

The renaming of "contract_name" to "name" in the IContract interface aligns well with the PR objective of ensuring consistency in naming conventions. This change makes the function name more concise and consistent with other similar functions in the interface (like "namespace" and "tag").

To ensure this change doesn't break existing code, let's verify its usage across the codebase:

This script will help us identify any places where the old function name might still be in use and confirm that the new function name is being used correctly.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining uses of 'contract_name' and new uses of 'name'

echo "Checking for remaining uses of 'contract_name':"
rg --type rust 'contract_name'

echo "Checking for new uses of 'name' function:"
rg --type rust 'fn name\('

Length of output: 11018

@@ -28,7 +28,7 @@
"items": [
{
"type": "function",
"name": "contract_name",
"name": "name",
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Incomplete Renaming of "contract_name" in Rust Files!

Ohayo, sensei! It looks like the renaming of "contract_name" to "name" in JSON ABI files was successful. However, there are still multiple instances of "contract_name" in Rust files that need to be updated for full consistency.

  • Rust Files Affected:
    • crates/sozo/ops/src/statistics.rs
    • crates/sozo/ops/src/tests/call.rs
    • crates/dojo-world/abigen/src/main.rs
    • crates/dojo-bindgen/src/plugins/typescript/mod.rs
    • (and others as identified in the shell script output)

Please update these remaining instances to ensure the renaming is fully consistent across the entire codebase.

🔗 Analysis chain

Ohayo, sensei! The name change looks good!

The renaming of "contract_name" to "name" in the IContract interface is consistent with the PR objectives. This change enhances clarity and maintains a uniform naming convention across contract interfaces.

To ensure consistency, let's verify if this change has been applied uniformly across the codebase:

If the script returns any results, we might need to update those occurrences as well for complete consistency, sensei.


Ohayo, sensei! It looks like we need to ensure the renaming of "contract_name" to "name" is fully consistent across the codebase.

To address the issues found:

Let's run this updated script to ensure all instances are properly addressed. If any occurrences of "contract_name" remain, please update them accordingly for complete consistency.


Ohayo, sensei! It seems we still have some instances of "contract_name" in Rust files, and the JSON ABI files path needs correction.

Let's first locate all JSON ABI files to ensure we're searching in the right places:


Ohayo, sensei! We've successfully located all JSON ABI files. Now, let's search for any remaining instances of "contract_name" within them to ensure complete renaming.


Ohayo, sensei! It appears that "contract_name" is still present in Rust files, and our previous attempt to search JSON files encountered a path issue.

Let's adjust our approach to accurately search within all JSON ABI files:

Please run this updated script to identify any remaining instances of "contract_name" in both Rust and JSON ABI files. Addressing these will ensure complete consistency across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining instances of "contract_name" in Rust files and contract ABIs

echo "Checking for 'contract_name' in Rust files:"
rg --type rust 'contract_name'

echo "Checking for 'contract_name' in contract ABI JSON files:"
rg --type json 'contract_name' '**/abis/**/*.json'

Length of output: 9186


Script:

# !/bin/bash
# Description: Verify the complete renaming of "contract_name" to "name" in Rust files and contract ABIs

echo "Re-checking 'contract_name' in Rust files:"
rg --type rust 'contract_name'

echo "Re-checking 'contract_name' in contract ABI JSON files:"
rg --type json 'contract_name' 'examples/spawn-and-move/manifests/dev/base/abis/contracts/**/*.json'

Length of output: 9282


Script:

#!/bin/bash
# Description: Locate all JSON ABI files in the repository

echo "Locating all JSON ABI files:"
fd --extension json

Length of output: 7478


Script:

#!/bin/bash
# Description: Search for "contract_name" in all JSON ABI files

echo "Searching for 'contract_name' in JSON ABI files:"
rg --type json 'contract_name' '**/*.json'

Length of output: 205


Script:

#!/bin/bash
# Description: Search for "contract_name" in all JSON ABI files without specifying a path pattern

echo "Searching for 'contract_name' in JSON ABI files:"
rg --type json 'contract_name'

Length of output: 143

@@ -28,7 +28,7 @@
"items": [
{
"type": "function",
"name": "contract_name",
"name": "name",
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Ohayo, sensei!

It looks like the renaming of "contract_name" to "name" in the IContract interface is only partially complete. The search revealed multiple occurrences of "contract_name" across various files, which need to be updated to ensure consistency and prevent potential issues.

Affected Files:

  • crates/dojo-lang/src/compiler.rs
  • crates/dojo-lang/src/contract.rs
  • crates/dojo-world/abigen/src/main.rs
  • crates/sozo/ops/src/tests/call.rs
  • crates/sozo/ops/src/statistics.rs
  • crates/dojo-bindgen/src/plugins/typescript/tests.rs
  • crates/dojo-bindgen/src/plugins/typescript/mod.rs
  • crates/dojo-bindgen/src/plugins/unity/mod.rs
  • crates/dojo-bindgen/src/plugins/typescript_v2/mod.rs
  • bin/sozo/src/commands/build.rs
  • bin/sozo/src/commands/auth.rs

Please update these instances to complete the renaming process.

🔗 Analysis chain

Ohayo, sensei! The name change looks good!

The renaming of "contract_name" to "name" in the IContract interface is a positive change that aligns with the PR's objective of ensuring consistency. The new name is more concise while still clearly conveying the function's purpose.

To ensure this change doesn't introduce any issues, please run the following script to check for any remaining occurrences of "contract_name" in the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining occurrences of "contract_name" in the codebase

# Test: Search for "contract_name" in all files. Expect: No occurrences found.
rg --type-add 'code:*.{rs,json,toml}' --type code 'contract_name'

# Test: Search for function calls using "contract_name". Expect: No occurrences found.
ast-grep --lang rust --pattern 'contract_name($$$)'

Length of output: 8934

Comment on lines +64 to +66
address = "0x71c327d19b2d0c6a0f65cced59f60fe69776af6885e8f42d8f6775af00f5d5b"
class_hash = "0x3ad65950996d7b0bc6c04a94d401cdb19bda3ab2cffc2098d90e25077dfa11a"
original_class_hash = "0x3ad65950996d7b0bc6c04a94d401cdb19bda3ab2cffc2098d90e25077dfa11a"
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Ohayo, sensei! Detected inconsistencies in DojoContracts' deployment info.

Upon verification, it appears that some class_hash values remain unchanged, indicating that not all DojoContracts have been properly updated.

  • Lines 64-66: class_hash and original_class_hash have not been updated as intended.
🔗 Analysis chain

Ohayo, sensei! Remaining DojoContracts' deployment info updated.

The addresses and class hashes for the remaining DojoContracts have been refreshed. These changes maintain consistency with the updates observed in the previous contract sections, indicating a systematic update across all contracts in the manifest.

To verify the consistency of these updates, you might want to run the following command:

This will help ensure that all contract-related hashes and addresses have been updated consistently throughout the manifest.

Also applies to: 78-80

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that all contract addresses and class hashes have been updated

# Test: Check if any old addresses or class hashes remain in the manifest
rg --type toml '0x[a-fA-F0-9]{40,64}' examples/spawn-and-move/manifests/dev/deployment/manifest.toml

Length of output: 3657

Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.61%. Comparing base (881e1aa) to head (d174af1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2482      +/-   ##
==========================================
- Coverage   68.62%   68.61%   -0.01%     
==========================================
  Files         372      372              
  Lines       48441    48441              
==========================================
- Hits        33244    33240       -4     
- Misses      15197    15201       +4     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant