Skip to content

Conversation

FabijanC
Copy link
Contributor

@FabijanC FabijanC commented Apr 8, 2025

Usage related changes

Development related changes

Checklist:

  • Checked out the contribution guidelines
  • Applied formatting - ./scripts/format.sh
  • No linter errors - ./scripts/clippy_check.sh
  • No unused dependencies - ./scripts/check_unused_deps.sh
  • No spelling errors - ./scripts/check_spelling.sh
  • Performed code self-review
  • Rebased to the latest commit of the target branch (or merged it into my branch)
    • Once you make the PR reviewable, please avoid force-pushing
  • Updated the docs if needed - ./website/README.md
  • Linked the issues resolvable by this PR - linking info
  • Updated the tests if needed; all passing - execution info

Summary by CodeRabbit

  • New Features

    • Expanded storage proof requests to support multiple storage keys, allowing for greater flexibility in specifying input.
  • Bug Fixes

    • Standardized error feedback for unsupported storage proofs, ensuring consistent and clear messaging.

Copy link

coderabbitai bot commented Apr 8, 2025

Walkthrough

This pull request updates the GetStorageProofInput structure by renaming and changing the type of the storage keys field. The field is renamed from contract_storage_keys to contracts_storage_keys and its type is changed from a single Option<ContractStorage> to an Option<Vec<ContractStorage>> to support multiple keys. Additionally, the integration tests are updated to use ConfirmedBlockId instead of BlockId, include standardized error messages for unsupported storage proofs, and import necessary utilities for error handling verifications.

Changes

File(s) Change Summary
crates/.../models.rs Renamed field contract_storage_keys: Option<ContractStorage> to contracts_storage_keys: Option<Vec<ContractStorage>> in the GetStorageProofInput struct.
tests/integration/general_rpc_tests.rs Updated type from BlockId to ConfirmedBlockId, standardized error messages using a constant (devnet_storage_proof_msg), added new imports and extra tests.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant RPC_Server as JSON RPC Server
    participant Test as Integration Test

    Test->>Client: Sends get_storage_proof request (with contracts_storage_keys)
    Client->>RPC_Server: Forwards request
    alt Unsupported Storage Proofs
        RPC_Server-->>Client: Returns JSON-RPC error (devnet_storage_proof_msg)
    else Normal Processing
        RPC_Server-->>Client: Processes request normally
    end
    Client->>Test: Returns response
    Test->>Test: Asserts JSON-RPC error matches expected outcome
Loading

Assessment against linked issues

Objective Addressed Explanation
Correct field name and type for contracts storage keys (#747)

Suggested reviewers

  • marioiordanov

Poem

I'm a rabbit in the code grove, hopping with delight,
Changing fields and types by day and by night.
From single keys to many, my fixes never tire,
As tests now catch errors that no longer misfire.
Carrots and code, together we inspire!
🥕🐰


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7301e02 and 1d2fba2.

📒 Files selected for processing (2)
  • crates/starknet-devnet-server/src/api/json_rpc/models.rs (1 hunks)
  • tests/integration/general_rpc_tests.rs (3 hunks)
🔇 Additional comments (6)
crates/starknet-devnet-server/src/api/json_rpc/models.rs (1)

55-55: Good change: Updated field to support multiple contract storage keys

The field renaming from contract_storage_keys to contracts_storage_keys better reflects its plural nature, and changing its type from Option<ContractStorage> to Option<Vec<ContractStorage>> correctly implements support for multiple contract storage keys rather than just a single one.

tests/integration/general_rpc_tests.rs (5)

2-4: LGTM: Good import updates

The imports have been correctly updated to use ConfirmedBlockId instead of BlockId and added imports for Provider and JsonRpcError to support the new test functionality.


10-10: LGTM: Added necessary utility imports

Added imports for error handling utility functions that are used in the new test case.


62-62: LGTM: Good error message standardization

Created a constant for the storage proof error message, which helps maintain consistency across the codebase.


66-68: LGTM: Updated test cases for new API

Test cases have been correctly updated to use ConfirmedBlockId instead of BlockId to align with the API changes.


78-87:

✅ Verification successful

Good addition: Testing with starknet-rs client

This test case ensures that the json_rpc_client.get_storage_proof method properly handles the error case when storage proofs are not supported.

Note the comment about a pending PR in the starknet-rs repository (PR #714), which indicates this is a temporary solution.


🏁 Script executed:

#!/bin/bash
# Check if the referenced PR in starknet-rs has been merged
gh repo view xJonathanLEI/starknet-rs --json url -q .url | xargs -I {} gh pr view 714 --repo {} --json state -q .state 2>/dev/null || echo "PR not found or repository unavailable"

Length of output: 129


Action: Test case approved; note pending PR #714 remains in effect

This test effectively verifies that the workaround in json_rpc_client.get_storage_proof correctly handles cases where storage proofs are unsupported. The temporary implementation (with the comment referencing PR #714) is still valid because the PR is currently open. Once PR #714 is merged, please update the test to remove the workaround and adjust the error checking accordingly.

  • File: tests/integration/general_rpc_tests.rs (lines 78-87)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@FabijanC FabijanC requested a review from marioiordanov April 8, 2025 11:32
@FabijanC FabijanC merged commit dcf2793 into main Apr 9, 2025
2 checks passed
@FabijanC FabijanC deleted the fix-get-storage-proof branch April 9, 2025 07:34
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.

Wrong property name and type in GetStorageProofInput for contracts storage keys
2 participants