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

read_provider_test migrate to devnet #384

Merged

Conversation

tonypony220
Copy link
Contributor

@tonypony220 tonypony220 commented Jun 19, 2024

  • updated read_provider_test to match 0.0.7 devnet
  • fixed devnet starting command
  • cleaned up melos commands
  • adding devnet error to facilitate debugging
  • some tests are waiting new release (0.0.8) of devnet and marked as FIXME in code

0xSpaceShard/starknet-devnet#498
0xSpaceShard/starknet-devnet#496
0xSpaceShard/starknet-devnet#544

resolves #347 and maybe #371

estimated time: 4 days

Summary by CodeRabbit

  • New Features

    • Introduced sum method in smart contract for calculating the sum of two values.
    • Added new commands for melos to support smart contract transactions.
  • Enhancements

    • Updated environment variables with new contract addresses for better deployment.
    • Improved error handling with new error codes in JSON-RPC.
  • Bug Fixes

    • Modified test data values for accuracy in integration tests.
  • Documentation

    • Added JSON configuration for deployment details.
  • Style

    • Streamlined enum declaration for TokenSymbol.
  • Chores

    • Updated starknet-devnet to version 0.0.7 across various files.
    • Added .starkli/account_1.json to .gitignore.

Copy link
Contributor

coderabbitai bot commented Jun 19, 2024

Walkthrough

This update enhances the codebase with significant improvements, including version upgrades for starknet-devnet, modifications to environment variables, and the introduction of new methods and classes. Notable additions are simulation flags and refined error handling. Testing files have been updated for consistency with the new values. These changes collectively aim to improve the overall functionality and maintainability of the project.

Changes

Files/Groups Change Summaries
.env.devnet, .tool-versions Updated starknet-devnet version to 0.0.7 and modified environment variables for hashes and addresses.
.gitignore, .starkli/account_for_devnet_setup.json, .github/workflows/ci.yaml Added exclusion patterns and adjusted CI workflow to account for new configurations and flags.
contracts/v2.6.2/src/hello.cairo Introduced a sum method to the IHello trait and its implementation in the hello module.
melos.yaml, melos_monorepo.iml Updated devnet commands and made minor adjustments to the .iml file.
packages/starknet_.../lib/src/account.dart, packages/starknet_.../lib/src/model/estimate_fee.dart Added simulation_flags field and SimulationFlag enum to the EstimateFeeRequest class.
packages/starknet_provider/...estimate_fee.freezed.dart, ...estimate_fee.g.dart Implemented SimulationFlag and updated JSON serialization methods.
packages/starknet_provider/...get_transaction_receipt.dart, ...get_transaction_receipt.g.dart Introduced ActualFee class and updated TxnReceipt structure to use it for JSON serialization.
packages/starknet_provider/...json_rpc_api_error.dart, ...json_rpc_api_error.g.dart Added DEVNET_WILDCARD_ERROR and METHOD_NOT_FOUND error codes to the JsonRpcApiErrorCode enum.
packages/starknet_provider/test/integration/read_provider_test.dart Updated hexadecimal values and adjusted test expectations.
packages/wallet_kit/lib/services/token_service.dart, .../wallet_screens/password_screen.dart Consolidated TokenSymbol enum and reindented the TextInput widget code block.

Poem

In the realm of code so bright,
Versions changed with pure delight,
Hashes danced and methods grew,
Simulation flags anew!
JSON sang in structured tunes,
With each change, the code attunes,
Hopping through the fields of bytes.

  • Your coding rabbit, in moonlit nights.

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

@tonypony220 tonypony220 force-pushed the read-provider-test-migrate-devnet branch from f035c99 to bcf249e Compare June 25, 2024 11:30
@tonypony220 tonypony220 marked this pull request as ready for review June 25, 2024 17:32
Copy link
Contributor

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

Outside diff range and nitpick comments (2)
melos.yaml (1)

59-59: Ensure the new --state-archive-capacity full flag is appropriate for your use case.

The addition of --state-archive-capacity full to both devnet:start and devnet:start:dump commands suggests that you are opting to retain a full state archive for the devnet. This can have implications on performance and storage, especially in continuous integration environments or when running multiple instances.

Also applies to: 60-60, 64-64

packages/starknet/lib/src/account.dart (1)

[!TIP]
Codebase Verification

Line range hint 18-33: Review error handling and fallback logic in getNonce.

The getNonce method in account.dart does not contain explicit error handling or fallback logic. This omission could lead to unhandled exceptions if the primary request fails.

  • File: packages/starknet/lib/src/account.dart
  • Lines: 186-192

Action Required:

  • Add proper error handling and fallback mechanisms to the getNonce method to ensure robustness.
Analysis chain

Line range hint 18-33: Review error handling and fallback logic in getNonce.

Ensure that the error handling and fallback logic in the getNonce method are robust and correctly implemented. The method uses a nested async call which should be carefully managed to avoid potential deadlocks or unhandled exceptions.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify correct implementation of error handling in `getNonce`.

# Test: Check for the presence of error handling code. Expect: Specific error handling patterns.
rg --type dart $'error: (' packages/starknet/lib/src/account.dart

Length of output: 133



Script:

#!/bin/bash
# Description: Verify correct implementation of error handling in `getNonce`.

# Test: Check for the presence of error handling code. Expect: Specific error handling patterns.
rg --type dart 'catch|on|try' packages/starknet/lib/src/account.dart

Length of output: 9685

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f442452 and 85009ab.

Files selected for processing (19)
  • .env.devnet (1 hunks)
  • .gitignore (1 hunks)
  • .starkli/account_for_devnet_setup.json (1 hunks)
  • .tool-versions (1 hunks)
  • contracts/v2.6.2/src/hello.cairo (2 hunks)
  • contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json (1 hunks)
  • melos.yaml (2 hunks)
  • melos_monorepo.iml (1 hunks)
  • packages/starknet/lib/src/account.dart (1 hunks)
  • packages/starknet_provider/.tool-versions (1 hunks)
  • packages/starknet_provider/lib/src/model/estimate_fee.dart (1 hunks)
  • packages/starknet_provider/lib/src/model/estimate_fee.freezed.dart (1 hunks)
  • packages/starknet_provider/lib/src/model/estimate_fee.g.dart (2 hunks)
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.dart (7 hunks)
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.freezed.dart (183 hunks)
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.g.dart (7 hunks)
  • packages/starknet_provider/lib/src/model/json_rpc_api_error.dart (2 hunks)
  • packages/starknet_provider/lib/src/model/json_rpc_api_error.g.dart (2 hunks)
  • packages/starknet_provider/test/integration/read_provider_test.dart (35 hunks)
Files not summarized due to errors (2)
  • contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json: Error: Message exceeds token limit
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.freezed.dart: Error: Message exceeds token limit
Files skipped from review due to trivial changes (4)
  • .gitignore
  • .tool-versions
  • melos_monorepo.iml
  • packages/starknet_provider/.tool-versions
Additional context used
Gitleaks
.starkli/account_for_devnet_setup.json

6-6: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)

.env.devnet

15-15: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)


16-16: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)

yamllint
melos.yaml

[error] 90-90: trailing spaces (trailing-spaces)


[error] 92-92: trailing spaces (trailing-spaces)

Additional comments not posted (34)
contracts/v2.6.2/src/hello.cairo (1)

5-5: New Method Addition: sum

The addition of the sum method to both the interface and the contract module is correctly implemented and follows the StarkNet Cairo programming conventions.

Also applies to: 30-32

packages/starknet_provider/lib/src/model/json_rpc_api_error.g.dart (1)

24-24: Updated Serialization for New Error Codes

The updates to include new error codes (DEVNET_WILDCARD_ERROR and METHOD_NOT_FOUND) in the serialization map are correctly implemented.

Also applies to: 54-54

packages/starknet_provider/lib/src/model/json_rpc_api_error.dart (1)

21-22: Addition of New Error Codes

The addition of new error codes (DEVNET_WILDCARD_ERROR and METHOD_NOT_FOUND) to the JsonRpcApiErrorCode enum is correctly annotated and follows Dart best practices.

Also applies to: 81-82

melos.yaml (1)

71-71: New melos contracts:invoke command added.

This addition aligns with the PR's aim to enhance smart contract interactions by providing a dedicated command for invoking transactions. This should streamline testing and deployment processes.

packages/starknet_provider/lib/src/model/estimate_fee.dart (2)

25-45: Added SimulationFlag enum and its JSON serialization.

The introduction of the SimulationFlag enum with options SKIP_VALIDATE and SKIP_FEE_CHARGE enhances the flexibility in simulating transactions. The JSON serialization methods are correctly implemented. Ensure that all potential uses of these flags are well-documented to avoid misuse.


52-56: Addition of simulation_flags to EstimateFeeRequest.

The simulation_flags field has been added to the EstimateFeeRequest class. This allows for more granular control over transaction fee estimation, which is particularly useful in development and testing environments where fee constraints might be simulated differently.
[APROVED]

packages/starknet_provider/lib/src/model/get_transaction_receipt.dart (2)

23-31: Introduced ActualFee class for detailed fee information.

The ActualFee class has been introduced to encapsulate fee details with amount and unit. This is a positive change as it provides more detailed information about transaction fees, which can be crucial for auditing and debugging.


38-38: Use of ActualFee in various transaction receipt models.

The integration of the ActualFee class across different transaction receipt models (like InvokeTxnReceipt, DeclareTxnReceipt, etc.) standardizes how fee information is presented and handled. This should improve the consistency and reliability of fee data across different transaction types.

Also applies to: 51-51, 64-64, 77-77, 91-91, 105-105, 116-116

packages/starknet_provider/lib/src/model/estimate_fee.g.dart (2)

15-17: Serialization and deserialization for simulation_flags.

The code correctly handles the serialization and deserialization of the simulation_flags field in the EstimateFeeRequest model. This ensures that the new simulation flags are correctly integrated into the JSON data flow.

Also applies to: 24-25


58-66: Added classes for SkipValidate and SkipFeeCharge.

The addition of _$$SkipValidateImpl and _$$SkipFeeChargeImpl classes for handling the serialization of the SkipValidate and SkipFeeCharge flags ensures that these flags are correctly serialized and deserialized. This is crucial for maintaining the integrity of data when these flags are used in API calls.

Also applies to: 68-76

packages/starknet_provider/lib/src/model/get_transaction_receipt.g.dart (1)

37-47: Proper handling of ActualFee in JSON serialization.

The changes to the serialization and deserialization methods ensure that the ActualFee class is correctly integrated into the transaction receipts. This is crucial for accurately conveying fee details in API responses.

Also applies to: 53-53, 87-87, 121-121, 155-155, 191-191, 227-227, 255-255

contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json (1)

1-1: Check alignment with PR objectives and AI-generated summary.

Ensure that the starknet_dart_hello.contract_class.json accurately reflects the updates mentioned in the PR objectives and AI-generated summary, particularly the addition of the sum method and any related changes.

Verification successful

The sum method has been successfully added to the contract class JSON.

  • The sum method is present in the user_func_names and abi sections of the JSON file.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the addition of the 'sum' method in the contract class JSON.

# Test: Search for 'sum' method in the JSON file. Expect: At least one occurrence.
rg --type json $'sum' contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json

Length of output: 16299

packages/starknet/lib/src/account.dart (3)

189-189: Ensure proper initialization of new fields.

The simulation_flags field is added to the EstimateFeeRequest. Ensure this field is properly initialized and used throughout the class where fee estimation occurs.


Line range hint 35-71: Review transaction signing and fee calculation in getEstimateMaxFeeForInvokeTx.

Ensure that the transaction signing process and fee calculation in the getEstimateMaxFeeForInvokeTx method are correctly implemented. Pay close attention to how different transaction versions are handled and how the fee is calculated based on the transaction details.


Line range hint 73-111: Review transaction execution logic in execute.

Ensure that the transaction execution logic in the execute method is robust and correctly handles different transaction versions. Check for proper error handling and the correct use of blockchain interaction patterns.

packages/starknet_provider/test/integration/read_provider_test.dart (10)

12-12: Update contract address to match new environment settings.

The contract address has been updated to 0x03cdc588f4f1bff66c8a6896e7008cc39c7804d36b16e93792625bd18bffd249 to align with the new devnet version 0.0.7 settings.


20-20: Update transaction hash to match new environment settings.

The transaction hash has been updated to 0x029583643cd8932f1955bf28bfebf4c907b13df1e5c2d202b133cfbf783697a2 to align with changes in the devnet environment.


26-26: Update transaction hash for deploy account transaction.

The deploy account transaction hash has been updated to 0x055ba13c33a12506d2eab8dfbc618a8ce0d247c24959a64ee18fbf393c873b83 to reflect changes in the devnet environment.


45-45: Update class hash to match new environment settings.

The class hash has been updated to 0x061dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f to reflect the new devnet settings.


47-47: Update contract address to match new environment settings.

The contract address has been updated to 0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691 to align with the new devnet version 0.0.7 settings.


65-65: Mark test as problematic due to devnet version change.

This test is marked with a FIXME comment due to issues caused by the bump in devnet version. It's important to monitor this and resolve it when the devnet issue is fixed.


119-119: Ensure correct function selector for get_name.

The entry point selector for the get_name function is correctly retrieved, ensuring that the test calls the intended function.


139-139: Update block ID for consistency and correctness.

The block ID is set to BlockId.latest, which is appropriate for this test as it ensures the function is called against the latest block state.


151-151: Correct handling of invalid block IDs.

This test correctly handles the scenario where an invalid block ID is used, expecting a BLOCK_NOT_FOUND error. This is a good practice in test coverage for error handling.


127-127: Check for correct test expectations.

The test expects the result to be Felt.fromInt(0), which should be verified against the expected behavior of the get_name function to ensure it aligns with the contract's logic.

packages/starknet_provider/lib/src/model/estimate_fee.freezed.dart (4)

418-431: Ensure proper error handling for JSON deserialization in SimulationFlag.

The default case in the switch statement throws a CheckedFromJsonException, which is good practice as it helps in identifying the exact cause of the error during the deserialization process. However, consider logging this exception or providing more context in the error message for easier debugging.


434-475: Review the implementation of mixin _$SimulationFlag.

The mixin uses a lot of boilerplate code generated by the Freezed library, which is typical for union types in Dart. The methods like when, maybeWhen, map, and maybeMap are used to handle different states of the union. This is a standard pattern and looks correct as per Freezed's implementation guidelines.


513-606: Check the JSON serialization implementation for SkipValidate.

The SkipValidate class is correctly annotated with @JsonSerializable which is essential for the code generation of serialization logic. The $type defaulting to 'skipValidate' ensures that the correct type discriminator is used in polymorphic serialization scenarios. This is crucial for maintaining the integrity of the JSON structure when dealing with different types of simulation flags.


634-727: Check the JSON serialization implementation for SkipFeeCharge.

Similar to SkipValidate, SkipFeeCharge is also annotated with @JsonSerializable and handles its type discriminator correctly. This consistency in handling serialization across different subclasses of SimulationFlag is good for maintaining a robust and error-resistant serialization/deserialization logic.

packages/starknet_provider/lib/src/model/get_transaction_receipt.freezed.dart (5)

433-435: Ensure proper JSON deserialization for ActualFee.

The method _$ActualFeeFromJson correctly delegates the JSON parsing to _ActualFee.fromJson. This is a standard pattern in Dart for JSON serialization in classes with private constructors.


624-624: Consistency check for ActualFee usage in when and whenOrNull methods.

The ActualFee type is consistently used across various transaction receipt types in the when and whenOrNull methods. This ensures that the type change is propagated correctly throughout the code.

Also applies to: 634-634, 644-644, 654-654, 665-665, 676-676, 682-682, 691-691, 701-701, 711-711, 721-721, 732-732, 743-743, 749-749, 758-758, 768-768, 778-778, 788-788, 799-799, 810-810, 816-816


875-875: Check for consistent use of ActualFee in TxnReceiptCopyWith.

The actualFee property in the TxnReceiptCopyWith method correctly uses the ActualFee type, ensuring type safety and consistency.


1038-1038: Proper assignment of actualFee in InvokeTxnReceipt.

The actualFee property in the InvokeTxnReceipt class is correctly assigned using the ActualFee type, aligning with the changes in the model.


616-616: Review of actualFee property in TxnReceipt.

The actualFee property has been changed to use the new ActualFee class instead of the previous Felt type. This change should be cross-verified in all usage contexts to ensure compatibility.

Verification successful

Verification of actualFee property in TxnReceipt: Successful

The actualFee property has been correctly updated to use the new ActualFee class instead of the previous Felt type across all usage contexts.

  • Verified instances in:
    • packages/starknet_provider/lib/src/model/get_transaction_receipt.g.dart
    • packages/starknet_provider/lib/src/model/get_transaction_receipt.dart
    • packages/starknet_provider/lib/src/model/get_transaction_receipt.freezed.dart
    • packages/starknet_provider/test/integration/read_provider_test.dart
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all usages of `actualFee` to ensure they have been updated to use `ActualFee`.

# Test: Search for the property usage. Expect: Only occurrences of the new type.
rg --type dart $'actualFee'

Length of output: 39912

Comment on lines 15 to 16
export STARKNET_PRIVATE_KEY="0x71d7bb07b9a64f6f78ac4c816aff4da9"
export STARKNET_PUBLIC_KEY="0x39d9e6ce352ad4530a0ef5d5a18fd3303c3606a7fa6ac5b620020ad681cc33b"
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential Security Risk: API Key Exposure

The private and public keys are exposed in the environment file, which could lead to unauthorized access if not properly secured. Consider using secrets management tools or environment-specific encryption to protect these keys.

Tools
Gitleaks

15-15: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)


16-16: Detected a Generic API Key, potentially exposing access to various services and sensitive operations. (generic-api-key)

run: |
starkli call $HELLO_CONTRACT_ADDRESS get_name
starkli invoke $HELLO_CONTRACT_ADDRESS set_name 0x0
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove trailing spaces to clean up the code.

Trailing spaces on lines 90 and 92 should be removed to adhere to good coding practices.

-      starkli invoke $HELLO_CONTRACT_ADDRESS set_name 0x0 
+      starkli invoke $HELLO_CONTRACT_ADDRESS set_name 0x0
-      
+

Also applies to: 92-92

Tools
yamllint

[error] 90-90: trailing spaces (trailing-spaces)

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 85009ab and 68a4cbc.

Files selected for processing (4)
  • packages/starknet_provider/lib/src/model/estimate_fee.dart (1 hunks)
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.dart (7 hunks)
  • packages/starknet_provider/lib/src/model/json_rpc_api_error.dart (2 hunks)
  • packages/starknet_provider/test/integration/read_provider_test.dart (34 hunks)
Files skipped from review as they are similar to previous changes (4)
  • packages/starknet_provider/lib/src/model/estimate_fee.dart
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.dart
  • packages/starknet_provider/lib/src/model/json_rpc_api_error.dart
  • packages/starknet_provider/test/integration/read_provider_test.dart

Copy link
Contributor

@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 68a4cbc and e8b6c76.

Files selected for processing (5)
  • assets/devnet-dump.json (1 hunks)
  • melos.yaml (2 hunks)
  • packages/starknet_provider/test/integration/read_provider_test.dart (34 hunks)
  • packages/wallet_kit/lib/services/token_service.dart (1 hunks)
  • packages/wallet_kit/lib/wallet_screens/password_screen.dart (1 hunks)
Files not summarized due to errors (1)
  • assets/devnet-dump.json: Error: Message exceeds token limit
Files skipped from review due to trivial changes (2)
  • packages/wallet_kit/lib/services/token_service.dart
  • packages/wallet_kit/lib/wallet_screens/password_screen.dart
Files skipped from review as they are similar to previous changes (1)
  • packages/starknet_provider/test/integration/read_provider_test.dart
Additional context used
yamllint
melos.yaml

[error] 90-90: trailing spaces

(trailing-spaces)


[error] 92-92: trailing spaces

(trailing-spaces)

Additional comments not posted (4)
melos.yaml (3)

59-59: Verify the command options for starting devnet.

Ensure that the options --seed 0, --dump-path $DEVNET_DUMP_PATH, --state-archive-capacity full, and --port 3030 are necessary and appropriate for your setup.


61-64: Verify the command options for starting devnet and handling dumps.

Ensure that the options --seed 0, --dump-path $DEVNET_DUMP_PATH, --state-archive-capacity full, --dump-on exit, and --port 3030 are necessary and appropriate for your setup. Additionally, confirm that the rm $DEVNET_DUMP_PATH command is safe and won't cause unintended data loss.


71-71: Verify the necessity of the contracts:invoke command.

Ensure that invoking contracts is necessary and appropriate for your setup.

assets/devnet-dump.json (1)

1-1: Verify the accuracy and necessity of the transaction details.

Ensure that the transaction details in the JSON array are accurate and necessary for your setup. Pay special attention to the values of fields like max_fee, version, signature, nonce, contract_class, sender_address, and compiled_class_hash.

melos.yaml Outdated
Comment on lines 86 to 95

contracts:invoke:
description: creating invoke tx for tests with hash 0x03b2911796e0024f9e23d7337997538058eca267d5ddaa582d482cbe1fb64897 and deploy_account tx with hash 0x055ba13c33a12506d2eab8dfbc618a8ce0d247c24959a64ee18fbf393c873b83
run: |
starkli call $HELLO_CONTRACT_ADDRESS get_name
starkli invoke $HELLO_CONTRACT_ADDRESS set_name 0x0
# should create tx hash 0x029583643cd8932f1955bf28bfebf4c907b13df1e5c2d202b133cfbf783697a2

yes | cp .starkli/account_for_devnet_setup.json .starkli/account_1.json
starkli invoke 0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7 transfer 0x016a0d7df981d681537dc2ce648722ff1d1c2cbe59412b492d35bac69825f104 0x100000000000000000 0x0
echo | starkli account deploy .starkli/account_1.json
Copy link
Contributor

Choose a reason for hiding this comment

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

Verify the commands for creating invoke transactions and deploying accounts.

Ensure that the commands for creating invoke transactions and deploying accounts are necessary and appropriate for your setup.

Additionally, remove the trailing spaces on lines 90 and 92.

-      starkli invoke $HELLO_CONTRACT_ADDRESS set_name 0x0 
+      starkli invoke $HELLO_CONTRACT_ADDRESS set_name 0x0
-      
+
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
contracts:invoke:
description: creating invoke tx for tests with hash 0x03b2911796e0024f9e23d7337997538058eca267d5ddaa582d482cbe1fb64897 and deploy_account tx with hash 0x055ba13c33a12506d2eab8dfbc618a8ce0d247c24959a64ee18fbf393c873b83
run: |
starkli call $HELLO_CONTRACT_ADDRESS get_name
starkli invoke $HELLO_CONTRACT_ADDRESS set_name 0x0
# should create tx hash 0x029583643cd8932f1955bf28bfebf4c907b13df1e5c2d202b133cfbf783697a2
yes | cp .starkli/account_for_devnet_setup.json .starkli/account_1.json
starkli invoke 0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7 transfer 0x016a0d7df981d681537dc2ce648722ff1d1c2cbe59412b492d35bac69825f104 0x100000000000000000 0x0
echo | starkli account deploy .starkli/account_1.json
contracts:invoke:
description: creating invoke tx for tests with hash 0x03b2911796e0024f9e23d7337997538058eca267d5ddaa582d482cbe1fb64897 and deploy_account tx with hash 0x055ba13c33a12506d2eab8dfbc618a8ce0d247c24959a64ee18fbf393c873b83
run: |
starkli invoke $HELLO_CONTRACT_ADDRESS set_name 0x0
# should create tx hash 0x029583643cd8932f1955bf28bfebf4c907b13df1e5c2d202b133cfbf783697a2
yes | cp .starkli/account_for_devnet_setup.json .starkli/account_1.json
starkli invoke 0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7 transfer 0x016a0d7df981d681537dc2ce648722ff1d1c2cbe59412b492d35bac69825f104 0x100000000000000000 0x0
echo | starkli account deploy .starkli/account_1.json
Tools
yamllint

[error] 90-90: trailing spaces

(trailing-spaces)


[error] 92-92: trailing spaces

(trailing-spaces)

Copy link
Contributor

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e8b6c76 and 66b57fa.

Files selected for processing (1)
  • packages/starknet_provider/test/integration/read_provider_test.dart (34 hunks)
Additional comments not posted (7)
packages/starknet_provider/test/integration/read_provider_test.dart (7)

12-12: Verify the new balance contract address.

Ensure that the new balance contract address 0x03cdc588f4f1bff66c8a6896e7008cc39c7804d36b16e93792625bd18bffd249 is correct and valid.


18-18: Verify the new block number.

Ensure that the new block number 3 is correct and valid.


20-20: Verify the new invoke transaction hash.

Ensure that the new invoke transaction hash 0x029583643cd8932f1955bf28bfebf4c907b13df1e5c2d202b133cfbf783697a2 is correct and valid.


26-26: Verify the new deploy account transaction hash.

Ensure that the new deploy account transaction hash 0x055ba13c33a12506d2eab8dfbc618a8ce0d247c24959a64ee18fbf393c873b83 is correct and valid.


45-45: Verify the new class hash for version 1.

Ensure that the new class hash 0x061dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f is correct and valid.


47-47: Verify the new contract address for version 1.

Ensure that the new contract address 0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691 is correct and valid.


119-119: Verify the new entry point selector.

Ensure that the new entry point selector getSelectorByName('get_name') is correct and valid.

Felt declareTransactionHash = Felt.fromHexString(
'0x1363b8d4b4ef14e872e78b2fc65cc939b2a7a535b76f9146dbd6cd259119e44');
'0x4d7ba5427d4066c8db851e7662ecce860a94a804c6735677dfd29f1d0103fda');
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the transaction hash length.

The transaction hash 0x4d7ba5427d4066c8db851e7662ecce860a94a804c6735677dfd29f1d0103fda is missing one character. Transaction hashes should be 64 hex characters long.

- '0x4d7ba5427d4066c8db851e7662ecce860a94a804c6735677dfd29f1d0103fda'
+ '0x04d7ba5427d4066c8db851e7662ecce860a94a804c6735677dfd29f1d0103fda'  // Assuming the missing character is '0'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'0x4d7ba5427d4066c8db851e7662ecce860a94a804c6735677dfd29f1d0103fda');
'0x04d7ba5427d4066c8db851e7662ecce860a94a804c6735677dfd29f1d0103fda');

@@ -37,14 +37,14 @@ void main() {
'0x04e76f8708774c8162fb4da7abefb3cae94cc51cf3f9b40e0d44f24aabf8a521');
BlockId blockIdForTheGivenContractAddress = BlockId.blockHash(
Felt.fromHexString(
'0x6a39eb5c273a221b99b08323bed9ec1ef1bc3d232a668c941b23cca3bf1164a'));
'0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02'));
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the block hash length for contract address block ID.

The block hash used to create a BlockId from a block hash is missing one character. It should be 64 hex characters long.

- '0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02'
+ '0x051d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02'  // Assuming the missing character is '0'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02'));
'0x051d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02'));


Felt invalidHexString = Felt.fromHexString(
'0x0000000000000000000000000000000000000000000000000000000000000000');
Felt blockHash = Felt.fromHexString(
'0x7ed2fde2b82d70368db9ae0a53e88bd9a50e50a202f20e7ff07d0c18338d8c6');
int blockNumber = 13334;
'0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02');
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct the block hash length.

The block hash 0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02 is missing one character. Block hashes should be 64 hex characters long.

- '0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02'
+ '0x051d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02'  // Assuming the missing character is '0'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02');
'0x051d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02');

@tonypony220 tonypony220 force-pushed the read-provider-test-migrate-devnet branch from 66b57fa to 09cc352 Compare July 14, 2024 14:11
Copy link
Contributor

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

Outside diff range, codebase verification and nitpick comments (2)
melos.yaml (1)

86-95: Remove trailing spaces to clean up the code.

Trailing spaces on lines 90 and 92 should be removed to adhere to good coding practices.

-      starkli invoke $HELLO_CONTRACT_ADDRESS set_name 0x0 
+      starkli invoke $HELLO_CONTRACT_ADDRESS set_name 0x0
-      
+
Tools
yamllint

[error] 90-90: trailing spaces

(trailing-spaces)


[error] 92-92: trailing spaces

(trailing-spaces)

packages/starknet_provider/lib/src/model/estimate_fee.dart (1)

25-28: Clarify the comment for better understanding.

The comment should be more explicit about the purpose of the SimulationFlag and how it affects the transaction simulation.

-/// By default, the sequencer behavior is replicated locally (enough funds are expected to be in the
-/// account, and fee will be deducted from the balance before the simulation of the next
-/// transaction). To skip the fee charge, use the SKIP_FEE_CHARGE flag.
+/// By default, the sequencer behavior is replicated locally, meaning that enough funds are expected
+/// to be in the account, and the fee will be deducted from the balance before simulating the next
+/// transaction. To skip the fee charge, use the `SKIP_FEE_CHARGE` flag.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 66b57fa and 09cc352.

Files selected for processing (23)
  • .env.devnet (1 hunks)
  • .github/workflows/ci.yaml (1 hunks)
  • .gitignore (1 hunks)
  • .starkli/account_for_devnet_setup.json (1 hunks)
  • .tool-versions (1 hunks)
  • assets/devnet-dump.json (1 hunks)
  • contracts/v2.6.2/src/hello.cairo (2 hunks)
  • contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json (1 hunks)
  • melos.yaml (2 hunks)
  • melos_monorepo.iml (1 hunks)
  • packages/starknet/lib/src/account.dart (1 hunks)
  • packages/starknet_provider/.tool-versions (1 hunks)
  • packages/starknet_provider/lib/src/model/estimate_fee.dart (1 hunks)
  • packages/starknet_provider/lib/src/model/estimate_fee.freezed.dart (1 hunks)
  • packages/starknet_provider/lib/src/model/estimate_fee.g.dart (2 hunks)
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.dart (7 hunks)
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.freezed.dart (183 hunks)
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.g.dart (7 hunks)
  • packages/starknet_provider/lib/src/model/json_rpc_api_error.dart (2 hunks)
  • packages/starknet_provider/lib/src/model/json_rpc_api_error.g.dart (2 hunks)
  • packages/starknet_provider/test/integration/read_provider_test.dart (34 hunks)
  • packages/wallet_kit/lib/services/token_service.dart (1 hunks)
  • packages/wallet_kit/lib/wallet_screens/password_screen.dart (1 hunks)
Files not summarized due to errors (3)
  • assets/devnet-dump.json: Error: Message exceeds token limit
  • contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json: Error: Message exceeds token limit
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.freezed.dart: Error: Message exceeds token limit
Files skipped from review due to trivial changes (1)
  • .github/workflows/ci.yaml
Files skipped from review as they are similar to previous changes (14)
  • .gitignore
  • .tool-versions
  • contracts/v2.6.2/src/hello.cairo
  • melos_monorepo.iml
  • packages/starknet/lib/src/account.dart
  • packages/starknet_provider/.tool-versions
  • packages/starknet_provider/lib/src/model/estimate_fee.freezed.dart
  • packages/starknet_provider/lib/src/model/estimate_fee.g.dart
  • packages/starknet_provider/lib/src/model/get_transaction_receipt.g.dart
  • packages/starknet_provider/lib/src/model/json_rpc_api_error.dart
  • packages/starknet_provider/lib/src/model/json_rpc_api_error.g.dart
  • packages/starknet_provider/test/integration/read_provider_test.dart
  • packages/wallet_kit/lib/services/token_service.dart
  • packages/wallet_kit/lib/wallet_screens/password_screen.dart
Additional context used
Gitleaks
.starkli/account_for_devnet_setup.json

6-6: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

.env.devnet

15-15: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


16-16: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

yamllint
melos.yaml

[error] 90-90: trailing spaces

(trailing-spaces)


[error] 92-92: trailing spaces

(trailing-spaces)

Additional comments not posted (20)
.env.devnet (1)

18-19: LGTM!

The changes to HELLO_CLASS_HASH and HELLO_CONTRACT_ADDRESS are straightforward updates to the new values.

melos.yaml (2)

59-59: Verify the command for starting the devnet.

Ensure that the starknet-devnet command with the --state-archive-capacity full flag is necessary and appropriate for your setup.


63-63: Verify the command for starting the devnet with dump on exit.

Ensure that the starknet-devnet command with the --state-archive-capacity full and --dump-on exit flags is necessary and appropriate for your setup.

packages/starknet_provider/lib/src/model/estimate_fee.dart (2)

30-46: LGTM!

The SimulationFlag class and its methods are correctly implemented.


52-56: LGTM!

The EstimateFeeRequest class and its methods are correctly implemented.

packages/starknet_provider/lib/src/model/get_transaction_receipt.dart (2)

23-32: LGTM! But verify the usage of the ActualFee class.

The code changes are approved.

However, ensure that the amount and unit fields are used correctly elsewhere in the codebase.

Verification successful

LGTM! The usage of the ActualFee class and its fields amount and unit is correct.

The code changes are approved.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `ActualFee` class in the codebase.

# Test: Search for the `ActualFee` class usage. Expect: Correct usage of `amount` and `unit` fields.
rg --type dart -A 5 $'ActualFee'

Length of output: 166764


Line range hint 33-119:
LGTM! But verify the usage of the actualFee field in each factory constructor.

The code changes are approved.

However, ensure that the actualFee field is used correctly in each factory constructor.

Verification successful

The actualFee field is used correctly in each factory constructor of the TxnReceipt class.

The verification confirms that the actualFee field is consistently present and correctly used across all factory constructors in the TxnReceipt class.

  • The actualFee field is included in the constructor parameters.
  • The actualFee field is correctly handled in the JSON serialization/deserialization methods.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the `actualFee` field in each factory constructor of the `TxnReceipt` class.

# Test: Search for the `actualFee` field usage in the `TxnReceipt` class. Expect: Correct usage in each factory constructor.
rg --type dart -A 5 $'TxnReceipt'

Length of output: 254861

assets/devnet-dump.json (5)

1-1: LGTM! But verify the field values in the contract_class object.

The JSON structure is approved.

However, ensure that the field values are accurate and consistent with the rest of the codebase.

Verification successful

Field values in the contract_class object are accurate and consistent.

The contract_class object in assets/devnet-dump.json has been verified against contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json and found to be accurate and consistent.

  • assets/devnet-dump.json
  • contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the field values in the `contract_class` object.

# Test: Search for the `contract_class` object usage. Expect: Accurate and consistent field values.
rg --type json -A 5 $'contract_class'

Length of output: 31985


1-1: LGTM! But verify the field values in the entry_points_by_type object.

The JSON structure is approved.

However, ensure that the field values are accurate and consistent with the rest of the codebase.

Verification successful

Field values in the entry_points_by_type object are accurate and consistent.

  • The entry_points_by_type object in assets/devnet-dump.json matches the structure and values found in contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json.
  • The field values for EXTERNAL, L1_HANDLER, and CONSTRUCTOR are consistent across both JSON files.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the field values in the `entry_points_by_type` object.

# Test: Search for the `entry_points_by_type` object usage. Expect: Accurate and consistent field values.
rg --type json -A 5 $'entry_points_by_type'

Length of output: 31695


1-1: LGTM! But verify the field values in the AddDeclareTransaction object.

The JSON structure is approved.

However, ensure that the field values are accurate and consistent with the rest of the codebase.


1-1: LGTM! But verify the field values in the AddDeployAccountTransaction object.

The JSON structure is approved.

However, ensure that the field values are accurate and consistent with the rest of the codebase.


1-1: LGTM! But verify the field values in the AddInvokeTransaction object.

The JSON structure is approved.

However, ensure that the field values are accurate and consistent with the rest of the codebase.

contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json (5)

1-1: LGTM! But verify the array values in the sierra_program object.

The JSON structure is approved.

However, ensure that the array values are accurate and consistent with the rest of the codebase.

Verification successful

Array values in the sierra_program object are verified and consistent across the codebase.

The array values in the sierra_program object are accurate and consistent with the rest of the codebase.

  • contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json
  • assets/devnet-dump.json
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the array values in the `sierra_program` object.

# Test: Search for the `sierra_program` object usage. Expect: Accurate and consistent array values.
rg --type json -A 5 $'sierra_program'

Length of output: 31689


1-1: LGTM! But verify the field values in the entry_points_by_type object.

The JSON structure is approved.

However, ensure that the field values are accurate and consistent with the rest of the codebase.

Verification successful

LGTM! But verify the field values in the entry_points_by_type object.

The JSON structure is approved.

However, ensure that the field values are accurate and consistent with the rest of the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the field values in the `entry_points_by_type` object.

# Test: Search for the `entry_points_by_type` object usage. Expect: Accurate and consistent field values.
rg --type json -A 5 $'entry_points_by_type'

Length of output: 31695


1-1: LGTM! But verify the version string in the contract_class_version object.

The JSON structure is approved.

However, ensure that the version string is accurate and consistent with the rest of the codebase.

Verification successful

The version string in the contract_class_version object is accurate and consistent.

The version string "0.1.0" is used consistently across different JSON files in the codebase.

  • contracts/v2.6.2/target/dev/starknet_dart_hello.contract_class.json
  • assets/devnet-dump.json
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the version string in the `contract_class_version` object.

# Test: Search for the `contract_class_version` object usage. Expect: Accurate and consistent version string.
rg --type json -A 5 $'contract_class_version'

Length of output: 31697


1-1: LGTM! But verify the field values in the sierra_program_debug_info object.

The JSON structure is approved.

However, ensure that the field values are accurate and consistent with the rest of the codebase.


1-1: LGTM! But verify the ABI definitions in the abi object.

The JSON structure is approved.

However, ensure that the ABI definitions are accurate and consistent with the rest of the codebase.

Verification successful

Verify the ABI definitions in the abi object.

The JSON structure is approved. However, ensure that the ABI definitions are accurate and consistent with the actual function implementations in the codebase.


Verify the ABI definitions in the abi object.

The JSON structure is approved. The ABI definitions in the starknet_dart_hello.contract_class.json file are consistent with the function implementations found in the contracts/v2.6.2/src/hello.cairo file.

  • get_name function:

    • ABI: {"name":"get_name","inputs":[],"outputs":[{"type":"core::felt252"}],"state_mutability":"view"}
    • Implementation: fn get_name(self: @ContractState) -> felt252
  • set_name function:

    • ABI: {"name":"set_name","inputs":[{"name":"name","type":"core::felt252"}],"outputs":[],"state_mutability":"external"}
    • Implementation: fn set_name(ref self: ContractState, name: felt252)
  • sum function:

    • ABI: {"name":"sum","inputs":[{"name":"a","type":"core::felt252"},{"name":"b","type":"core::felt252"}],"outputs":[{"type":"core::felt252"}],"state_mutability":"external"}
    • Implementation: fn sum(ref self: ContractState, a: felt252, b: felt252) -> felt252
  • Constructor:

    • ABI: {"name":"constructor","inputs":[{"name":"name","type":"core::felt252"}]}
    • Implementation: fn constructor(ref self: ContractState, name: felt252)

The ABI definitions are accurate and consistent with the actual function implementations in the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the ABI definitions in the `abi` object.

# Test: Search for the `abi` object usage. Expect: Accurate and consistent ABI definitions.
rg --type json -A 5 $'abi'

Length of output: 38617


Script:

#!/bin/bash
# Description: Verify the ABI definitions in the `abi` object by checking the actual function implementations.

# Search for the implementation of `get_name` function.
ast-grep --lang rust --pattern $'fn get_name($_) -> $_ {
  $$$
}'

# Search for the implementation of `set_name` function.
ast-grep --lang rust --pattern $'fn set_name($_, $_) {
  $$$
}'

# Search for the implementation of `sum` function.
ast-grep --lang rust --pattern $'fn sum($_, $_) -> $_ {
  $$$
}'

# Search for the implementation of the constructor.
ast-grep --lang rust --pattern $'fn constructor($_) {
  $$$
}'

Length of output: 261


Script:

#!/bin/bash
# Description: Broader search for the implementations of `get_name`, `set_name`, `sum`, and constructor functions.

# Search for the implementation of `get_name` function.
rg 'fn get_name'

# Search for the implementation of `set_name` function.
rg 'fn set_name'

# Search for the implementation of `sum` function.
rg 'fn sum'

# Search for the implementation of the constructor.
rg 'fn constructor'

Length of output: 1366

packages/starknet_provider/lib/src/model/get_transaction_receipt.freezed.dart (3)

433-446: LGTM! The ActualFee class is well-implemented.

The class contains the necessary fields and methods, and the serialization methods are properly defined.


616-619: LGTM! The TxnReceipt class changes are well-integrated.

The actualFee field is now of type ActualFee, and the related methods and constructors have been updated accordingly.

Also applies to: 624-626, 634-636, 644-646, 654-656, 665-667, 676-678, 691-693, 701-703, 711-713, 721-723, 732-734, 743-745, 758-760, 768-770, 778-780, 788-790, 799-801, 810-812, 875-880, 910-911, 927-932, 945-952, 985-986, 1038-1038, 1116-1174, 1187-1245, 1258-1316, 1390-1404, 1430-1437, 1470-1471, 1523-1523, 1601-1659, 1672-1730, 1743-1801, 1875-1889, 1915-1922, 1955-1956, 2008-2008, 2086-2144, 2157-2215, 2228-2286, 2360-2374, 2400-2408, 2442-2443, 2500-2500, 2585-2643, 2656-2714, 2727-2785, 2859-2874, 2902-2910, 2945-2946, 3003-3003, 3088-3146, 3159-3217, 3230-3288, 3362-3377, 3405-3410, 3442-3443, 3485-3485, 3556-3614, 3627-3685, 3698-3756, 3830-3842, 3867-3871, 3902-3903, 3942-3942, 4007-4065, 4078-4136, 4149-4207, 4281-4293


3485-3485: LGTM! The PendingDeployTxnReceipt and PendingCommonReceiptProperties class changes are well-integrated.

The actualFee field is now of type ActualFee, and the related methods and constructors have been updated accordingly.

Also applies to: 3556-3614, 3627-3685, 3698-3756, 3830-3842, 3867-3871, 3902-3903, 3942-3942, 4007-4065, 4078-4136, 4149-4207, 4281-4293

"variant": {
"type": "open_zeppelin",
"version": 1,
"public_key": "0x39d9e6ce352ad4530a0ef5d5a18fd3303c3606a7fa6ac5b620020ad681cc33b",
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential Security Risk: Public Key Exposure

The public key is exposed in the configuration file, which might lead to security risks if this file is not properly secured. Consider encrypting this key or using environment variables to handle sensitive information securely.

Tools
Gitleaks

6-6: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

@@ -7,13 +7,13 @@ export DEVNET_DUMP_PATH="./assets/devnet-dump.json"

export CAIRO_VERSION=2.6.2
export SCARB_VERSION=2.6.2
export STARKNET_DEVNET_VERSION=0.0.5
export STARKNET_DEVNET_VERSION=0.0.7
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential Security Risk: API Key Exposure

The private and public keys are exposed in the environment file, which could lead to unauthorized access if not properly secured. Consider using secrets management tools or environment-specific encryption to protect these keys.

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 09cc352 and de6ae0e.

Files selected for processing (1)
  • packages/starknet_provider/test/integration/read_provider_test.dart (34 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/starknet_provider/test/integration/read_provider_test.dart

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between de6ae0e and 17d150a.

Files selected for processing (3)
  • contracts/v2.6.2/src/hello.cairo (2 hunks)
  • melos.yaml (2 hunks)
  • packages/starknet_provider/test/integration/read_provider_test.dart (34 hunks)
Files skipped from review as they are similar to previous changes (2)
  • contracts/v2.6.2/src/hello.cairo
  • packages/starknet_provider/test/integration/read_provider_test.dart
Additional context used
yamllint
melos.yaml

[error] 90-90: trailing spaces

(trailing-spaces)


[error] 92-92: trailing spaces

(trailing-spaces)

Additional comments not posted (3)
melos.yaml (3)

64-64: Approve the addition of --dump-on exit in devnet:start:dump.

This change will help in debugging by ensuring the state is preserved on exit.

Verify the accessibility of the dump path.
Ensure that $DEVNET_DUMP_PATH is writable and accessible to avoid runtime errors.

Verification successful

Approve the addition of --dump-on exit in devnet:start:dump.

This change will help in debugging by ensuring the state is preserved on exit.

Verification result:
The dump path is confirmed to be writable and accessible.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the dump path is writable and accessible.
[ -w $DEVNET_DUMP_PATH ] && echo "Dump path is writable." || echo "Dump path is not writable."

Length of output: 67


59-60: Approve the updated devnet:start command.

The addition of --state-archive-capacity full and --port 3030 seems appropriate for enhancing devnet functionality.

Verify port usage to avoid conflicts.
Ensure that port 3030 is not used by other services in the development environment.


87-95: Approve the new contracts:invoke command.

This addition facilitates creating invoke and deploy account transactions, which is crucial for contract interactions.

Verify the hashes used in transactions.
Ensure that the hashes 0x03b2911796e0024f9e23d7337997538058eca267d5ddaa582d482cbe1fb64897 and 0x055ba13c33a12506d2eab8dfbc618a8ce0d247c24959a64ee18fbf393c873b83 are correct and valid.

Tools
yamllint

[error] 90-90: trailing spaces

(trailing-spaces)


[error] 92-92: trailing spaces

(trailing-spaces)

@tonypony220 tonypony220 requested a review from ptisserand July 17, 2024 10:12
Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 17d150a and 5359cf2.

Files selected for processing (1)
  • packages/starknet_provider/test/integration/read_provider_test.dart (34 hunks)
Additional comments not posted (8)
packages/starknet_provider/test/integration/read_provider_test.dart (8)

12-12: Verify the correctness of the new balanceContractAddress value.

Ensure that the new hexadecimal value 0x03cdc588f4f1bff66c8a6896e7008cc39c7804d36b16e93792625bd18bffd249 is correct and matches the expected format.


17-17: Verify the correctness of the new blockHash value.

Ensure that the new hexadecimal value 0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02 is correct and matches the expected format.


18-18: Verify the correctness of the new blockNumber value.

Ensure that the new integer value 3 is correct and matches the expected context.


20-20: Verify the correctness of the new invokeTransactionHash value.

Ensure that the new hexadecimal value 0x029583643cd8932f1955bf28bfebf4c907b13df1e5c2d202b133cfbf783697a2 is correct and matches the expected format.


22-22: Verify the correctness of the new declareTransactionHash value.

Ensure that the new hexadecimal value 0x4d7ba5427d4066c8db851e7662ecce860a94a804c6735677dfd29f1d0103fda is correct and matches the expected format.


26-26: Verify the correctness of the new deployAccountTransactionHash value.

Ensure that the new hexadecimal value 0x055ba13c33a12506d2eab8dfbc618a8ce0d247c24959a64ee18fbf393c873b83 is correct and matches the expected format.


40-40: Verify the correctness of the new blockIdForTheGivenContractAddress value.

Ensure that the new hexadecimal value 0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02 is correct and matches the expected format.


45-47: Verify the correctness of the new classHashV1 and contractAddressV1 values.

Ensure that the new hexadecimal values 0x061dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f and 0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691 are correct and match the expected format.

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5359cf2 and bb0c795.

Files selected for processing (1)
  • packages/starknet_provider/test/integration/read_provider_test.dart (34 hunks)
Additional comments not posted (13)
packages/starknet_provider/test/integration/read_provider_test.dart (13)

12-12: Verify the updated balanceContractAddress hex string.

Ensure that the new hex string "0x03cdc588f4f1bff66c8a6896e7008cc39c7804d36b16e93792625bd18bffd249" is correct and corresponds to the intended address.


17-17: Verify the updated blockHash hex string.

Ensure that the new hex string '0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02' is correct and corresponds to the intended block hash.


18-18: Verify the updated blockNumber.

Ensure that the new block number 3 is correct and corresponds to the intended block.


20-20: Verify the updated invokeTransactionHash hex string.

Ensure that the new hex string '0x029583643cd8932f1955bf28bfebf4c907b13df1e5c2d202b133cfbf783697a2' is correct and corresponds to the intended transaction hash.


22-22: Verify the updated declareTransactionHash hex string.

Ensure that the new hex string '0x4d7ba5427d4066c8db851e7662ecce860a94a804c6735677dfd29f1d0103fda' is correct and corresponds to the intended transaction hash.


26-26: Verify the updated deployAccountTransactionHash hex string.

Ensure that the new hex string '0x055ba13c33a12506d2eab8dfbc618a8ce0d247c24959a64ee18fbf393c873b83' is correct and corresponds to the intended transaction hash.


40-40: Verify the updated block hash for BlockId hex string.

Ensure that the new hex string '0x51d7ee9fa3a6226d47860eea28dc0b38eeccd7b6fac1b9f39c64c3ac772cc02' is correct and corresponds to the intended block hash.


45-45: Verify the updated classHashV1 hex string.

Ensure that the new hex string '0x061dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f' is correct and corresponds to the intended class hash.


47-47: Verify the updated contractAddressV1 hex string.

Ensure that the new hex string '0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691' is correct and corresponds to the intended contract address.


62-63: Verify the updated expect statement for blockNumber.

Ensure that the updated expect statement correctly checks if blockNumber is a BlockNumberResult and if the result is greater than or equal to 0.


119-119: Verify the updated entryPointSelector for the call method.

Ensure that the updated entryPointSelector correctly uses getSelectorByName('get_name').


127-127: Verify the updated expect statement for the call method result.

Ensure that the updated expect statement correctly checks if the result has a length of 1 and if the first element is Felt.fromInt(0).


139-139: Verify the updated blockId for the call method.

Ensure that the updated blockId correctly uses BlockId.latest.

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bb0c795 and 0d81f07.

Files selected for processing (1)
  • contracts/v2.6.2/src/hello.cairo (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • contracts/v2.6.2/src/hello.cairo

@tonypony220 tonypony220 requested a review from ptisserand July 22, 2024 10:34
Copy link
Collaborator

@ptisserand ptisserand left a comment

Choose a reason for hiding this comment

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

One last fix and we can merge!
Thanks a lot for your work

Copy link
Contributor

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0d81f07 and bb0cfb8.

Files selected for processing (1)
  • contracts/v2.6.2/src/hello.cairo (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • contracts/v2.6.2/src/hello.cairo

@ptisserand ptisserand merged commit 484f217 into focustree:main Jul 22, 2024
3 checks passed
PaulRbl pushed a commit that referenced this pull request Jul 30, 2024
* scratch changes

* in progress

* in progress

* fix

* fix

* in progress

* in progress

* added simulation_flags

* fix

* clean up

* fix recipit

* fix tests

* clean up

* clean up

* clean up

* clean up

* fix devnet ci

* clean up

* clean up

* satisfy review

* clean up

* clean up

* fix hello contract

* fix hello contract
PaulRbl pushed a commit that referenced this pull request Jul 30, 2024
* scratch changes

* in progress

* in progress

* fix

* fix

* in progress

* in progress

* added simulation_flags

* fix

* clean up

* fix recipit

* fix tests

* clean up

* clean up

* clean up

* clean up

* fix devnet ci

* clean up

* clean up

* satisfy review

* clean up

* clean up

* fix hello contract

* fix hello contract
PaulRbl pushed a commit that referenced this pull request Jul 30, 2024
* scratch changes

* in progress

* in progress

* fix

* fix

* in progress

* in progress

* added simulation_flags

* fix

* clean up

* fix recipit

* fix tests

* clean up

* clean up

* clean up

* clean up

* fix devnet ci

* clean up

* clean up

* satisfy review

* clean up

* clean up

* fix hello contract

* fix hello contract
PaulRbl pushed a commit that referenced this pull request Sep 16, 2024
* scratch changes

* in progress

* in progress

* fix

* fix

* in progress

* in progress

* added simulation_flags

* fix

* clean up

* fix recipit

* fix tests

* clean up

* clean up

* clean up

* clean up

* fix devnet ci

* clean up

* clean up

* satisfy review

* clean up

* clean up

* fix hello contract

* fix hello contract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate read_provider_test
2 participants