Skip to content

Conversation

@remybar
Copy link
Collaborator

@remybar remybar commented Aug 19, 2025

  • remove some useless files
  • fix spawn-and-move tests due to the new Dojo storage system (DojoStore).

Summary by CodeRabbit

  • Chores
    • Removed the public surface of the Dojo language crate (breaking change to that crate's exported API).
    • Refreshed spawn-and-move example artifacts and manifest: updated addresses/hashes, external references, action tag/selector names, and init calldata; minor layout schema adjustment.
    • Updated policy mappings in test data to match new artifact addresses.
  • Tests
    • Aligned test expectation for reset_player_config to use favorite_item = None by default.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 19, 2025

ohayo, sensei!

Walkthrough

Removes the public API surface from the Dojo lang crate root and updates example artifacts and policies with refreshed addresses/class_hashes plus a minor test expectation change in spawn-and-move.

Changes

Cohort / File(s) Summary of Changes
Lang crate root removal
crates/dojo/lang/src/lib.rs
Deleted crate-level docs, warnings, all pub mod declarations, public re-exports, public constants, and debug_expand function, leaving the crate root empty.
Spawn-and-move manifest updates
examples/spawn-and-move/manifest_dev.json
Updated world/contract/model/event addresses and class_hash fingerprints; adjusted FixedArray representation to use Span<Layout>, u32; renamed actions tag (ns-actionsns2-actions), updated selector; changed ns-others init_calldata to ["0xff"].
Spawn-and-move test tweak
examples/spawn-and-move/src/actions.cairo
Test assertion updated: PlayerConfig.favorite_item expected to be None (was Some(0)). No production logic changed.
Policy mappings update
bin/sozo/tests/test_data/policies.json
Re-mapped many policy target addresses to new artifact addresses; added one upgrade policy entry; ensured EOF newline.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

contributor

Suggested reviewers

  • glihm

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore-clean_up

🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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
Contributor

@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
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2b62505 and 7be9968.

⛔ Files ignored due to path filters (1)
  • crates/dojo/lang/Scarb.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • crates/dojo/lang/src/lib.rs (0 hunks)
  • examples/spawn-and-move/manifest_dev.json (8 hunks)
  • examples/spawn-and-move/src/actions.cairo (1 hunks)
💤 Files with no reviewable changes (1)
  • crates/dojo/lang/src/lib.rs
🔇 Additional comments (7)
examples/spawn-and-move/src/actions.cairo (1)

179-183: Ohayo sensei — Assertion now matches DojoStore default (None), LGTM

Aligns with PlayerConfig initialization in set_models and with DojoStore’s zero/default semantics after erase/read. No functional concerns here.

examples/spawn-and-move/manifest_dev.json (6)

1482-1484: Ohayo sensei — actions contract recompiled/redeployed; metadata updated

Address and class_hash updated. No issues from the manifest perspective.


2916-2961: Ohayo sensei — Model class_hashes updated; plan for client reindexing

Models (e.g., ns-PlayerConfig, ns-Position, ns-Moves) have new class_hashes. Indexers/cache layers should re-resolve model fingerprints to avoid stale decoding.

I can provide a small migration checklist or script if your tooling needs to flush model caches. Want me to open a ticket?


2395-2399: Ohayo sensei — ABI match confirmed for ns-others.init_calldata
The ns-others contract’s dojo_init takes a single u8, and setting ["0xff"] correctly satisfies that signature. 🎉


2760-2762: Ohayo sensei — Confirm intentional dual actions deployments

The manifest lists two actions-like contracts, which may be valid for versioning but could confuse naive consumers:

• ns-actions
– Address: 0x6898ae11701ff8355a88a14e798534a13d96a96d022a6595353b36a7c83e0f1
– Selector: 0x44f0e209e9c5b4b85306833a20e81c3b1a053fa9b3606cfcc59b30b28cb62f6

• ns2-actions
– Address: 0x66406ffbeb01a660e86ba37637e98d3201421a5956c9ca151b216ba5eb258b0
– Selector: 0x1a920eff7b3fd2be618d5a222e63e805a2a82e71579f97ba06d716a45d1ae25

Suggestions:

  • If both are required (e.g., old vs. new), ensure clients always resolve by the exact tag/selector.
  • If ns-actions is now vestigial, consider removing or renaming it for clarity.

Let me know if you’d like a cleanup patch drafted!


2928-2931: Ohayo sensei — class_hash formatting is valid

Ran a manifest-wide check on examples/spawn-and-move/manifest_dev.json:

  • Lengths (hex digits, excluding 0x):
    • 61 digits – 1 entry (the snippet at lines 2928–2931)
    • 63 digits – 24 entries
  • All entries match the 0x[0-9a-fA-F]+ pattern

These variations are due to trimmed leading zeros, not typos or truncation. No further fixes needed.


3-4: Ohayo sensei — confirm all tooling is aligned with the new world identity

The manifest in examples/spawn-and-move/manifest_dev.json now reports:

world.class_hash=0x4d44ca76c3f82df35436d1c20847ba5c345b8dda4731e200ba3232cd8f94fe9
world.address=0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b

If any scripts, .env files, or example configs still pin the previous values, they’ll drift out of sync. Please verify consumers are updated by:

  • Searching for the new hashes to locate hard-coded references:
    grep -R '0x4d44ca76c3f82df35436d1c20847ba5c345b8dda4731e200ba3232cd8f94fe9' -n .
    grep -R '0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b' -n .
  • Grepping the repo history or config files for the old class_hash/address to catch any stale pins

Ensuring consistency across all tooling avoids unexpected mismatches.

Copy link
Contributor

@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

🧹 Nitpick comments (1)
bin/sozo/tests/test_data/policies.json (1)

107-109: New upgrade policy for 0x5357fd… — verify intended contract

A single upgrade entry was added here. If this corresponds to the dungeon/feature contract mentioned in the PR, all good. Please confirm it appears in the updated manifests/artifacts to avoid a dangling policy.

I can wire a small generator to emit policies.json from the active manifest to enforce consistency. Want that, sensei?

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7be9968 and bfc08d7.

📒 Files selected for processing (1)
  • bin/sozo/tests/test_data/policies.json (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-28T23:35:04.367Z
Learnt from: glihm
PR: dojoengine/dojo#2691
File: bin/sozo/tests/test_data/policies.json:7-32
Timestamp: 2024-11-28T23:35:04.367Z
Learning: The file `bin/sozo/tests/test_data/policies.json` is a test file containing policies used by sessions to determine which methods can be called for which contract addresses. There is not much to verify or check in this file.

Applied to files:

  • bin/sozo/tests/test_data/policies.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: fmt
🔇 Additional comments (4)
bin/sozo/tests/test_data/policies.json (4)

3-9: Upgrade targets rotated — looks consistent

Two new upgrade targets introduced. No schema changes; entries remain flat objects with "target" and "method". Looks good.


190-190: EOF newline normalized

Minor formatting cleanup. All good. ohayo, sensei.


147-181: Ohayo sensei, listing multiple method entries for the same target is intentional. We’ve verified that the address 0x66406f… only appears here to enumerate each allowed method in bin/sozo/tests/test_data/policies.json—there isn’t a second-target group to trim. Keeping every method entry ensures comprehensive test coverage of policy behavior.


111-145: ohayo sensei!

Confirmed that the address 0x6898ae11701ff8355a88a14e798534a13d96a96d022a6595353b36a7c83e0f1 is consistently used in both:

  • examples/spawn-and-move/manifest_dev.json (defines the deployed contract)
  • bin/sozo/tests/test_data/policies.json (declares the policies against that same contract)

This alignment ensures the spawn-and-move tests for DojoStore will load and apply those policies correctly. No further changes needed here.

Comment on lines +11 to +105
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "uuid"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "set_metadata"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "register_namespace"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "register_event"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "register_model"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "register_contract"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "register_external_contract"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "register_library"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "init_contract"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "upgrade_event"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "upgrade_model"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "upgrade_contract"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "upgrade_external_contract"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "emit_event"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "emit_events"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "set_entity"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "set_entities"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "delete_entity"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "delete_entities"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "grant_owner"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "revoke_owner"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "grant_writer"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "revoke_writer"
},
{
"target": "0x681722ce4fc9c1fd0e800ba92e6ad759544863d65e57eecd623442ec30a31f1",
"target": "0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b",
"method": "upgrade"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Bulk remap to 0x653644… (World) — consider preventing drift

All World-admin methods now point to 0x653644… This matches the PR goal of refreshing addresses. To keep this file in sync with manifests over time, consider generating these entries from the active world manifest (or a single TOML/JSON source) during tests. This avoids future checksum drift.

Run to sanity-check duplicates and address format:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
f="bin/sozo/tests/test_data/policies.json"

# 1) Validate JSON
jq . >/dev/null <"$f"

# 2) Ensure no duplicate (target,method) pairs
dups=$(jq -r '.[] | "\(.target)|\(.method)"' "$f" | sort | uniq -d)
if [[ -n "$dups" ]]; then
  echo "Duplicate target|method pairs found:"; echo "$dups"; exit 1
fi

# 3) Check address format: 0x + 64 hex chars (lowercase)
bad=$(jq -r '.[] | .target' "$f" | awk '!/^0x[0-9a-f]{64}$/')
if [[ -n "$bad" ]]; then
  echo "Targets with invalid format:"; echo "$bad"; exit 1
fi

# 4) Optional: confirm targets appear in repo artifacts/manifests
# (best-effort cross-check; non-fatal)
rg -n --color=never -C1 '0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b' || true

Length of output: 12791


ohayo sensei — Critical: Truncated hex addresses in policies.json

Several target entries in bin/sozo/tests/test_data/policies.json do not conform to the required format 0x + 64 lowercase hex characters. For example:

  • 0x5df34baa68c5f498c4a9776abf66c8d30efbdfdcaa8321135487df3e4bd3ef (63 hex chars)
  • Multiple repeats of 0x653644e1085578a22addf74edbd3a211cd41e7323f9ac249e3ffbf04bcbb86b (63 hex chars)
  • Other entries also missing one hex digit at the end.

These malformed addresses will break downstream consumers and tests.

• Fix all truncated target values so they match ^0x[0-9a-f]{64}$.
• Consider adding a CI check (e.g., the jq + awk script) to validate address length as part of your test suite.

@kariy kariy merged commit de5f7ad into main Aug 20, 2025
10 checks passed
@kariy kariy deleted the chore-clean_up branch August 20, 2025 21:05
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.

3 participants