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

feat(lang): entity batch #2632

Closed
wants to merge 3 commits into from
Closed

Conversation

glihm
Copy link
Collaborator

@glihm glihm commented Nov 5, 2024

Add to the world the capability of batching entities updates by checking permissions only one.

Events historical parameter is no longer set from the chain, and will need to be implemented in the torii config from the tags.

Ensure ABI for events types.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced batch processing capabilities for events and entities, allowing multiple operations in a single call.
    • Added new methods for handling multiple models and values in storage.
  • Improvements

    • Streamlined event management by removing unnecessary parameters and simplifying event processing logic.
    • Enhanced error handling and validation checks in tests.
  • Bug Fixes

    • Corrected target addresses in policy configurations.
  • Documentation

    • Updated configuration file to reflect new world address.

These updates improve the overall efficiency and functionality of the Dojo framework, enhancing user experience.

@glihm glihm closed this Nov 5, 2024
Copy link

coderabbitai bot commented Nov 5, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

Ohayo! The recent changes primarily involve updates to the Cargo.toml file, where dependencies have shifted from remote Git references to local paths for scarb and scarb-ui. Additionally, new dependencies for katana and dojo projects have been added. The modifications extend to various Rust source files, introducing new structs, methods, and tests, particularly emphasizing batch processing capabilities for models and events. Notably, several historical fields have been removed from event-related structures, streamlining the event handling process.

Changes

File Path Change Summary
Cargo.toml Updated dependencies for scarb and scarb-ui to local paths; added new dependencies for katana and dojo projects.
bin/sozo/src/commands/events.rs Modified match_event function to change output formatting for EventEmitted variant, removing the historical field from the output string.
bin/sozo/tests/test_data/policies.json Updated target addresses for existing methods; added new methods including emit_events, set_entity, and others with updated target addresses.
crates/dojo/core-cairo-test/src/lib.cairo Added new module storage within the world module for testing purposes.
crates/dojo/core-cairo-test/src/tests/event/event.cairo Introduced new struct FooEvent and modified tests to exclude version assertion.
crates/dojo/core-cairo-test/src/tests/helpers.cairo Added new struct NotCopiable and updated deploy_world_and_foo function to include this model.
crates/dojo/core-cairo-test/src/tests/world/storage.cairo Introduced unit tests for ModelStorage functionality, validating writing, reading, and erasing models.
crates/dojo/core-cairo-test/src/tests/world/world.cairo Modified tests to enhance error handling and validation checks for world functionalities.
crates/dojo/core/src/event/event.cairo Removed version field from EventDefinition struct and deleted version and historical methods from Event trait.
crates/dojo/core/src/event/interface.cairo Removed version method from IEvent trait.
crates/dojo/core/src/lib.cairo Removed test-related exports for ModelTest and ModelValueTest.
crates/dojo/core/src/model/model.cairo Removed ModelTest trait and its implementation.
crates/dojo/core/src/model/model_value.cairo Removed ModelValueTest trait and its implementation.
crates/dojo/core/src/model/storage.cairo Added new methods for batch operations in ModelStorage and ModelValueStorage traits.
crates/dojo/core/src/world/errors.cairo Added new function lengths_mismatch for error handling.
crates/dojo/core/src/world/iworld.cairo Added new methods for batch processing of events and entities in IWorld and IWorldTest traits.
crates/dojo/core/src/world/storage.cairo Introduced new batch methods in WorldStorage for handling multiple models and values.
crates/dojo/core/src/world/world_contract.cairo Added new batch methods for event handling and entity management in WorldContract.
crates/dojo/lang/src/attribute_macros/event.rs Removed EventParameters struct and related logic, simplifying event processing.
crates/dojo/lang/src/attribute_macros/patches/event.patch.cairo Removed version and historical methods from event implementations; added ensure_abi method.
crates/dojo/lang/src/attribute_macros/patches/model.patch.cairo Introduced new model structures and implementations, removed test implementations.
crates/dojo/world/src/contracts/abigen/world.rs Added methods for batch operations in WorldContract and WorldContractReader.
crates/torii/core/src/processors/event_message.rs Modified process method to replace event.historical with a hardcoded value.
crates/torii/types-test/src/contracts.cairo Updated RecordLogged struct to derive Serde and implemented the delete function.
examples/spawn-and-move/dojo_dev.toml Updated world_address field in configuration.

Possibly related PRs

Suggested reviewers

  • kariy: Suggested for review due to familiarity with the project and potential insights into the changes made.

🪧 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.

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