Skip to content

Remove support for adding new v1 declaration transactions (RPC 0.8.0)#716

Merged
FabijanC merged 11 commits intostarknet-0.13.4from
remove-v1
Mar 17, 2025
Merged

Remove support for adding new v1 declaration transactions (RPC 0.8.0)#716
FabijanC merged 11 commits intostarknet-0.13.4from
remove-v1

Conversation

@FabijanC
Copy link
Copy Markdown
Contributor

@FabijanC FabijanC commented Mar 6, 2025

Usage related changes

  • This is required by JSON-RPC v0.8.0: JSON-RPC API 0.8.0 adaptation #613
  • Fixes a bug in invoke v1 simulation (wrong handling of max fee zero case), but this is less important as the support for it shall soon be removed.
  • Will continue with other txs (invoke, deploy) and v2 removal in separate PRs.

Development related changes

  • Some tests were depending on Cairo 0 contracts. Now replaced them with Cairo 1 simple testing contract, which in some places required modifying constructor arguments and arguments of invoked contract methods.
  • All those v1 tests that didn't have a v2 or v3 counterpart, I tried to replace them with a v3 counterpart.
  • Number of failing tests reduced to 69 (all failing due to untagged enum deserialization, i.e. starknet-rs not adapted)
  • impl From for BroadcastedDeclareTransaction
  • What remains in tests is also removing cairo 0 declaration done not via transactions, but with custom state modification.

Checklist:

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

Summary by CodeRabbit

  • New Features

    • Now supports updated declare transaction versions for improved handling and fee estimation.
    • Transitioned to modern Cairo 1 contract classes for streamlined deployment.
  • Refactor

    • Removed legacy transaction type support and outdated fee parameters.
    • Simplified internal logic for transaction declaration, deployment, and simulation.
  • Tests

    • Updated and pruned integration tests to reflect newer transaction versions and account deployment methods.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 6, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request removes legacy support for Cairo 0 contracts and version 1 declare transaction logic across the codebase. References to outdated dummy contract classes and transaction variants are replaced with their newer counterparts (Cairo 1 and declare_v3). Changes span core modules, JSON-RPC endpoints, types, and integration tests, consolidating transaction processing and test validations to use updated signatures, parameters, and error handling.

Changes

File(s) Summary of Changes
crates/starknet-devnet-core/
(account.rs, starknet/add_declare_transaction.rs, starknet/events.rs, starknet/mod.rs, state/mod.rs, state/state_diff.rs, transactions.rs)
Updated contract class references from Cairo 0 to Cairo 1 and replaced declare V1 with declare V3. Legacy v1 logic and associated tests were removed.
crates/starknet-devnet-core/src/utils.rs Added dummy_broadcasted_declare_tx_v3, updated dummy_declare_transaction_v3, and changed the type of DUMMY_CAIRO_1_COMPILED_CLASS_HASH from a string slice to Felt.
crates/starknet-devnet-server/
(api/json_rpc/mod.rs, api/json_rpc/models.rs, api/json_rpc/write_endpoints.rs, test_utils.rs, test_data/rpc/declare_v1.json)
Removed functions, test cases, and JSON data tied to declare V1; updated JSON-RPC endpoints to process only V2/V3 declare transactions.
crates/starknet-devnet-types/
(constants.rs, rpc/transactions.rs, broadcasted_declare_transaction_v1.rs, broadcasted_declare_transaction_v3.rs, declare_transaction_v0v1.rs)
Eliminated V1 enum variants and transaction structs, removed deprecated files, and added a conversion implementation for BroadcastedDeclareTransactionV3.
tests/integration/
(get_transaction_by_hash.rs, get_transaction_receipt_by_hash.rs, test_account_selection.rs, test_estimate_fee.rs, test_estimate_message_fee.rs, test_fork.rs, test_get_class.rs, test_restart.rs, test_simulate_transactions.rs, test_transaction_handling.rs)
Removed legacy tests for V1/Cairo 0 transactions; updated tests to use declare_v3/deploy_v3 and revised assertions to reflect updated contract artifact handling and gas parameters.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Account
    participant TransactionHandler
    Client->>Account: Initiate declare transaction (v3)
    Account->>TransactionHandler: Process declare_v3(contract_artifact, casm_hash)
    TransactionHandler-->>Account: Return transaction confirmation
    Account-->>Client: Respond with transaction hash
Loading

Suggested Reviewers

  • marioiordanov

Poem

I’m a little rabbit, quick on my feet,
Hopping through code with a rhythmic beat.
Legacy gone, new paths in view,
With Cairo 1 and v3 shining through.
In this forest of code, we hop and play,
Celebrating fresh changes in our bright new day!
🐇💻 Happy coding, let’s leap ahead!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@FabijanC
Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 13, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@FabijanC FabijanC requested a review from marioiordanov March 13, 2025 14:26
Copy link
Copy Markdown

@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

🧹 Nitpick comments (3)
tests/integration/test_restart.rs (2)

120-121: Consider handling errors more gracefully.
Currently, .unwrap() will panic if spawning the devnet fails. Encouraging an explicit error handling or custom message could improve maintainability and debugging.

-    let devnet = BackgroundDevnet::spawn_with_additional_args(&devnet_args).await.unwrap();
+    let devnet = BackgroundDevnet::spawn_with_additional_args(&devnet_args)
+        .await
+        .expect("Failed to spawn devnet with additional args");

138-142: Avoid panics by handling the fee estimation error.
Unwrapping here will panic at runtime if fee estimation fails. Consider returning a result or using a descriptive .expect(...).

        .estimate_fee()
        .await
-       .unwrap();
+       .expect("Fee estimation failed");
tests/integration/test_estimate_fee.rs (1)

258-258: Updated calldata to Felt::from(100_u128), Felt::ONE.
You might consider making constants for these values if reused.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c657668 and 613f2a7.

📒 Files selected for processing (28)
  • crates/starknet-devnet-core/src/account.rs (2 hunks)
  • crates/starknet-devnet-core/src/starknet/add_declare_transaction.rs (6 hunks)
  • crates/starknet-devnet-core/src/starknet/events.rs (2 hunks)
  • crates/starknet-devnet-core/src/starknet/mod.rs (4 hunks)
  • crates/starknet-devnet-core/src/state/mod.rs (7 hunks)
  • crates/starknet-devnet-core/src/state/state_diff.rs (1 hunks)
  • crates/starknet-devnet-core/src/transactions.rs (3 hunks)
  • crates/starknet-devnet-core/src/utils.rs (2 hunks)
  • crates/starknet-devnet-server/src/api/json_rpc/mod.rs (1 hunks)
  • crates/starknet-devnet-server/src/api/json_rpc/models.rs (1 hunks)
  • crates/starknet-devnet-server/src/api/json_rpc/write_endpoints.rs (1 hunks)
  • crates/starknet-devnet-server/src/test_utils.rs (0 hunks)
  • crates/starknet-devnet-server/test_data/rpc/declare_v1.json (0 hunks)
  • crates/starknet-devnet-types/src/constants.rs (0 hunks)
  • crates/starknet-devnet-types/src/rpc/transactions.rs (2 hunks)
  • crates/starknet-devnet-types/src/rpc/transactions/broadcasted_declare_transaction_v1.rs (0 hunks)
  • crates/starknet-devnet-types/src/rpc/transactions/broadcasted_declare_transaction_v3.rs (2 hunks)
  • crates/starknet-devnet-types/src/rpc/transactions/declare_transaction_v0v1.rs (0 hunks)
  • tests/integration/get_transaction_by_hash.rs (0 hunks)
  • tests/integration/get_transaction_receipt_by_hash.rs (1 hunks)
  • tests/integration/test_account_selection.rs (1 hunks)
  • tests/integration/test_estimate_fee.rs (7 hunks)
  • tests/integration/test_estimate_message_fee.rs (3 hunks)
  • tests/integration/test_fork.rs (3 hunks)
  • tests/integration/test_get_class.rs (0 hunks)
  • tests/integration/test_restart.rs (3 hunks)
  • tests/integration/test_simulate_transactions.rs (3 hunks)
  • tests/integration/test_transaction_handling.rs (1 hunks)
💤 Files with no reviewable changes (7)
  • crates/starknet-devnet-server/src/test_utils.rs
  • crates/starknet-devnet-server/test_data/rpc/declare_v1.json
  • crates/starknet-devnet-types/src/constants.rs
  • crates/starknet-devnet-types/src/rpc/transactions/declare_transaction_v0v1.rs
  • tests/integration/get_transaction_by_hash.rs
  • tests/integration/test_get_class.rs
  • crates/starknet-devnet-types/src/rpc/transactions/broadcasted_declare_transaction_v1.rs
🔇 Additional comments (70)
crates/starknet-devnet-core/src/starknet/events.rs (2)

144-144: Updated test utility import to v3

The import has been updated to use dummy_declare_transaction_v3 instead of dummy_declare_transaction_v1, which aligns with the PR objective of removing v1 transaction support.


401-401: Updated test function to use v3 transaction

Test setup now uses dummy_declare_transaction_v3() instead of the v1 version, maintaining consistency with the import change and overall PR objective.

crates/starknet-devnet-core/src/account.rs (2)

226-228: Updated test utility imports to use Cairo 1

The imports now reference dummy_cairo_1_contract_class instead of the Cairo 0 version, aligning with the PR objective to replace Cairo 0 contracts with Cairo 1.


320-320: Updated test function to use Cairo 1 contract class

The setup function now uses dummy_cairo_1_contract_class() instead of the Cairo 0 version, ensuring consistency with the import changes and PR objectives.

crates/starknet-devnet-types/src/rpc/transactions/broadcasted_declare_transaction_v3.rs (2)

5-5: Added import for BroadcastedDeclareTransaction

Added the required import to support the new From implementation that converts v3 transactions to the general transaction type.


22-26: Added conversion from v3 to general declare transaction type

Implemented From<BroadcastedDeclareTransactionV3> for BroadcastedDeclareTransaction, which simplifies working with v3 transactions by allowing automatic conversion to the generic transaction type. This is crucial for the transition away from v1 transactions.

crates/starknet-devnet-core/src/transactions.rs (2)

296-296: Updated test utility import to v3

The import has been updated to use dummy_declare_transaction_v3 instead of the v1 version, which aligns with the PR objective of removing v1 transaction support.


312-312: Updated test functions to use v3 transactions

Test cases now use dummy_declare_transaction_v3() instead of the v1 version, ensuring consistency with the import changes and supporting the PR goal of removing v1 transaction support.

Also applies to: 337-337

crates/starknet-devnet-server/src/api/json_rpc/models.rs (2)

389-389: Update to test assertions after V1 transaction removal

The test has been updated to assert a length of 3 instead of 4, which aligns with the removal of V1 transaction support from the request array as part of the JSON-RPC v0.8.0 migration.


394-395: Updated array index assertions for transaction type checks

The assertions have been correctly adjusted to check the transaction types at their new positions in the array after removing the V1 declare transaction.

crates/starknet-devnet-core/src/state/state_diff.rs (1)

224-224: Using constant directly for compiled class hash

The code now uses the DUMMY_CAIRO_1_COMPILED_CLASS_HASH constant directly, which is consistent with the PR objective of focusing on Cairo 1 contracts and removing Cairo 0 support.

tests/integration/test_account_selection.rs (1)

8-8: Simplified imports after removing Cairo 0 support

The import statement has been updated to remove unused imports after removing the Cairo 0 account testing function, which aligns with the PR's goal of phasing out support for v1 transactions and Cairo 0 contracts.

crates/starknet-devnet-server/src/api/json_rpc/write_endpoints.rs (2)

194-195: Removed imports related to V1 transaction testing

These imports are no longer needed after removing the test for V1 declare transactions, which is consistent with the PR's goal of removing support for V1 transactions.


198-200: Simplified test function to focus on deploy account transaction only

The test has been streamlined to only test the deploy account transaction functionality, removing the V1 declare transaction test as part of phasing out V1 transaction support.

crates/starknet-devnet-core/src/state/mod.rs (6)

434-437: Imports updated to use Cairo 1 contract classes in tests

The imports have been correctly updated to use Cairo 1 contract classes and related utilities, aligning with the PR objective of removing support for Cairo 0 contracts.


450-451: Cairo 0 contract class replaced with Cairo 1

Contract class instantiation updated to use Cairo 1 contract, consistent with the overall migration away from Cairo 0.


488-488: Test function name updated to reflect Cairo 1

The function name now accurately reflects that it tests declaring Cairo 1 contract classes.


509-512: Updated assertion for Cairo 1 contract class

The assertion logic has been properly updated to verify the Cairo 1 contract class, maintaining test coverage while transitioning away from Cairo 0.


525-525: Test function name updated for Cairo 1 contract deployment

Function name now correctly indicates it's testing the deployment of Cairo 1 contracts.


590-593: Updated setup function to use Cairo 1

Setup function now uses Cairo 1 contract class and compiled class hash, maintaining consistency with other changes in the file and the broader codebase transition.

tests/integration/test_fork.rs (3)

10-11: Updated imports to include necessary transaction types

Added DeclareTransaction and other necessary types to handle transaction assertions in the new test case.


147-158: Simplified test for fetching Cairo 0 class from forked network

The test has been refactored to directly use a hardcoded class hash instead of reading and declaring a legacy contract class, which aligns with removing support for adding new v1 transactions while still testing the ability to fetch existing ones.


686-702: Added test to verify backward compatibility with v1 transactions

This new test ensures that while adding new v1 transactions is no longer supported, the system can still fetch existing v1 transactions from the origin network. This distinction is important for backward compatibility.

tests/integration/test_transaction_handling.rs (2)

34-36: Updated contract artifact acquisition

Now using the function get_simple_contract_in_sierra_and_compiled_class_hash() to obtain both the contract artifact and its CASM hash, which supports the transition to Cairo 1 contracts.


39-39: Updated declaration method from legacy to v3

Changed from declare_legacy to declare_v3 with updated parameters, now properly including both the contract artifact and CASM hash. Also switched from using max_fee to gas parameter, reflecting the updated transaction version.

tests/integration/get_transaction_receipt_by_hash.rs (1)

7-7: Removed BroadcastedDeclareTransactionV1 from imports

Import simplified to remove v1 transaction type, consistent with removing support for adding new v1 transactions.

tests/integration/test_restart.rs (3)

16-18: Imports look good.
No issues found with these added imports; they align well with usage patterns in the file.


148-148: Same note on unwrapping.
This declaration call also uses .unwrap(). Please apply similar error handling to avoid panics at runtime.


133-135:

Details

✅ Verification successful

Verify correctness of the retrieved artifact and CASM hash.
Ensure that get_simple_contract_in_sierra_and_compiled_class_hash() returns accurate data objects. If usage is widespread, confirm all call sites are updated accordingly.


🏁 Script executed:

#!/bin/bash
# Verify that get_simple_contract_in_sierra_and_compiled_class_hash is used consistently
# and returns valid (contract_artifact, casm_hash). This script will look for references 
# to the function and check subsequent usage.

rg 'get_simple_contract_in_sierra_and_compiled_class_hash' -A 5

Length of output: 16004


All call sites correctly process the retrieved artifact and CASM hash

After verifying usage across the test suite, get_simple_contract_in_sierra_and_compiled_class_hash() is consistently invoked and its return values are handled as expected (e.g., wrapping the artifact in an Arc::new when required). No discrepancies or outdated usages were found, so no further updates are needed at this time.

crates/starknet-devnet-types/src/rpc/transactions.rs (2)

584-584: Marking Declare V2 as deprecated is appropriate.
This change correctly aligns with the removal or phasing out of older transaction logic.


533-533:

Details

✅ Verification successful

Confirm removal of negation in fee validation.
Previously, code may have negated the invoke transaction’s is_max_fee_valid result. Now it is used directly. Verify this aligns with the intended fee validation logic.


🏁 Script executed:

#!/bin/bash
# Check references to is_max_fee_valid to confirm consistent usage across the codebase
rg 'is_max_fee_valid' -A 3

Length of output: 4471


Fee Validation Logic for Invoke Transactions Confirmed
The usage of broadcasted_invoke_transaction.is_max_fee_valid() without an extra negation is consistent with our intended logic. In the types module, the invoke variant for V1 already returns !v1.common.is_max_fee_zero_value(), while V3 directly checks v3.common.are_gas_bounds_valid(). The core modules appropriately wrap the call with a negation when validating (e.g., if !broadcasted_invoke_transaction.is_max_fee_valid() { … }), ensuring that the fee validation behaves as expected across all transaction types.

crates/starknet-devnet-server/src/api/json_rpc/mod.rs (1)

1380-1381: Test condition for Declare v3 error message.
Replacing "0x2" with "0x3" here ensures the test checks the correct invalid version scenario for declare v3 transactions.

tests/integration/test_estimate_message_fee.rs (4)

11-11: Updated dependency import to align with newer contract handling.

The change from a legacy utility to get_messaging_contract_in_sierra_and_compiled_class_hash reflects the transition to Cairo 1 contracts as mentioned in the PR objectives.


27-30: Contract artifact handling properly migrated to v3 format.

The code now correctly retrieves both the contract artifact and its CASM hash, which is required for v3 declaration transactions.


33-37: Successfully migrated from declare_legacy to declare_v3.

The code correctly implements the v3 declaration method, which requires the additional CASM hash parameter. Also, the gas parameter is now used with a fixed value instead of max_fee, which aligns with newer transaction handling.


51-57: Successfully migrated from deploy_v1 to deploy_v3.

The deployment method has been updated to use deploy_v3 with appropriate parameters, completing the transition from legacy v1 deployment.

tests/integration/test_simulate_transactions.rs (5)

33-37: Updated utility imports to support newer transaction versions.

The import list has been properly updated to include necessary types for v3 transactions.


232-238: Contract creation and declaration properly migrated to v3.

The code now correctly obtains both the contract artifact and CASM hash, then uses declare_v3 instead of declare_legacy, which aligns with the PR objective of removing v1 transaction support.


244-257: Deploy method updated from v1 to v3.

The contract deployment has been successfully migrated to use deploy_v3 with appropriate parameters, completing the transition from legacy deployment methods.


262-263: Updated calldata format for newer contract version.

The calldata format has been updated to match the expected structure for Cairo 1 contracts.


281-285: Simplified parameter passing in transaction simulation.

The parameters are now passed directly rather than being converted to hexadecimal format, which simplifies the code and improves readability.

crates/starknet-devnet-core/src/starknet/mod.rs (3)

1460-1490: Removed V1 transaction support from validation logic.

The should_transaction_skip_validation_if_sender_is_impersonated method has been updated to handle only V2 and V3 transactions, removing V1 support as intended by the PR. The code correctly matches sender addresses from the supported transaction types.


1546-1547: Updated test utility from v1 to v3.

Test utility function reference has been updated from dummy_declare_transaction_v1 to dummy_declare_transaction_v3, ensuring consistency across the codebase.


1561-1563: Added L2 gas price parameters to StarknetConfig.

The configuration has been updated to include l2_gas_price_wei and l2_gas_price_fri, which is consistent with the updated transaction handling across the PR.

crates/starknet-devnet-core/src/utils.rs (4)

81-83: Updated imports to support newer transaction types.

The imports have been modified to include DataAvailabilityMode and Tip and adjust the Fee import, which reflects the changes needed for v3 transaction support.


112-114: Improved type safety for compiled class hash constant.

Changed DUMMY_CAIRO_1_COMPILED_CLASS_HASH from a string to a Felt type, improving type safety and eliminating the need for runtime conversion.


121-144: Added support function for v3 transaction testing.

The new dummy_broadcasted_declare_tx_v3 function properly creates test instances of the v3 transaction type, which is needed to replace the removed v1 functionality.


146-164: Successfully migrated dummy transaction creation to v3.

The dummy_declare_transaction_v3 function has been updated to use the new v3 transaction structure, correctly calculating transaction hashes and properly utilizing the added helper function.

crates/starknet-devnet-core/src/starknet/add_declare_transaction.rs (10)

117-117: No issues with the new import TransactionFeeError.
The usage is appropriate for error handling.


126-126: No issues with adding ResourceBoundsWrapper.
It's adequately utilized to handle resource bounds logic.


136-138: Imported test utility functions.
All these references (e.g., dummy_broadcasted_declare_tx_v3) appear to be used in the test suite. No further issues.


160-163: Test logic updated to expect only-query transactions error.
This is consistent with dropping v1 transaction support.


185-190: Test properly checks InsufficientResourcesForValidate error.
No concerns as it aligns with updated resource bounds logic.


227-228: Test expects InsufficientAccountBalance error.
No concerns, the logic is correct.


244-245: Refactored usage of declare_txn.clone().into().
This approach is succinct and uses type inference properly.


333-349: Test ensuring error on insufficient max fee for declare v3 transactions.
The resource bounds usage is consistent with the new approach.


353-369: Test checks ResourcesBoundsExceedBalance under v3.
Logic is consistent with the new code path.


372-389: Test verifying successful storage change for v3 declare.
Implementation suits the new version.

tests/integration/test_estimate_fee.rs (12)

10-13: Additional imports for v3, resources, and error data
No immediate concerns, these are relevant for the updated test coverage.


31-31: Importing get_simple_contract_in_sierra_and_compiled_class_hash.
Ensure this function returns correct artifacts for consistent test coverage.


223-225: Using a simpler contract artifact retrieving function.
This approach is more straightforward than using legacy or advanced artifacts. Code is concise and clear.


229-231: Using declare_v3 with .gas(...).
This aligns with updated transaction flow. Ensure the chosen gas value is appropriate in test contexts.


240-240: Constructor calldata changed to a single zero.
Behavior looks correct for a minimal constructor invocation.


302-302: Test now checks final balance is 101.
This increment logic is consistent with updated invoke.


476-478: Refactored to retrieve simpler contract class.
This is consistent with the pattern in other tests.


481-483: Setting l1_gas and l1_gas_price to 0.
Double-check whether these zero values are intentional for test coverage or if non-zero could reveal potential issues.


484-487: Chaining method calls with .declare_v3(...), .gas(...), and .gas_price(...).
The structure is readable and consistent with typical builder patterns.


492-493: Signature creation for prepared_declaration.
No issues. This approach is correct for cryptographic signing in the test environment.


500-501: Switching to BroadcastedDeclareTransaction::V3.
This is consistent with the deprecation of older transaction versions.


531-533: Adjusted constructor arguments.
Ensure that this updated logic accurately models the contract's expected constructor if it’s not intentionally a no-op.

@FabijanC FabijanC marked this pull request as ready for review March 14, 2025 15:06
@FabijanC FabijanC changed the title Remove support for adding new v1 transactions (RPC 0.8.0) Remove support for adding new v1 declaration transactions (RPC 0.8.0) Mar 17, 2025
@FabijanC FabijanC merged commit 43c5f25 into starknet-0.13.4 Mar 17, 2025
1 of 2 checks passed
@FabijanC FabijanC deleted the remove-v1 branch March 17, 2025 13:40
@coderabbitai coderabbitai bot mentioned this pull request Apr 11, 2025
10 tasks
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.

2 participants