-
Notifications
You must be signed in to change notification settings - Fork 751
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
Make starknet.js and abiwan fully compatible #877
Comments
We'll start by first debugging the failed tests, identify why they are not working and then list all incompatible types |
I fixed most of the tests, there was a missing Only 3 tests are failing now, see output below, one because Test output
FAIL __tests__/cairo1_typed.test.ts (108.043 s)
TS validation for API & Contract interactions - tests skipped
✓ Declare & deploy v2 - Hello Cairo 1 contract (10 ms)
✓ ContractFactory on Cairo1 (5681 ms)
✓ deployContract Cairo1 (4394 ms)
✓ GetClassByHash (107 ms)
✓ GetClassAt (56 ms)
✓ isCairo1
✓ Cairo 1 Contract Interaction - skip invoke validation & call parsing (5443 ms)
✓ Cairo 1 Contract Interaction - felt252 (5446 ms)
✓ Cairo 1 Contract Interaction - uint 8, 16, 32, 64, 128 (9823 ms)
✓ Cairo 1 - uint256 (2182 ms)
✓ Cairo 1 Contract Interaction - bool (16320 ms)
✓ Cairo 1 Contract Interaction - ContractAddress (5438 ms)
✓ Cairo1 simple getStorageAt variables retrieval (21708 ms)
✕ Cairo 1 Contract Interaction - echo flat un-named un-nested tuple (1 ms)
✓ Cairo 1 Contract Interaction - echo flat un-nested Array u8, uint256, bool (4364 ms)
✓ Cairo 1 Contract Interaction - echo flat un-nested Struct (1091 ms)
✕ Cairo 1 more complex structs (5443 ms)
✓ C1 Array 2D (13059 ms)
✕ mix tuples (1089 ms)
✓ myCallData.compile for Cairo 1 (3 ms)
○ skipped validate TS for redeclare - skip testing
Sequencer only
○ skipped getCompiledClassByClassHash
Cairo1 Testnet
TS validation for Sequencer API - C1 T2 C:0x771bbe2ba64f... - tests skipped
○ skipped getCompiledClassByClassHash
○ skipped GetClassByHash
○ skipped GetClassAt
○ skipped Cairo 1 Contract Interaction - felt252
○ skipped Cairo 1 Contract Interaction - uint 8, 16, 32, 64, 128
○ skipped Cairo 1 - uint256 struct
○ skipped Cairo 1 - uint256 by a bignumber
○ skipped Cairo 1 Contract Interaction - bool
● TS validation for API & Contract interactions - tests skipped › Cairo 1 Contract Interaction - echo flat un-named un-nested tuple
Validate: arg a should be a tuple (defined as object)
1 | export default function assert(condition: any, message?: string): asserts condition {
2 | if (!condition) {
> 3 | throw new Error(message || 'Assertion failure');
| ^
4 | }
5 | }
6 |
at assert (src/utils/assert.ts:3:11)
at validateTuple (src/utils/calldata/validate.ts:192:9)
at validateTuple (src/utils/calldata/validate.ts:282:9)
at Array.reduce (<anonymous>)
at reduce (src/utils/calldata/validate.ts:257:20)
at CallData.validate (src/utils/calldata/index.ts:96:19)
at validate (src/contract/default.ts:234:23)
at callback (src/contract/default.ts:113:10)
at Contract.getCalldata [as call] (src/contract/default.ts:232:22)
at Contract.call [as echo_un_tuple] (src/contract/default.ts:59:21)
at Object.echo_un_tuple (__tests__/cairo1_typed.test.ts:230:41)
● TS validation for API & Contract interactions - tests skipped › Cairo 1 more complex structs
expect(received).toEqual(expected) // deep equality
- Expected - 2
+ Received + 2
@@ -8,13 +8,13 @@
"address": 2846891009026995430665703316224827616914889274105712248413538305735679628945n,
"is_claimed": false,
},
"creation_time": 1n,
"creator": 2846891009026995430665703316224827616914889274105712248413538305735679628945n,
- "description": 6579555n,
+ "description": "dec",
"expire_date": 1n,
"is_cancelled": false,
"is_voted": false,
- "name": 1952805748n,
+ "name": "test",
"pool": 10n,
"winner": false,
}
290 | amount: 1000n,
291 | };
> 292 | expect(expected).toEqual(status);
| ^
293 | });
294 |
295 | test('C1 Array 2D', async () => {
at Object.toEqual (__tests__/cairo1_typed.test.ts:292:22)
● TS validation for API & Contract interactions - tests skipped › mix tuples
Validate: arg a should be a tuple (defined as object)
1 | export default function assert(condition: any, message?: string): asserts condition {
2 | if (!condition) {
> 3 | throw new Error(message || 'Assertion failure');
| ^
4 | }
5 | }
6 |
at assert (src/utils/assert.ts:3:11)
at validateTuple (src/utils/calldata/validate.ts:192:9)
at validateTuple (src/utils/calldata/validate.ts:282:9)
at Array.reduce (<anonymous>)
at reduce (src/utils/calldata/validate.ts:257:20)
at CallData.validate (src/utils/calldata/index.ts:96:19)
at validate (src/contract/default.ts:234:23)
at callback (src/contract/default.ts:113:10)
at Contract.getCalldata [as call] (src/contract/default.ts:232:22)
at Contract.call [as tuple_echo] (src/contract/default.ts:59:21)
at Object.tuple_echo (__tests__/cairo1_typed.test.ts:338:39)
Test Suites: 1 failed, 1 total
Tests: 3 failed, 10 skipped, 17 passed, 30 total
Snapshots: 0 total
Time: 108.077 s
Ran all test suites matching /.\/__tests__\/cairo1_typed.test.ts/i. |
So far, the incompatible types we discovered are:
|
Describe the bug
While investigating keep-starknet-strange/abi-wan-kanabi#46, we realize abiwan and starketjs aren't fully compatible
To Reproduce
Run the tests in
./__tests__/cairo1_typed.test.ts
Expected behavior
All tests should pass
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Test output
The text was updated successfully, but these errors were encountered: