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

chore: use version sensitive deps from katana-cairo + some unused deps clean up #2163

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

kariy
Copy link
Member

@kariy kariy commented Jul 8, 2024

Summary by CodeRabbit

  • New Features

    • Improved dependency management and configuration.
  • Bug Fixes

    • Enhanced error messages for better clarity in specific error cases.
  • Refactor

    • Updated import paths and namespaces for improved code organization and maintainability.
  • Chores

    • Added warnings for unused crate dependencies to help maintain a clean codebase.

Copy link

coderabbitai bot commented Jul 8, 2024

Walkthrough

The recent changes across the katana and saya crates involve dependency updates, particularly focusing on the starknet_api and cfg-if dependencies. Dependencies have been made more optional, import paths were updated, and attributes for warning about unused crate dependencies were introduced. Adjustments also streamlined the starknet_api integration by transitioning it to katana_cairo.

Changes

Files/Modules Change Summaries
bin/katana/Cargo.toml Removed cfg-if dependency and starknet_api workspace; adjusted dependencies configuration.
bin/katana/src/main.rs, crates/katana/core/src/lib.rs, crates/katana/executor/src/lib.rs, crates/katana/primitives/src/lib.rs, crates/katana/rpc/rpc/src/lib.rs, crates/saya/core/src/lib.rs Added #[cfg_attr(not(test), warn(unused_crate_dependencies))] to warn about unused crate dependencies.
bin/sozo/src/commands/mod.rs Updated description in Commands enum for Migrate variant.
crates/benches/Cargo.toml Commented out the line katana-core = { path = "../katana/core" }.
crates/katana/cairo/Cargo.toml Added starknet_api = "0.11.0" to dependencies.
crates/katana/cairo/src/lib.rs Updated pub use statement to include starknet_api.
crates/katana/core/Cargo.toml, crates/katana/executor/Cargo.toml, crates/katana/primitives/Cargo.toml, crates/katana/rpc/rpc/Cargo.toml Made several dependencies optional, updated and replaced some dependencies; adjusted features and dev-dependencies.
crates/katana/executor/src/implementation/blockifier/... Updated import paths from starknet_api to katana_cairo.
crates/katana/primitives/src/... Updated type paths for DeprecatedCompiledClass and other entities from starknet_api to katana_cairo.
crates/katana/storage/db/Cargo.toml, crates/saya/core/Cargo.toml, crates/saya/provider/Cargo.toml Added/removed various dependencies; notably handling katana-cairo, and integrating dojo-world with specific features.
crates/katana/storage/provider/src/error.rs Formatted the error message string for ProviderError::MissingContractNonceChangeEntry.

Poem

Amidst the crates and cargo, dependencies shift and flow,
The starknet_api now in katana_cairo's glow.
A rabbit hops, in code it dives,
Adjusting paths, where new imports thrive.
With optional traits and warnings bright,
Our project’s future feels so light.
Hop, hop, code, and cheer — improvements hold us near!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 Configration 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

@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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7c09e4a and 5e0b269.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (25)
  • bin/katana/Cargo.toml (2 hunks)
  • bin/katana/src/main.rs (1 hunks)
  • bin/sozo/src/commands/mod.rs (1 hunks)
  • crates/benches/Cargo.toml (1 hunks)
  • crates/katana/cairo/Cargo.toml (1 hunks)
  • crates/katana/cairo/src/lib.rs (1 hunks)
  • crates/katana/core/Cargo.toml (3 hunks)
  • crates/katana/core/src/lib.rs (1 hunks)
  • crates/katana/executor/Cargo.toml (3 hunks)
  • crates/katana/executor/src/implementation/blockifier/mod.rs (1 hunks)
  • crates/katana/executor/src/implementation/blockifier/state.rs (9 hunks)
  • crates/katana/executor/src/implementation/blockifier/utils.rs (7 hunks)
  • crates/katana/executor/src/lib.rs (1 hunks)
  • crates/katana/primitives/Cargo.toml (1 hunks)
  • crates/katana/primitives/src/class.rs (1 hunks)
  • crates/katana/primitives/src/conversion/rpc.rs (3 hunks)
  • crates/katana/primitives/src/lib.rs (1 hunks)
  • crates/katana/rpc/rpc/Cargo.toml (2 hunks)
  • crates/katana/rpc/rpc/src/lib.rs (1 hunks)
  • crates/katana/rpc/rpc/tests/common/mod.rs (1 hunks)
  • crates/katana/storage/db/Cargo.toml (3 hunks)
  • crates/katana/storage/provider/src/error.rs (1 hunks)
  • crates/saya/core/Cargo.toml (2 hunks)
  • crates/saya/core/src/lib.rs (1 hunks)
  • crates/saya/provider/Cargo.toml (1 hunks)
Files skipped from review due to trivial changes (14)
  • bin/katana/Cargo.toml
  • bin/katana/src/main.rs
  • bin/sozo/src/commands/mod.rs
  • crates/benches/Cargo.toml
  • crates/katana/cairo/Cargo.toml
  • crates/katana/core/src/lib.rs
  • crates/katana/primitives/Cargo.toml
  • crates/katana/primitives/src/lib.rs
  • crates/katana/rpc/rpc/src/lib.rs
  • crates/katana/rpc/rpc/tests/common/mod.rs
  • crates/katana/storage/provider/src/error.rs
  • crates/saya/core/Cargo.toml
  • crates/saya/core/src/lib.rs
  • crates/saya/provider/Cargo.toml
Additional comments not posted (32)
crates/katana/executor/src/lib.rs (2)

1-1: Add a warning attribute for unused crate dependencies.

The #![cfg_attr(not(test), warn(unused_crate_dependencies))] attribute is a good addition to help identify and clean up unused dependencies, improving code quality and maintainability.


2-2: Make the implementation module public.

Making the implementation module public increases its visibility and usability across the codebase.

crates/katana/cairo/src/lib.rs (2)

Line range hint 1-1: Add a warning attribute for unused crate dependencies.

The #![warn(unused_crate_dependencies)] attribute is a good addition to help identify and clean up unused dependencies, improving code quality and maintainability.


13-13: Re-export Cairo language crates.

Re-exporting the Cairo language crates enhances modularity and reusability, making it easier to manage dependencies and use these crates throughout the codebase.

crates/katana/storage/db/Cargo.toml (2)

10-10: Add katana-cairo as a dependency.

Adding katana-cairo as a dependency aligns with the namespace updates and ensures consistency across the codebase.


37-37: Comment out cairo-lang-starknet.

Commenting out cairo-lang-starknet likely indicates a transition or cleanup. Ensure that this dependency is no longer needed before permanently removing it.

crates/katana/rpc/rpc/Cargo.toml (5)

10-10: Add anyhow as a dependency.

Adding anyhow as a dependency is beneficial for error handling, providing a flexible and user-friendly way to manage errors.


12-12: Add futures as a dependency.

Adding futures as a dependency is essential for handling asynchronous operations, which are crucial for the functionality of the katana-rpc crate.


13-13: Add hyper as a dependency.

Adding hyper as a dependency is necessary for HTTP handling, enabling the katana-rpc crate to manage HTTP requests and responses efficiently.


14-14: Add jsonrpsee as a dependency.

Adding jsonrpsee as a dependency is important for JSON-RPC communication, which is a core feature of the katana-rpc crate.


37-37: Add katana-cairo as a dependency.

Adding katana-cairo as a dependency aligns with the namespace updates and ensures consistency across the codebase.

crates/katana/primitives/src/class.rs (1)

16-17: Ensure correct usage of the new type alias.

The new type alias DeprecatedCompiledClass is defined correctly. Ensure that it is used consistently across the codebase.

crates/katana/executor/Cargo.toml (3)

15-15: Dependency addition verification.

The addition of starknet as an optional dependency seems correct. Ensure that it is necessary and used correctly in the codebase.


30-30: Dev dependency addition verification.

The addition of alloy-primitives as a dev dependency seems correct. Ensure that it is necessary and used correctly in the test code.


45-45: Feature update verification.

The update to the features section seems correct. Ensure that the blockifier feature is used correctly in the codebase.

crates/katana/core/Cargo.toml (3)

17-17: Dependency update verification.

The update to make async-trait optional seems correct. Ensure that the optional dependency is handled correctly in the codebase.


26-28: Dependency update verification.

The updates to make reqwest, serde, and serde_json optional seem correct. Ensure that these optional dependencies are handled correctly in the codebase.


57-60: Feature update verification.

The update to the features section seems correct. Ensure that the optional dependencies are handled correctly in the codebase.

crates/katana/executor/src/implementation/blockifier/mod.rs (1)

11-11: Namespace update verification.

The update to the import paths for starknet_api seems correct. Ensure that the new paths are correct and used consistently across the codebase.

crates/katana/primitives/src/conversion/rpc.rs (2)

205-205: Namespace Update: Verify Correctness

The parameter type for compress_legacy_program_data has been updated to katana_cairo::starknet_api::deprecated_contract_class::Program. Ensure that the new type is correct and consistent with the rest of the codebase.

Verification successful

Namespace Update: Verified Correctness

The parameter type for compress_legacy_program_data has been correctly updated to katana_cairo::starknet_api::deprecated_contract_class::Program. The function implementation and its usage are consistent with the new type.

  • crates/katana/primitives/src/conversion/rpc.rs: Line 205
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new parameter type.

# Test: Search for the function definition and usage. Expect: The type should be valid and consistent.
rg --type rust 'fn compress_legacy_program_data' --files-with-matches

Length of output: 118


Script:

#!/bin/bash
# Description: Extract the definition and usage of the `compress_legacy_program_data` function for verification.

# Extract the function definition
rg --type rust 'fn compress_legacy_program_data' crates/katana/primitives/src/conversion/rpc.rs

# Extract the lines where the function is used
rg 'compress_legacy_program_data' crates/katana/primitives/src/conversion/rpc.rs

Length of output: 506


Script:

#!/bin/bash
# Description: Extract the full implementation of the `compress_legacy_program_data` function and its usage context.

# Extract the full implementation of the function
rg --context 10 'fn compress_legacy_program_data' crates/katana/primitives/src/conversion/rpc.rs

Length of output: 991


7-9: Namespace Update: Verify Correctness

The import paths have been updated from starknet_api to katana_cairo::starknet_api. Ensure that the new paths are correct and consistent with the rest of the codebase.

Verification successful

Namespace Update Verified: Correctness Confirmed

The import paths have been updated from starknet_api to katana_cairo::starknet_api. The re-export of starknet_api in katana_cairo/src/lib.rs confirms that the new paths are valid and correctly referenced.

  • crates/katana/primitives/src/conversion/rpc.rs
  • crates/katana/executor/src/implementation/blockifier/utils.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new import paths.

# Test: Search for the new import paths. Expect: The paths should be valid and consistent.
rg --type rust 'use katana_cairo::starknet_api::deprecated_contract_class::' --files-with-matches

Length of output: 208


Script:

#!/bin/bash
# Description: Verify the existence of the starknet_api module in the katana_cairo crate.

# Test: Search for the definition of the starknet_api module in the katana_cairo crate.
rg --type rust 'mod starknet_api' --files-with-matches

Length of output: 56


Script:

#!/bin/bash
# Description: Verify the existence and references of the starknet_api module in the katana_cairo crate.

# Test: Search for any references to starknet_api within the katana_cairo crate.
rg --type rust 'starknet_api' --files-with-matches

Length of output: 400


Script:

#!/bin/bash
# Description: Display the contents of crates/katana/cairo/src/lib.rs to verify the definition or re-export of starknet_api.

# Display the contents of lib.rs
cat crates/katana/cairo/src/lib.rs

Length of output: 430

crates/katana/executor/src/implementation/blockifier/state.rs (5)

72-73: Namespace Update: Verify Correctness

The parameter type for get_nonce_at has been updated to katana_cairo::starknet_api::core::ContractAddress. Ensure that the new type is correct and consistent with the rest of the codebase.

Verification successful

Namespace Update: Verified

The parameter type for get_nonce_at has been updated to katana_cairo::starknet_api::core::ContractAddress and is consistently used throughout the blockifier state implementation. The change is correct and valid.

  • crates/katana/executor/src/implementation/blockifier/state.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new parameter type.

# Test: Search for the function definition and usage. Expect: The type should be valid and consistent.
rg --type rust 'fn get_nonce_at' --files-with-matches

Length of output: 172


Script:

#!/bin/bash
# Extract the function definitions and their usages in the identified files

# Extract function definitions
rg --type rust 'fn get_nonce_at' crates/katana/executor/src/implementation/sir/state.rs
rg --type rust 'fn get_nonce_at' crates/katana/executor/src/implementation/blockifier/state.rs

# Extract usages of the function
rg 'get_nonce_at' crates/katana/executor/src/implementation/sir/
rg 'get_nonce_at' crates/katana/executor/src/implementation/blockifier/

Length of output: 2007


Script:

#!/bin/bash
# Fully extract the function definitions in the blockifier state file
rg --context 5 'fn get_nonce_at' crates/katana/executor/src/implementation/blockifier/state.rs

# Verify the usage of the katana_cairo::starknet_api::core::ContractAddress type
rg 'katana_cairo::starknet_api::core::ContractAddress' crates/katana/executor/src/implementation/blockifier/

Length of output: 1782


Line range hint 218-245:
Namespace Update: Verify Correctness

The parameter types for get_class_hash_at, get_compiled_class_hash, get_nonce_at, and get_storage_at have been updated to katana_cairo::starknet_api::core::ContractAddress, katana_cairo::starknet_api::core::ClassHash, katana_cairo::starknet_api::core::Nonce, and katana_cairo::starknet_api::state::StorageKey respectively. Ensure that the new types are correct and consistent with the rest of the codebase.

Verification successful

Namespace Update: Verified

The parameter types for get_class_hash_at, get_compiled_class_hash, get_nonce_at, and get_storage_at have been correctly updated to use the new types from katana_cairo::starknet_api. The changes are consistent and correctly implemented across the codebase.

  • get_class_hash_at: Updated to katana_cairo::starknet_api::core::ContractAddress
  • get_compiled_class_hash: Updated to katana_cairo::starknet_api::core::ClassHash
  • get_nonce_at: Updated to katana_cairo::starknet_api::core::ContractAddress
  • get_storage_at: Updated to katana_cairo::starknet_api::core::ContractAddress and katana_cairo::starknet_api::state::StorageKey
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new parameter types.

# Test: Search for the function definitions and usage. Expect: The types should be valid and consistent.
rg --type rust 'fn get_class_hash_at' --files-with-matches
rg --type rust 'fn get_compiled_class_hash' --files-with-matches
rg --type rust 'fn get_nonce_at' --files-with-matches
rg --type rust 'fn get_storage_at' --files-with-matches

Length of output: 912


Script:

#!/bin/bash
# Description: Extract function definitions to verify parameter types.

# Extract function definitions for `get_class_hash_at`
rg --type rust --pcre2 --context 5 'fn get_class_hash_at' crates/katana/storage/provider/src/providers/fork/backend.rs
rg --type rust --pcre2 --context 5 'fn get_class_hash_at' crates/katana/executor/src/implementation/sir/state.rs
rg --type rust --pcre2 --context 5 'fn get_class_hash_at' crates/katana/executor/src/implementation/blockifier/state.rs

# Extract function definitions for `get_compiled_class_hash`
rg --type rust --pcre2 --context 5 'fn get_compiled_class_hash' crates/katana/storage/provider/src/providers/fork/backend.rs
rg --type rust --pcre2 --context 5 'fn get_compiled_class_hash' crates/katana/rpc/rpc/tests/common/mod.rs
rg --type rust --pcre2 --context 5 'fn get_compiled_class_hash' crates/katana/executor/src/implementation/blockifier/state.rs
rg --type rust --pcre2 --context 5 'fn get_compiled_class_hash' crates/katana/executor/src/implementation/sir/state.rs
rg --type rust --pcre2 --context 5 'fn get_compiled_class_hash' crates/dojo-world/src/migration/mod.rs

# Extract function definitions for `get_nonce_at`
rg --type rust --pcre2 --context 5 'fn get_nonce_at' crates/katana/executor/src/implementation/sir/state.rs
rg --type rust --pcre2 --context 5 'fn get_nonce_at' crates/katana/executor/src/implementation/blockifier/state.rs

# Extract function definitions for `get_storage_at`
rg --type rust --pcre2 --context 5 'fn get_storage_at' crates/katana/executor/src/implementation/sir/state.rs
rg --type rust --pcre2 --context 5 'fn get_storage_at' crates/katana/executor/src/implementation/blockifier/state.rs

Length of output: 10086


82-84: Namespace Update: Verify Correctness

The parameter types for get_storage_at have been updated to katana_cairo::starknet_api::core::ContractAddress and katana_cairo::starknet_api::state::StorageKey. Ensure that the new types are correct and consistent with the rest of the codebase.

Verification successful

Namespace Update: Verify Correctness

The parameter types for get_storage_at have been updated to katana_cairo::starknet_api::core::ContractAddress and katana_cairo::starknet_api::state::StorageKey in crates/katana/executor/src/implementation/blockifier/state.rs. These types are used consistently within the file. Ensure that the new types are correct and consistent with the rest of the codebase.

  • crates/katana/executor/src/implementation/blockifier/state.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new parameter types.

# Test: Search for the function definition and usage. Expect: The types should be valid and consistent.
rg --type rust 'fn get_storage_at' --files-with-matches

Length of output: 174


Script:

#!/bin/bash
# Extract the definition and all usages of `get_storage_at` from the identified files.

# Extract the definition of `get_storage_at` from both files.
echo "Definitions:"
rg --type rust 'fn get_storage_at' crates/katana/executor/src/implementation/sir/state.rs
rg --type rust 'fn get_storage_at' crates/katana/executor/src/implementation/blockifier/state.rs

# Extract all usages of `get_storage_at` from both files.
echo "Usages in crates/katana/executor/src/implementation/sir/state.rs:"
rg --type rust 'get_storage_at' crates/katana/executor/src/implementation/sir/state.rs

echo "Usages in crates/katana/executor/src/implementation/blockifier/state.rs:"
rg --type rust 'get_storage_at' crates/katana/executor/src/implementation/blockifier/state.rs

Length of output: 1908


Script:

#!/bin/bash
# Verify the usage of the new parameter types in the codebase.

# Search for the usage of `katana_cairo::starknet_api::core::ContractAddress`.
echo "Usages of ContractAddress:"
rg --type rust 'katana_cairo::starknet_api::core::ContractAddress'

# Search for the usage of `katana_cairo::starknet_api::state::StorageKey`.
echo "Usages of StorageKey:"
rg --type rust 'katana_cairo::starknet_api::state::StorageKey'

Length of output: 1314


39-40: Namespace Update: Verify Correctness

The parameter type for get_compiled_class_hash has been updated to katana_cairo::starknet_api::core::ClassHash. Ensure that the new type is correct and consistent with the rest of the codebase.

Verification successful

Namespace Update: Verified

The parameter type for get_compiled_class_hash has been updated to katana_cairo::starknet_api::core::ClassHash in crates/katana/executor/src/implementation/blockifier/state.rs. This change is consistent with the updated namespace and correct within the context of this file.

  • crates/katana/executor/src/implementation/blockifier/state.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new parameter type.

# Test: Search for the function definition and usage. Expect: The type should be valid and consistent.
rg --type rust 'fn get_compiled_class_hash' --files-with-matches

Length of output: 325


Script:

#!/bin/bash
# Description: Verify the parameter type for `get_compiled_class_hash` function.

# Search for the function definition and its parameter type in the identified files.
files=(
  "crates/katana/storage/provider/src/providers/fork/backend.rs"
  "crates/katana/rpc/rpc/tests/common/mod.rs"
  "crates/katana/executor/src/implementation/sir/state.rs"
  "crates/katana/executor/src/implementation/blockifier/state.rs"
  "crates/dojo-world/src/migration/mod.rs"
)

for file in "${files[@]}"; do
  echo "File: $file"
  rg --type rust 'fn get_compiled_class_hash' "$file"
  echo "--------------------------------"
done

Length of output: 2268


Script:

#!/bin/bash
# Description: Verify the complete parameter type for `get_compiled_class_hash` function in specific files.

# Search for the complete function definition in the identified files.
files=(
  "crates/katana/storage/provider/src/providers/fork/backend.rs"
  "crates/katana/executor/src/implementation/sir/state.rs"
  "crates/katana/executor/src/implementation/blockifier/state.rs"
)

for file in "${files[@]}"; do
  echo "File: $file"
  rg --type rust 'fn get_compiled_class_hash' -A 5 "$file"
  echo "--------------------------------"
done

Length of output: 2502


7-8: Namespace Update: Verify Correctness

The import paths have been updated from starknet_api to katana_cairo::starknet_api. Ensure that the new paths are correct and consistent with the rest of the codebase.

crates/katana/executor/src/implementation/blockifier/utils.rs (6)

565-567: Namespace Update: Verify Correctness

The parameter type for starknet_api_ethaddr_to_felt has been updated to katana_cairo::starknet_api::core::EthAddress. Ensure that the new type is correct and consistent with the rest of the codebase.

Verification successful

Namespace Update: Verified Correctness

The parameter type for starknet_api_ethaddr_to_felt has been updated to katana_cairo::starknet_api::core::EthAddress. This type is valid and consistently used across the codebase, confirming the correctness of the update.

  • crates/katana/executor/src/implementation/blockifier/utils.rs (function definition)
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new parameter type.

# Test: Search for the function definition and usage. Expect: The type should be valid and consistent.
rg --type rust 'fn starknet_api_ethaddr_to_felt' --files-with-matches

Length of output: 133


Script:

#!/bin/bash
# Description: Verify the definition and usage of the new parameter type `katana_cairo::starknet_api::core::EthAddress`.

# Search for the definition of `EthAddress` in the codebase.
rg --type rust 'struct EthAddress' 

# Search for the usage of `EthAddress` in the codebase.
rg --type rust 'EthAddress'

Length of output: 1119


Script:

#!/bin/bash
# Description: Locate the exact definition of `EthAddress` to verify its validity.

# Search for the definition of `EthAddress` in the codebase, including type aliases and imports.
rg --type rust 'EthAddress' --context 10

Length of output: 15767


210-223: Namespace Update: Verify Correctness

The parameter type for to_executor_tx has been updated to katana_cairo::starknet_api::transaction::InvokeTransactionV3. Ensure that the new type is correct and consistent with the rest of the codebase.

Verification successful

Verified: Parameter Type Update is Correct

The parameter type for to_executor_tx has been updated to katana_cairo::starknet_api::transaction::InvokeTransactionV3 and is correctly integrated into the function implementation.

  • crates/katana/executor/src/implementation/blockifier/utils.rs: The function to_executor_tx correctly uses katana_cairo::starknet_api::transaction::InvokeTransactionV3 within the InvokeTx::V3 match arm.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new parameter type.

# Test: Search for the function definition and usage. Expect: The type should be valid and consistent.
rg --type rust 'fn to_executor_tx' --files-with-matches

Length of output: 174


Script:

#!/bin/bash
# Extract the function definition for `to_executor_tx` from the identified files.

# Extract from crates/katana/executor/src/implementation/sir/utils.rs
echo "Function definition in crates/katana/executor/src/implementation/sir/utils.rs:"
rg --type rust 'fn to_executor_tx' -A 10 crates/katana/executor/src/implementation/sir/utils.rs

# Extract from crates/katana/executor/src/implementation/blockifier/utils.rs
echo "Function definition in crates/katana/executor/src/implementation/blockifier/utils.rs:"
rg --type rust 'fn to_executor_tx' -A 10 crates/katana/executor/src/implementation/blockifier/utils.rs

Length of output: 1622


Script:

#!/bin/bash
# Extract the complete function implementation for `to_executor_tx` from `crates/katana/executor/src/implementation/blockifier/utils.rs`.

# Extract the complete function implementation
rg --type rust 'fn to_executor_tx' -A 50 crates/katana/executor/src/implementation/blockifier/utils.rs

Length of output: 2961


31-45: Namespace Update: Verify Correctness

The import paths have been updated from starknet_api to katana_cairo::starknet_api. Ensure that the new paths are correct and consistent with the rest of the codebase.

Verification successful

Namespace Update: Verified Correctness

The import paths have been updated from starknet_api to katana_cairo::starknet_api. The new paths are correct and consistent with the rest of the codebase.

  • crates/katana/executor/src/implementation/blockifier/utils.rs
  • crates/katana/executor/src/implementation/blockifier/mod.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new import paths.

# Test: Search for the new import paths. Expect: The paths should be valid and consistent.
rg --type rust 'use katana_cairo::starknet_api::block::' --files-with-matches

Length of output: 201


Script:

#!/bin/bash
# Description: Verify the existence and structure of the `starknet_api` module within the `katana_cairo` crate.

# Test: Search for the definition of the `starknet_api` module in the `katana_cairo` crate.
rg --type rust 'mod starknet_api' --files-with-matches

Length of output: 56


Script:

#!/bin/bash
# Description: Verify the structure of the `katana_cairo` crate and the presence of the `starknet_api` module.

# Step 1: Search for the main module files (`lib.rs` or `mod.rs`) of the `katana_cairo` crate.
fd --type f --name lib.rs
fd --type f --name mod.rs

# Step 2: Inspect the contents of the main module files for the `starknet_api` module.
fd --type f --name lib.rs --exec rg 'starknet_api'
fd --type f --name mod.rs --exec rg 'starknet_api'

Length of output: 1161


Script:

#!/bin/bash
# Description: Verify the structure of the `katana_cairo` crate and the presence of the `starknet_api` module.

# Step 1: Search for the main module files (`lib.rs` or `mod.rs`) of the `katana_cairo` crate.
fd lib.rs
fd mod.rs

# Step 2: Inspect the contents of the main module files for the `starknet_api` module.
fd lib.rs --exec rg 'starknet_api' {}
fd mod.rs --exec rg 'starknet_api' {}

Length of output: 4161


185-193: Namespace Update: Verify Correctness

The parameter type for to_executor_tx has been updated to katana_cairo::starknet_api::transaction::InvokeTransactionV1. Ensure that the new type is correct and consistent with the rest of the codebase.

Verification successful

Namespace Update: Verified Correctness

The parameter type for to_executor_tx has been updated to katana_cairo::starknet_api::transaction::InvokeTransactionV1. The new type is correct and consistent with the rest of the codebase.

  • The InvokeTx::V1 variant within ExecutableTxWithHash correctly maps to InvokeTxV1.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new parameter type.

# Test: Search for the function definition and usage. Expect: The type should be valid and consistent.
rg --type rust 'fn to_executor_tx' --files-with-matches

Length of output: 174


Script:

#!/bin/bash
# Extract the function definitions of `to_executor_tx` in both files.
rg --type rust 'fn to_executor_tx' crates/katana/executor/src/implementation/sir/utils.rs
rg --type rust 'fn to_executor_tx' crates/katana/executor/src/implementation/blockifier/utils.rs

# Extract the usages of `to_executor_tx` in both files.
rg --type rust 'to_executor_tx' crates/katana/executor/src/implementation/sir/utils.rs
rg --type rust 'to_executor_tx' crates/katana/executor/src/implementation/blockifier/utils.rs

Length of output: 677


Script:

#!/bin/bash
# Extract the complete function definitions and their usages of `to_executor_tx` in both files.

# Extract the function definition and its surrounding lines in `crates/katana/executor/src/implementation/sir/utils.rs`
rg --type rust -A 10 -B 2 'fn to_executor_tx' crates/katana/executor/src/implementation/sir/utils.rs

# Extract the function definition and its surrounding lines in `crates/katana/executor/src/implementation/blockifier/utils.rs`
rg --type rust -A 10 -B 2 'fn to_executor_tx' crates/katana/executor/src/implementation/blockifier/utils.rs

# Extract the usages of `to_executor_tx` in `crates/katana/executor/src/implementation/sir/utils.rs`
rg --type rust -A 2 -B 2 'to_executor_tx' crates/katana/executor/src/implementation/sir/utils.rs

# Extract the usages of `to_executor_tx` in `crates/katana/executor/src/implementation/blockifier/utils.rs`
rg --type rust -A 2 -B 2 'to_executor_tx' crates/katana/executor/src/implementation/blockifier/utils.rs

Length of output: 1994


Script:

#!/bin/bash
# Verify the definition of `ExecutableTxWithHash` and its relation to `InvokeTransactionV1`.

# Search for the definition of `ExecutableTxWithHash`.
rg --type rust 'struct ExecutableTxWithHash' -A 10

# Search for the definition of `InvokeTx::V1`.
rg --type rust 'enum InvokeTx' -A 10

Length of output: 1670


353-353: Namespace Update: Verify Correctness

The parameter type for to_executor_tx has been updated to katana_cairo::starknet_api::transaction::L1HandlerTransaction. Ensure that the new type is correct and consistent with the rest of the codebase.

Verification successful

Namespace Update: Verified Correctness

The parameter type for to_executor_tx has been updated to katana_cairo::starknet_api::transaction::L1HandlerTransaction. This update is correct and consistent with the rest of the codebase, as ExecutableTxWithHash can encapsulate an L1HandlerTransaction.

  • crates/katana/executor/src/implementation/blockifier/utils.rs
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new parameter type.

# Test: Search for the function definition and usage. Expect: The type should be valid and consistent.
rg --type rust 'fn to_executor_tx' --files-with-matches

Length of output: 174


Script:

#!/bin/bash
# Extract the definition and usages of the `to_executor_tx` function in the specified files.

# Extract the function definition and its surrounding context from both files.
rg --type rust -A 10 -B 10 'fn to_executor_tx' crates/katana/executor/src/implementation/sir/utils.rs
rg --type rust -A 10 -B 10 'fn to_executor_tx' crates/katana/executor/src/implementation/blockifier/utils.rs

# Extract the usages of the `to_executor_tx` function in the codebase.
rg --type rust 'to_executor_tx' crates/katana/executor/src/implementation/sir/utils.rs
rg --type rust 'to_executor_tx' crates/katana/executor/src/implementation/blockifier/utils.rs

Length of output: 2141


Script:

#!/bin/bash
# Verify the definition and usage of `ExecutableTxWithHash` in the codebase to ensure it aligns with `katana_cairo::starknet_api::transaction::L1HandlerTransaction`.

# Search for the definition of `ExecutableTxWithHash`.
rg --type rust 'struct ExecutableTxWithHash' -A 10 -B 10

# Search for the usage of `ExecutableTxWithHash` in the codebase.
rg --type rust 'ExecutableTxWithHash'

Length of output: 10460


Script:

#!/bin/bash
# Verify the definition and usage of `ExecutableTx` in the codebase to ensure it aligns with `katana_cairo::starknet_api::transaction::L1HandlerTransaction`.

# Search for the definition of `ExecutableTx`.
rg --type rust 'enum ExecutableTx' -A 10 -B 10

# Search for the usage of `ExecutableTx` in the codebase.
rg --type rust 'ExecutableTx'

Length of output: 14023


682-685: Namespace Update: Verify Correctness

The import paths in the test module have been updated from starknet_api to katana_cairo::starknet_api. Ensure that the new paths are correct and consistent with the rest of the codebase.

Comment on lines +29 to +30
contract_address: katana_cairo::starknet_api::core::ContractAddress,
) -> StateResult<katana_cairo::starknet_api::core::ClassHash> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

Namespace Update: Verify Correctness

The parameter type for get_class_hash_at is inconsistent across different files. While state.rs and backend.rs use katana_cairo::starknet_api::core::ContractAddress, sir/state.rs uses &Address. Please verify and update the parameter type in sir/state.rs to ensure uniformity and correctness.

  • crates/katana/executor/src/implementation/blockifier/state.rs
  • crates/katana/executor/src/implementation/sir/state.rs
  • crates/katana/storage/provider/src/providers/fork/backend.rs
Analysis chain

Namespace Update: Verify Correctness

The parameter type for get_class_hash_at has been updated to katana_cairo::starknet_api::core::ContractAddress. Ensure that the new type is correct and consistent with the rest of the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of the new parameter type.

# Test: Search for the function definition and usage. Expect: The type should be valid and consistent.
rg --type rust 'fn get_class_hash_at' --files-with-matches

Length of output: 238


Script:

#!/bin/bash
# Description: Extract function definitions and usages for `get_class_hash_at` to verify parameter type consistency.

# Search for the function definition in the identified files.
rg --type rust 'fn get_class_hash_at' crates/katana/executor/src/implementation/blockifier/state.rs
rg --type rust 'fn get_class_hash_at' crates/katana/executor/src/implementation/sir/state.rs
rg --type rust 'fn get_class_hash_at' crates/katana/storage/provider/src/providers/fork/backend.rs

# Search for the usages of the function in the identified files.
rg --type rust 'get_class_hash_at' crates/katana/executor/src/implementation/blockifier/state.rs
rg --type rust 'get_class_hash_at' crates/katana/executor/src/implementation/sir/state.rs
rg --type rust 'get_class_hash_at' crates/katana/storage/provider/src/providers/fork/backend.rs

Length of output: 2106

Copy link

codecov bot commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 53.48837% with 20 lines in your changes missing coverage. Please review.

Project coverage is 67.99%. Comparing base (7c09e4a) to head (68a2655).

Files Patch % Lines
...na/executor/src/implementation/blockifier/utils.rs 31.03% 20 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2163   +/-   ##
=======================================
  Coverage   67.99%   67.99%           
=======================================
  Files         331      331           
  Lines       42679    42686    +7     
=======================================
+ Hits        29021    29026    +5     
- Misses      13658    13660    +2     

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

@kariy kariy merged commit 94ab39c into main Jul 8, 2024
14 of 15 checks passed
@kariy kariy deleted the version-separation-test branch July 8, 2024 21:05
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