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(torii-grpc): world class hash #2307

Merged
merged 3 commits into from
Aug 16, 2024
Merged

Conversation

Larkooo
Copy link
Collaborator

@Larkooo Larkooo commented Aug 15, 2024

remove world class hash from grpc proto

Summary by CodeRabbit

  • New Features

    • Simplified data structures for WorldMetadata and World, improving readability and maintenance.
  • Bug Fixes

    • Removed unnecessary fields that could lead to potential errors in serialization and database interactions.
  • Documentation

    • Updated message definitions to reflect changes in data structure, ensuring accurate representation in external communications.

Copy link

coderabbitai bot commented Aug 15, 2024

Walkthrough

Ohayo, sensei! The recent changes streamline the data structures related to World and WorldMetadata by removing unnecessary fields, such as world_class_hash, from both the Rust structs and the associated gRPC message. This simplification may affect existing functionality that relied on these attributes, particularly in serialization and database interactions. The modifications promote a more efficient and clear representation of the relevant data.

Changes

File Change Summary
crates/dojo-types/src/lib.rs Removed world_class_hash from WorldMetadata, simplifying its structure.
crates/torii/core/src/lib.rs Removed world_class_hash, executor_address, and executor_class_hash from World struct.
crates/torii/core/src/sql.rs Changed the import of World from local to crate namespace.
crates/torii/grpc/proto/types.proto Removed world_class_hash field from WorldMetadata message, simplifying its structure.
crates/torii/grpc/src/server/mod.rs Updated metadata function to omit world_class_hash in SQL query and result construction.
crates/torii/grpc/src/types/mod.rs Modified TryFrom implementation to exclude world_class_hash when converting proto::types::WorldMetadata.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Server
    participant Database

    Client->>Server: Request World Metadata
    Server->>Database: Query for World Address
    Database-->>Server: Return World Address
    Server-->>Client: Respond with World Metadata (No world_class_hash)
Loading

This diagram illustrates the primary interaction for retrieving WorldMetadata, focusing on the simplification where world_class_hash is no longer involved in the query or response.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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: 0

Outside diff range, codebase verification and nitpick comments (1)
crates/torii/grpc/src/types/mod.rs (1)

Ohayo, sensei! It looks like the world_class_hash field is still being used in crates/dojo-world/src/manifest/mod.rs. This suggests that its removal from the TryFrom implementation might affect functionality elsewhere. Please review the dependencies and ensure that this change does not introduce any issues.

  • File: crates/dojo-world/src/manifest/mod.rs
    • Occurrences:
      • let world_class_hash =
      • class_hash: world_class_hash,
Analysis chain

Line range hint 115-122:
Verify the impact of removing world_class_hash.

The removal of world_class_hash from the TryFrom implementation simplifies the data structure. Ensure that no other parts of the code rely on this field.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `world_class_hash` is not used in other parts of the codebase.

# Test: Search for occurrences of `world_class_hash`. Expect: No results.
rg --type rust 'world_class_hash'

Length of output: 190

Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 69.56%. Comparing base (84f88fc) to head (10c4f2a).
Report is 1 commits behind head on main.

Files Patch % Lines
crates/torii/grpc/src/server/mod.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2307   +/-   ##
=======================================
  Coverage   69.55%   69.56%           
=======================================
  Files         352      352           
  Lines       46004    46003    -1     
=======================================
  Hits        32000    32000           
+ Misses      14004    14003    -1     

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

@glihm glihm merged commit 81b11e9 into dojoengine:main Aug 16, 2024
14 of 15 checks passed
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.

2 participants