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(katana-rpc): rename trait methods to their exact names in the api spec #2208

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

kariy
Copy link
Member

@kariy kariy commented Jul 24, 2024

renaming to their exact names in the json rpc spec so that we can reserve the current names for other stuff.

Summary by CodeRabbit

  • New Features

    • Enhanced API method naming for improved clarity and consistency.
    • Explicitly named methods such as get_block_with_tx_hashes, get_transaction_status, and trace_transaction for better understanding of their functions.
  • Bug Fixes

    • Updated function calls in tests to align with the new method names, ensuring correct functionality.
  • Documentation

    • Changes reflect improved semantic clarity in API usage, aiding developers in understanding and utilizing the API effectively.

Copy link

coderabbitai bot commented Jul 24, 2024

Walkthrough

Ohayo, sensei! The recent changes primarily involve the renaming of numerous asynchronous methods in the StarknetApi and StarknetTraceApi traits to improve clarity and consistency. These updates follow a more descriptive naming convention, prefixing method names with "get_" or "trace_", thereby enhancing the semantic understanding of the API without altering functionality.

Changes

Files Change Summary
crates/.../rpc/rpc-api/src/starknet.rs Renamed methods in StarknetApi and StarknetTraceApi for clarity (e.g., block_with_tx_hashes to get_block_with_tx_hashes).
crates/.../rpc/rpc/src/starknet/read.rs Updated method names in StarknetApiServer for consistency, aligning with new naming conventions.
crates/.../rpc/rpc/src/starknet/trace.rs Modified StarknetTraceApiServer methods, including renaming trace to trace_transaction.
crates/.../rpc/rpc/tests/torii.rs Adjusted test function to call renamed method get_transaction_status.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant StarknetApiServer
    participant StarknetApi

    Client->>StarknetApiServer: get_block_with_tx_hashes(block_id)
    StarknetApiServer->>StarknetApi: get_block_with_tx_hashes(block_id)
    StarknetApi-->>StarknetApiServer: MaybePendingBlockWithTxHashes
    StarknetApiServer-->>Client: MaybePendingBlockWithTxHashes
Loading
sequenceDiagram
    participant Client
    participant StarknetTraceApiServer
    participant StarknetApi

    Client->>StarknetTraceApiServer: trace_transaction(transaction_hash)
    StarknetTraceApiServer->>StarknetApi: trace_transaction(transaction_hash)
    StarknetApi-->>StarknetTraceApiServer: TransactionTrace
    StarknetTraceApiServer-->>Client: TransactionTrace
Loading

Enjoy the clarity, sensei!


Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a35ddcb and e4bcb8d.

Files selected for processing (4)
  • crates/katana/rpc/rpc-api/src/starknet.rs (6 hunks)
  • crates/katana/rpc/rpc/src/starknet/read.rs (16 hunks)
  • crates/katana/rpc/rpc/src/starknet/trace.rs (2 hunks)
  • crates/katana/rpc/rpc/tests/torii.rs (1 hunks)
Additional comments not posted (37)
crates/katana/rpc/rpc-api/src/starknet.rs (18)

43-43: Ohayo, sensei! Method name updated to get_block_with_tx_hashes.

The renaming aligns with the new naming convention for better clarity.


50-53: Ohayo, sensei! Method name updated to get_block_with_txs.

The renaming aligns with the new naming convention for better clarity.


57-57: Ohayo, sensei! Method name updated to get_block_with_receipts.

The renaming aligns with the new naming convention for better clarity.


64-64: Ohayo, sensei! Method name updated to get_state_update.

The renaming aligns with the new naming convention for better clarity.


68-68: Ohayo, sensei! Method name updated to get_storage_at.

The renaming aligns with the new naming convention for better clarity.


78-81: Ohayo, sensei! Method name updated to get_transaction_status.

The renaming aligns with the new naming convention for better clarity.


85-85: Ohayo, sensei! Method name updated to get_transaction_by_hash.

The renaming aligns with the new naming convention for better clarity.


89-89: Ohayo, sensei! Method name updated to get_transaction_by_block_id_and_index.

The renaming aligns with the new naming convention for better clarity.


97-97: Ohayo, sensei! Method name updated to get_transaction_receipt.

The renaming aligns with the new naming convention for better clarity.


104-104: Ohayo, sensei! Method name updated to get_class.

The renaming aligns with the new naming convention for better clarity.


113-113: Ohayo, sensei! Method name updated to get_class_hash_at.

The renaming aligns with the new naming convention for better clarity.


121-121: Ohayo, sensei! Method name updated to get_class_at.

The renaming aligns with the new naming convention for better clarity.


129-129: Ohayo, sensei! Method name updated to get_block_transaction_count.

The renaming aligns with the new naming convention for better clarity.


176-176: Ohayo, sensei! Method name updated to get_events.

The renaming aligns with the new naming convention for better clarity.


180-180: Ohayo, sensei! Method name updated to get_nonce.

The renaming aligns with the new naming convention for better clarity.


219-219: Ohayo, sensei! Method name updated to trace_transaction.

The renaming aligns with the new naming convention for better clarity.


223-223: Ohayo, sensei! Method name updated to simulate_transactions.

The renaming aligns with the new naming convention for better clarity.


232-235: Ohayo, sensei! Method name updated to trace_block_transactions.

The renaming aligns with the new naming convention for better clarity.

crates/katana/rpc/rpc/tests/torii.rs (1)

137-137: Ohayo, sensei! Method name updated to get_transaction_status.

The renaming aligns with the new naming convention for better clarity.

crates/katana/rpc/rpc/src/starknet/trace.rs (3)

24-24: Ohayo, sensei! Method name updated to trace_transaction.

The renaming aligns with the new naming convention for better clarity.


32-32: Ohayo, sensei! Method name updated to simulate_transactions.

The renaming aligns with the new naming convention for better clarity.


214-217: Ohayo, sensei! Method name updated to trace_block_transactions.

The renaming aligns with the new naming convention for better clarity.

crates/katana/rpc/rpc/src/starknet/read.rs (15)

Line range hint 39-47:
LGTM! The function name change improves clarity.

The function nonce has been correctly renamed to get_nonce, enhancing clarity and consistency with the naming convention.


Line range hint 65-72:
LGTM! The function name change improves clarity.

The function transaction_by_hash has been correctly renamed to get_transaction_by_hash, enhancing clarity and consistency with the naming convention.


Line range hint 78-85:
LGTM! The function name change improves clarity.

The function block_transaction_count has been correctly renamed to get_block_transaction_count, enhancing clarity and consistency with the naming convention.


Line range hint 91-105:
LGTM! The function name change improves clarity.

The function class_at has been correctly renamed to get_class_at, enhancing clarity and consistency with the naming convention.


Line range hint 116-166:
LGTM! The function name change improves clarity.

The function block_with_tx_hashes has been correctly renamed to get_block_with_tx_hashes, enhancing clarity and consistency with the naming convention.


Line range hint 172-196:
LGTM! The function name change improves clarity.

The function transaction_by_block_id_and_index has been correctly renamed to get_transaction_by_block_id_and_index, enhancing clarity and consistency with the naming convention.


Line range hint 204-254:
LGTM! The function name change improves clarity.

The function block_with_txs has been correctly renamed to get_block_with_txs, enhancing clarity and consistency with the naming convention.


Line range hint 261-311:
LGTM! The function name change improves clarity.

The function block_with_receipts has been correctly renamed to get_block_with_receipts, enhancing clarity and consistency with the naming convention.


Line range hint 317-333:
LGTM! The function name change improves clarity.

The function state_update has been correctly renamed to get_state_update, enhancing clarity and consistency with the naming convention.


Line range hint 342-376:
LGTM! The function name change improves clarity.

The function transaction_receipt has been correctly renamed to get_transaction_receipt, enhancing clarity and consistency with the naming convention.


Line range hint 386-393:
LGTM! The function name change improves clarity.

The function class_hash_at has been correctly renamed to get_class_hash_at, enhancing clarity and consistency with the naming convention.


Line range hint 403-420:
LGTM! The function name change improves clarity.

The function class has been correctly renamed to get_class, enhancing clarity and consistency with the naming convention.


Line range hint 425-439:
LGTM! The function name change improves clarity.

The function events has been correctly renamed to get_events, enhancing clarity and consistency with the naming convention.


Line range hint 485-491:
LGTM! The function name change improves clarity.

The function storage_at has been correctly renamed to get_storage_at, enhancing clarity and consistency with the naming convention.


Line range hint 596-612:
LGTM! The function name change improves clarity.

The function transaction_status has been correctly renamed to get_transaction_status, enhancing clarity and consistency with the naming convention.


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

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

Attention: Patch coverage is 11.11111% with 8 lines in your changes missing coverage. Please review.

Project coverage is 69.07%. Comparing base (a35ddcb) to head (e4bcb8d).

Files Patch % Lines
crates/katana/rpc/rpc/src/starknet/read.rs 14.28% 6 Missing ⚠️
crates/katana/rpc/rpc/src/starknet/trace.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2208   +/-   ##
=======================================
  Coverage   69.06%   69.07%           
=======================================
  Files         339      339           
  Lines       44052    44052           
=======================================
+ Hits        30426    30429    +3     
+ Misses      13626    13623    -3     

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

@kariy kariy merged commit 71b1f1a into main Jul 24, 2024
14 of 15 checks passed
@kariy kariy deleted the katana/starknet-api-trait-rename branch July 24, 2024 16:10
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