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(katana): remove support for initializing custom settlement chain #2927

Merged
merged 1 commit into from
Jan 19, 2025

Conversation

kariy
Copy link
Member

@kariy kariy commented Jan 18, 2025

We can't support custom chain for now as we're relying heavily on the Atlantic service for setting the proofs and currently it is limited to only Starknet Sepolia.

Summary by CodeRabbit

  • New Features

    • Added support for selecting settlement chain during initialization
    • Introduced Sepolia as a default settlement chain option
    • Enabled optional custom settlement chain configuration
  • Improvements

    • Enhanced initialization workflow with more flexible chain selection
    • Simplified RPC URL configuration process

Copy link

coderabbitai bot commented Jan 18, 2025

Walkthrough

Ohayo, sensei! This pull request introduces enhancements to the Katana CLI initialization process, focusing on settlement chain selection. The changes modify the Cargo.toml by adding the strum_macros dependency and a new feature flag for custom settlement chains. In the CLI initialization module, a new mechanism is implemented to allow users to choose between Sepolia and a custom settlement chain, replacing the previous direct URL input method.

Changes

File Change Summary
bin/katana/Cargo.toml - Added strum_macros as a workspace dependency
- Introduced new feature init-custom-settlement-chain
bin/katana/src/cli/init/mod.rs - Added CARTRIDGE_SN_SEPOLIA_PROVIDER constant
- Created SettlementChainOpt enum
- Modified prompt method to support settlement chain selection
- Updated initialization input logic

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI
    participant SettlementChain

    User->>CLI: Trigger Init Command
    CLI->>User: Prompt Settlement Chain Selection
    User->>CLI: Choose Settlement Chain
    alt Sepolia Selected
        CLI->>SettlementChain: Use Predefined Sepolia URL
    else Custom Selected
        User->>CLI: Enter Custom RPC URL
        CLI->>SettlementChain: Use Custom URL
    end
Loading

Possibly related PRs

Suggested reviewers

  • glihm

Sensei, the changes look quite interesting! The new settlement chain selection mechanism adds flexibility to the initialization process. Ohayo and happy coding! 🚀


🪧 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

🧹 Nitpick comments (1)
bin/katana/src/cli/init/mod.rs (1)

22-22: Consider making the Sepolia provider URL configurable.

Ohayo sensei! While hardcoding the Sepolia provider URL simplifies the implementation, it might be better to make it configurable through environment variables or configuration files for flexibility in different environments.

-const CARTRIDGE_SN_SEPOLIA_PROVIDER: &str = "https://api.cartridge.gg/x/starknet/sepolia";
+const CARTRIDGE_SN_SEPOLIA_PROVIDER: &str = option_env!("SEPOLIA_PROVIDER_URL")
+    .unwrap_or("https://api.cartridge.gg/x/starknet/sepolia");
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57cfe1e and 4361264.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • bin/katana/Cargo.toml (2 hunks)
  • bin/katana/src/cli/init/mod.rs (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: fmt
  • GitHub Check: build-and-push
🔇 Additional comments (4)
bin/katana/src/cli/init/mod.rs (3)

122-137: Well-structured implementation with clear documentation!

The enum definition and network options are well-organized, with excellent documentation explaining the limitation to Sepolia. The feature flag approach maintains flexibility for future custom settlement chain support if needed.


222-222: LGTM! Clean integration with the new settlement chain selection.

The update to use settlement_url maintains consistency with the new approach.


139-150: Consider additional URL validation for custom settlement chains.

When the custom settlement chain feature is enabled, we should validate that the provided URL is actually a Starknet RPC endpoint. This could prevent configuration issues early in the initialization process.

bin/katana/Cargo.toml (1)

31-31: Clean dependency and feature flag additions!

The workspace-level strum_macros dependency and the init-custom-settlement-chain feature flag are well-integrated. The empty feature array is appropriate for this use case.

Also applies to: 45-45

Copy link

codecov bot commented Jan 18, 2025

Codecov Report

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

Project coverage is 55.80%. Comparing base (57cfe1e) to head (4361264).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
bin/katana/src/cli/init/mod.rs 0.00% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2927      +/-   ##
==========================================
- Coverage   55.81%   55.80%   -0.01%     
==========================================
  Files         444      444              
  Lines       57308    57317       +9     
==========================================
+ Hits        31986    31987       +1     
- Misses      25322    25330       +8     

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

@kariy kariy merged commit 2dd3ead into main Jan 19, 2025
15 of 17 checks passed
@kariy kariy deleted the katana/hardcoded-url branch January 19, 2025 00:01
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