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

refactor(torii-libp2p): always use is_valid_signature #2776

Merged
merged 2 commits into from
Dec 6, 2024

Conversation

Larkooo
Copy link
Collaborator

@Larkooo Larkooo commented Dec 6, 2024

Summary by CodeRabbit

  • New Features

    • Simplified signature validation process by using a vector format for signatures.
    • Enhanced maintainability through a consistent calldata structure for signature validation.
  • Bug Fixes

    • Improved error handling during message deserialization, validation, and database operations.
  • Refactor

    • Removed the Signature enum, streamlining the Message struct to use a vector for signatures.
    • Updated test suite to reflect changes in signature handling.

Copy link

coderabbitai bot commented Dec 6, 2024

Walkthrough

Ohayo, sensei! This pull request introduces changes to the signature handling process in the torii library. It removes the Signature enum and modifies the validate_signature function to accept a slice of Felt, simplifying the signature validation logic. The Message struct's signature field is now a vector of Felt, enhancing clarity. Corresponding updates are made in the test suite to align with these structural changes. Overall, the modifications streamline the signature validation and representation, promoting a more straightforward approach.

Changes

File Path Change Summary
crates/torii/libp2p/src/server/mod.rs - Removed encode_type and Signature imports.
- Updated validate_signature to accept &[Felt].
- Streamlined signature validation logic.
- Minor error handling adjustments in the run method.
crates/torii/libp2p/src/types.rs - Changed signature field in Message struct from Signature enum to Vec<Felt>.
- Removed the Signature enum entirely.
crates/torii/libp2p/src/tests.rs - Updated signature in test_client_messaging from Signature::Account(vec![...]) to vec![...].
- Other test functions unchanged.

Possibly related PRs

  • feat(libp2p): multi signature schemes & session signing #2599: The changes in this PR involve modifications to the Signature enum and its usage in the Message struct, which directly relates to the changes in the main PR that also involve the Signature type and its simplification in the validate_signature function.

Suggested reviewers

  • glihm

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ff3ef73 and e0172a1.

📒 Files selected for processing (1)
  • crates/torii/libp2p/src/tests.rs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/torii/libp2p/src/tests.rs

🪧 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

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.03%. Comparing base (c5e7d6b) to head (e0172a1).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2776      +/-   ##
==========================================
+ Coverage   56.01%   56.03%   +0.01%     
==========================================
  Files         434      434              
  Lines       55068    55040      -28     
==========================================
- Hits        30849    30840       -9     
+ Misses      24219    24200      -19     

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

@glihm glihm merged commit dccd06e into dojoengine:main Dec 6, 2024
14 checks passed
Larkooo added a commit to Larkooo/dojo that referenced this pull request Dec 9, 2024
* refactor(torii-libp2p): always use is_valid_signature

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