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

katana: include starknet api as default #2510

Merged
merged 1 commit into from
Oct 9, 2024
Merged

Conversation

kariy
Copy link
Member

@kariy kariy commented Oct 9, 2024

ref #2508

Summary by CodeRabbit

  • New Features

    • Updated default configuration for the RPC settings to include support for the Starknet API.
  • Bug Fixes

    • Ensured that the apis field is now correctly initialized, enhancing the overall functionality of the RPC configuration.

Copy link

coderabbitai bot commented Oct 9, 2024

Walkthrough

Ohayo, sensei! The changes in this pull request focus on the RpcConfig struct within the crates/katana/node/src/config/rpc.rs file. The primary modification involves updating the default value of the apis field from an empty HashSet to a HashSet that includes a single entry of ApiKind::Starknet. The allowed_origins field remains unchanged, still set to None. Overall, the structure of RpcConfig stays the same, with an enhancement in the default configuration for the apis field.

Changes

File Path Change Summary
crates/katana/node/src/config/rpc.rs Updated RpcConfig struct's apis default value from HashSet::new() to HashSet::from([ApiKind::Starknet]). allowed_origins remains unchanged.

Sequence Diagram(s)

sequenceDiagram
    participant RpcConfig
    RpcConfig->>+Default: Initialize
    Default->>RpcConfig: Set apis = HashSet::from([ApiKind::Starknet])
    Default->>RpcConfig: Set allowed_origins = None
    RpcConfig-->>-Default: Configuration Complete
Loading

🪧 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

@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 and nitpick comments (1)
crates/katana/node/src/config/rpc.rs (1)

44-44: Ohayo again, sensei! Consider these enhancements

While the change is solid, here are a couple of suggestions to further improve the code:

  1. Add a comment explaining why Starknet is included by default. This would provide context for future maintainers.

  2. Consider creating a constant or a function to provide the default APIs. This could be beneficial if more APIs are added in the future or if the default set needs to be used elsewhere in the codebase.

Here's an example of how you might implement these suggestions:

/// The default set of APIs enabled for the RPC server.
/// Starknet is included by default as it's the primary API for most users.
pub const DEFAULT_RPC_APIS: HashSet<ApiKind> = HashSet::from([ApiKind::Starknet]);

impl Default for RpcConfig {
    fn default() -> Self {
        Self {
            // ... other fields ...
            apis: DEFAULT_RPC_APIS.clone(),
        }
    }
}

What do you think, sensei? Would these changes be valuable additions?

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3776bd5 and b140002.

📒 Files selected for processing (1)
  • crates/katana/node/src/config/rpc.rs (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
crates/katana/node/src/config/rpc.rs (1)

40-44: Ohayo, sensei! LGTM: Default inclusion of Starknet API

The change to include ApiKind::Starknet in the default apis set is a sensible improvement. It aligns well with the PR objective and provides a more convenient out-of-the-box experience for users, as the Starknet API is likely to be the most commonly used.

This modification ensures that the Starknet API is available by default without requiring additional configuration, which should streamline the setup process for many users.

Copy link

codecov bot commented Oct 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.86%. Comparing base (3776bd5) to head (b140002).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2510   +/-   ##
=======================================
  Coverage   67.86%   67.86%           
=======================================
  Files         389      389           
  Lines       50271    50271           
=======================================
  Hits        34117    34117           
  Misses      16154    16154           

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

@kariy kariy merged commit 5ab6cde into main Oct 9, 2024
15 checks passed
@kariy kariy deleted the katana/default-rpc-apis branch October 9, 2024 18:14
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