-
Notifications
You must be signed in to change notification settings - Fork 33
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
fix: migrate contract test #470
fix: migrate contract test #470
Conversation
To view this pull requests documentation preview, visit the following URL: docs.page/focustree/starknet.dart~470 Documentation is deployed and generated using docs.page. |
WalkthroughThis pull request updates the project's tool version management by specifying Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Counter
Client->>Counter: Deploy Counter Contract (constructor)
Client->>Counter: Call increment()
Counter-->>Client: Return updated count
Client->>Counter: Call decrement()
Counter-->>Client: Return updated count
sequenceDiagram
participant Client
participant Hello
Client->>Hello: Deploy Hello Contract (constructor)
Client->>Hello: Call set_name("Alice")
Hello-->>Client: Acknowledge name set
Client->>Hello: Call get_name()
Hello-->>Client: Return "Alice"
Client->>Hello: Call sum(3,4)
Hello-->>Client: Return 7
Possibly related PRs
Suggested labels
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Nitpick comments (1)
contracts/v2.6.2/src/lib.cairo (1)
1-3
: Consider alphabetizing module declarations.For better organization and readability, consider ordering the modules alphabetically:
-mod counter; -mod erc20; -mod hello; +mod counter; +mod hello; +mod erc20;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
contracts/v2.6.2/.tool-versions
(1 hunks)contracts/v2.6.2/src/lib.cairo
(1 hunks)contracts/v2.6.2/target/dev/contract2.starknet_artifacts.json
(1 hunks)contracts/v2.6.2/target/dev/contract2_Counter.compiled_contract_class.json
(1 hunks)contracts/v2.6.2/target/dev/contract2_Counter.contract_class.json
(1 hunks)contracts/v2.6.2/target/dev/contract2_hello.compiled_contract_class.json
(1 hunks)contracts/v2.6.2/target/dev/contract2_hello.contract_class.json
(1 hunks)contracts/v2.6.2/target/dev/starknet_dart.starknet_artifacts.json
(0 hunks)packages/starknet/test/contract/contract_test.dart
(3 hunks)packages/starknet/test/contract/parse_test.dart
(1 hunks)
💤 Files with no reviewable changes (1)
- contracts/v2.6.2/target/dev/starknet_dart.starknet_artifacts.json
✅ Files skipped from review due to trivial changes (2)
- contracts/v2.6.2/.tool-versions
- contracts/v2.6.2/target/dev/contract2_hello.contract_class.json
🧰 Additional context used
🧠 Learnings (3)
contracts/v2.6.2/src/lib.cairo (1)
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: contracts/v2.6.2/src/counter.cairo:28-31
Timestamp: 2024-11-12T04:15:58.361Z
Learning: The file `contracts/v2.6.2/src/counter.cairo` is an example file and doesn't need additional checks.
contracts/v2.6.2/target/dev/contract2.starknet_artifacts.json (3)
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: contracts/v1/artifacts/contract2_Counter2.contract_class.json:1-1
Timestamp: 2024-11-12T04:15:58.361Z
Learning: Files in `contracts/v1/artifacts/` are automatically generated by the compiler and should not be modified directly.
Learnt from: rukafe0x
PR: focustree/starknet.dart#411
File: contracts/v1/artifacts/contract2_Counter.compiled_contract_class.json:1-1
Timestamp: 2024-11-12T04:15:58.361Z
Learning: The file `contracts/v1/artifacts/contract2_Counter.compiled_contract_class.json` contains the correct Counter contract implementation and does not contain ERC20 functions.
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: contracts/v1/artifacts/contract2_Counter3.contract_class.json:1-1
Timestamp: 2024-11-12T04:15:58.361Z
Learning: Files in the `contracts/v1/artifacts/` directory are automatically generated by the compiler and should not be modified manually.
contracts/v2.6.2/target/dev/contract2_Counter.contract_class.json (1)
Learnt from: rukafe0x
PR: focustree/starknet.dart#412
File: contracts/v1/artifacts/contract2_Counter2.contract_class.json:1-1
Timestamp: 2024-11-12T04:15:58.361Z
Learning: Files in `contracts/v1/artifacts/` are automatically generated by the compiler and should not be modified directly.
🔇 Additional comments (7)
packages/starknet/test/contract/parse_test.dart (1)
7-21
: LGTM! Test structure and path updates look good.The changes properly update the contract path to the new structure and add appropriate test categorization tags.
packages/starknet/test/contract/contract_test.dart (2)
14-14
: LGTM! Path updates align with the new structure.The contract paths have been correctly updated to use the new v0/artifacts directory structure.
Also applies to: 25-25
38-86
: LGTM! Well-structured tests for Cairo 2.6.2 contracts.The new test group:
- Properly documents the tool version used for hash computation
- Comprehensively tests both contract and compiled contract class hashes
- Uses a clean data-driven approach with a dictionary of expected hashes
- Includes clear error messages for debugging
contracts/v2.6.2/target/dev/contract2.starknet_artifacts.json (1)
1-1
: LGTM! Auto-generated artifact file with correct structure.The artifact file contains the expected metadata for all contracts (Counter, hello, and MyToken) with proper module paths and artifact references.
contracts/v2.6.2/target/dev/contract2_hello.compiled_contract_class.json (1)
1-100
: JSON Structure Completeness and Consistency
This new compiled contract class JSON file correctly introduces the expected fields for Cairo 2.6.2 contracts. The inclusion of the"prime"
,"compiler_version"
,"bytecode"
,"bytecode_segment_lengths"
,"hints"
, and"entry_points_by_type"
keys appears comprehensive. Please verify that the values in"bytecode_segment_lengths"
accurately reflect the segmentation of the long"bytecode"
array as produced by the compiler.contracts/v2.6.2/target/dev/contract2_Counter.contract_class.json (1)
1-120
: Contract Class Schema and ABI Verification
This contract class JSON for the Counter contract is detailed and includes extensive information such as the"sierra_program"
, extensive debugging info under"sierra_program_debug_info"
, and an updated"contract_class_version": "0.1.0"
. The ABI section correctly lists the new functions (increment
,decrement
,increase_count_by
,get_current_count
), along with the constructor and event information. Ensure that the"function_idx"
values and selectors in"entry_points_by_type"
are fully aligned with the corresponding implementations in the Cairo source code.contracts/v2.6.2/target/dev/contract2_Counter.compiled_contract_class.json (1)
1-100
: Compiled Contract JSON Verification for Counter
This new JSON file for the compiled version of the Counter contract faithfully replicates the required structure for compiled contracts. It includes the"prime"
and"compiler_version"
fields along with the"bytecode"
,"bytecode_segment_lengths"
, and a comprehensive"hints"
array. The"entry_points_by_type"
field properly distinguishes between external entry points and the constructor. Please double-check that the numeric values (such as segment lengths and offsets) correctly match the output from the compiler and that the provided built-in requirements (e.g.,"range_check"
) are as expected.
Summary by CodeRabbit
New Features
Chores
Tests