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: add prefixes for sozo call and better output message #2366

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

glihm
Copy link
Collaborator

@glihm glihm commented Aug 29, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced CallArgs struct to accept calldata as a string for improved input flexibility.
    • Improved error handling and user feedback in the call function through enhanced integration with the user interface.
  • Bug Fixes

    • Updated error reporting mechanisms to provide clearer messages on failures.
  • Tests

    • Enhanced test functions to utilize a user interface context, improving output clarity and feedback during testing.

Copy link

coderabbitai bot commented Aug 29, 2024

Walkthrough

Ohayo, sensei! The changes involve modifications to the CallArgs struct, altering the calldata field from Vec<Felt> to Option<String>, allowing for enhanced input parsing. The call function has been updated to include a ui: &Ui parameter for improved error handling and user feedback. Additionally, test functions have been modified to accommodate the new Ui parameter, enhancing the testing framework's usability.

Changes

Files Change Summary
bin/sozo/src/commands/call.rs Changed calldata from Vec<Felt> to Option<String>, updated logic to decode calldata strings.
crates/sozo/ops/src/call.rs Added ui: &Ui parameter to call function, improved error handling with match statement.
crates/sozo/ops/src/tests/call.rs Updated test functions to accept ui: &Ui parameter, enhancing feedback and error reporting.

Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fc1f894 and 4efe834.

Files selected for processing (3)
  • bin/sozo/src/commands/call.rs (3 hunks)
  • crates/sozo/ops/src/call.rs (3 hunks)
  • crates/sozo/ops/src/tests/call.rs (8 hunks)
Additional comments not posted (16)
crates/sozo/ops/src/call.rs (5)

3-3: LGTM!

The import statement for Ui is correct and necessary for the new ui parameter.


12-12: LGTM!

The addition of the ui: &Ui parameter to the function signature is consistent with the goal of enhancing error handling and user feedback.


38-52: LGTM!

The match statement improves the robustness and readability of the code by explicitly handling both success and error cases.


45-51: LGTM!

The error handling logic is well-implemented, providing detailed error messages and utilizing the ui parameter for enhanced user feedback.


39-44: LGTM!

The success case logic is correctly implemented, providing a clear and formatted output.

bin/sozo/src/commands/call.rs (5)

10-10: LGTM!

The import statement for calldata_decoder is correct and necessary for the new calldata type handling.


25-31: LGTM!

The updated help text is clear and informative, providing detailed information about the new parsing capabilities.


32-32: LGTM!

The change to Option<String> for the calldata field enhances the flexibility of the input handling.


66-70: LGTM!

The conditional check is correctly implemented, ensuring that the calldata is decoded only if it is provided.


73-77: LGTM!

The update to include the ui parameter in the call to sozo_ops::call::call is consistent with the goal of enhancing error handling and user feedback.

crates/sozo/ops/src/tests/call.rs (6)

3-3: LGTM!

The import statement for Ui is correct and necessary for the new Ui parameter in the test functions.


25-26: LGTM!

The creation of the Ui instance with verbosity set to Verbose and output format set to Text is correctly implemented.


50-51: LGTM!

The creation of the Ui instance with verbosity set to Verbose and output format set to Text is correctly implemented.


75-76: LGTM!

The creation of the Ui instance with verbosity set to Verbose and output format set to Text is correctly implemented.


100-101: LGTM!

The creation of the Ui instance with verbosity set to Verbose and output format set to Text is correctly implemented.


125-126: LGTM!

The creation of the Ui instance with verbosity set to Verbose and output format set to Text is correctly implemented.

Also applies to: 145-146


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

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 76.19048% with 5 lines in your changes missing coverage. Please review.

Project coverage is 67.48%. Comparing base (1298382) to head (4efe834).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
bin/sozo/src/commands/call.rs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2366      +/-   ##
==========================================
- Coverage   67.49%   67.48%   -0.02%     
==========================================
  Files         359      359              
  Lines       46965    46940      -25     
==========================================
- Hits        31698    31676      -22     
+ Misses      15267    15264       -3     

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

@glihm glihm merged commit fea03f4 into dojoengine:main Aug 29, 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.

1 participant