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

feat(abi): Update interface to handle array and enum contract arguments #419

Merged
merged 3 commits into from
Aug 1, 2022

Conversation

QuinnLee
Copy link
Contributor

@QuinnLee QuinnLee commented Jul 26, 2022

Update the function fragment to match specs and return the correct format for enums and arrays. Some refactors were done to make sure it works with arrays with different types.

There is still an underlying issue with one of the functions; returning a single element from an array is raising an error; see below.

Closes #420

@QuinnLee QuinnLee changed the title wip feat(abi): Update interface to handle array and enum contract arguments Jul 27, 2022
@QuinnLee QuinnLee marked this pull request as ready for review July 27, 2022 02:31
Comment on lines +113 to +115
fn take_array_string_return_single_element(a: [str[3];3]) -> str[3] {
a[0]
}
Copy link
Contributor Author

@QuinnLee QuinnLee Jul 27, 2022

Choose a reason for hiding this comment

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

This is still erroring out; The return receipt is type Panic. Anyone know what is going on?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm interesting.. Any idea whether this is an issue with the compiler or fuels-ts? Does fuels-rs have the same problem?

Copy link
Contributor Author

@QuinnLee QuinnLee Jul 28, 2022

Choose a reason for hiding this comment

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

I wrote some test for fuels-rs here @digorithm can you check these look good?

Generating the abi with cargo run --bin build-test-projects works, but on cargo test I get this error

error: proc macro panicked
    --> packages/fuels/tests/harness.rs:2310:5
     |
2310 | /     abigen!(
2311 | |         TestContract,
2312 | |         "packages/fuels/tests/test_projects/array_contract_inputs/out/debug/array_contract_inputs-abi.json"
2313 | |     );
     | |_____^
     |
     = help: message: called `Result::unwrap()` on an `Err` value: InvalidType("Expected parameter type `str[n]`, found `[str[3]; 3]`")

I'm on forc 0.19.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@QuinnLee QuinnLee Jul 29, 2022

Choose a reason for hiding this comment

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

Created FuelLabs/sway#2410 FuelLabs/fuels-rs#505 as followups. I revisit this and not block the PR

@QuinnLee QuinnLee force-pushed the ql/tests branch 2 times, most recently from 53e649c to 173ee6c Compare July 27, 2022 02:57
@github-actions
Copy link
Contributor

Total Coverage: 89.11%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
packages/abi-coder/src
   abi-coder.ts87.10%100%95.89%115, 116, 34, 34, 43, 53, 54
   index.ts100%53.85%100%
   interface.ts73.08%90.91%90.32%111, 112, 130, 142, 142, 142, 144, 144, 145, 148, 42, 47, 90
   json-abi.ts50%100%100%35, 35, 35
   utilities.ts100%100%100%
packages/abi-coder/src/coders
   abstract-coder.ts100%100%87.50%46
   array.ts50%100%93.75%23, 24
   b256.ts66.67%100%94.12%31, 32
   boolean.ts60%100%82.35%17, 19, 20, 31, 32
   byte.ts50%100%94.12%29, 30
   enum.ts66.67%100%97.14%59, 60
   number.ts100%100%100%
   string.ts100%100%100%
   struct.ts100%100%100%
   tuple.ts100%100%100%
packages/abi-coder/src/fragments
   fragment.ts100%100%100%
   function-fragment.ts87.50%100%100%13
packages/constants/src
   index.ts100%100%100%
packages/contract/src
   index.ts100%100%100%
   scripts.ts81.25%100%93.88%35, 36, 88, 89, 91, 92
   util.ts0%66.67%64.29%18, 19, 20, 23, 24, 25, 26, 27, 30, 47, 48
packages/contract/src/contracts
   contract-factory.ts40%66.67%76.47%32, 36, 37, 42, 45, 45, 45, 46, 47, 49, 50, 55, 59, 60
   contract.ts80%100%100%22
packages/contract/src/contracts/functions
   base-invocation-scope.ts93.75%100%100%144, 167
   invocation-results.ts66.67%100%100%18, 32
   invocation-scope.ts60%100%100%23, 40
   multicall-scope.ts100%100%100%
packages/contract/src/contracts/multicall/out/debug
   multicall-bin.ts100%100%100%
packages/example-contract/src/example-contract-types
   index.ts100%100%100%
packages/example-contract/src/example-contract-types/factories
   ExampleContractAbi__factory.ts100%50%83.33%37
packages/fuels/src
   index.ts100%100%100%
packages/hasher/src
   hasher.ts87.50%100%97.37%43, 61
   index.ts100%100%100%
packages/hdwallet/src
   hdwallet-spec.ts100%100%100%
   hdwallet.ts80.39%100%95.96%127, 128, 190, 191, 22, 22, 229, 24, 26, 39, 42, 43, 96, 97
   index.ts100%100%100%
packages/interfaces/src
   index.ts50%100%91.67%33, 34
packages/keystore/src
   aes-ctr-node.ts100%100%100%
   aes-ctr-web.ts100%0%24%15, 16, 17, 18, 19, 24, 25, 27, 39, 40, 41, 42, 44, 49, 51, 52, 54, 55, 57
   aes-ctr.ts80%75%72.22%19, 19, 20, 23, 26, 38
   index.ts100%100%100%
   keystore.ts50%75%100%17, 27
   randomBytes.ts50%100%100%4
   universal-crypto.ts83.33%100%72.73%15, 18, 19, 29
packages/math/src
   convert.ts66.67%100%85.71%28, 29, 37, 38, 43, 49, 49, 50, 54, 55
   index.ts100%100%100%
   math.ts100%100%100%
packages/merkle-shared/src
   common.ts100%100%100%
   cryptography.ts100%100%100%
   index.ts100%100%100%
packages/merkle/src
   binaryMerkleTree.ts71.43%100%97.01%110, 113, 72, 73
   index.ts100%100%100%
packages/merkle/src/types
   node.ts100%100%100%
packages/merklesum/src
   sumMerkleTree.ts83.33%100%97.01%128, 132, 133
packages/merklesum/src/types
   node.ts100%100%100%
   proof.ts100%100%100%
packages/mnemonic/src
   index.ts100%100%100%
   mnemonic-specs.ts100%100%100%
   mnemonic.ts80.95%100%96.08%141, 142, 157, 40, 41, 83
   utils.ts56.25%100%79.17%17, 20, 20, 20, 21, 22, 24, 24, 24, 24, 25, 29, 30, 31, 32, 33, 35, 36, 37, 58, 62, 63
packages/predicate/src
   predicate.ts73.33%100%98.04%159, 160, 165, 39, 89
packages/predicate/src/test-predicate-address
   index.ts100%100%100%
packages/predicate/src/test-predicate-false
   index.ts100%100%100%
packages/predicate/src/test-predicate-struct
   index.ts100%100%100%
packages/predicate/src/test-predicate-true
   index.ts100%100%100%
packages/predicate/src/test-predicate-u32
   index.ts100%100%100%
packages/providers/src
   coin-quantity.ts66.67%100%100%16, 19
   coin.ts100%0%100%
   index.ts100%100%100%
   provider.ts38.46%70%66.35%106, 192, 202, 203, 241, 242, 245, 246, 337, 394, 394, 394, 395, 396, 396, 396, 397, 399, 402, 404, 404, 405, 408, 413, 425, 425, 425, 426, 427, 427, 427, 428, 430, 433, 435, 435, 436, 439, 444, 446, 455, 456, 456, 457, 459, 468, 469, 469, 470, 472, 98
   util.ts27.27%42.86%37.50%15, 16, 16, 16, 16, 18, 19, 22, 25, 29, 30, 30, 31, 41, 44, 45, 45, 45, 45, 45, 47, 54, 60, 68, 73, 77, 79, 81
packages/providers/src/__generated__
   operations.ts100%64%81.44%1457, 1459, 1486, 1488, 1500, 1502, 1515, 1517, 1529, 1531, 1544, 1546, 1558, 1560, 1600, 1602, 1698, 1700
packages/providers/src/transaction-request
   index.ts100%100%100%
   input.ts77.78%100%90%35, 49, 69
   output.ts71.43%100%83.33%106, 57, 57, 75
   storage-slot.ts0%0%25%16, 17, 18, 25, 25, 25, 26, 27, 29, 30, 33
   transaction-request.ts65.22%68.52%76.98%117, 127, 139, 140, 141, 190, 191, 197, 198, 203, 204, 231, 233, 233, 234, 237, 264, 265, 288, 315, 353, 354, 366, 373, 374, 399, 400, 409, 455, 455, 456, 458, 472, 480, 481, 483, 489, 490, 498, 499, 505, 507, 534, 534, 539, 542, 73, 74, 78, 79, 80, 81, 86, 87, 88, 89
   witness.ts100%100%100%
packages/providers/src/transaction-response
   index.ts100%100%100%
   transaction-response.ts33.33%100%75.76%100, 101, 110, 110, 110, 113, 116, 117, 118, 138, 147, 148, 63, 71
packages/script/src
   errors.ts0%0%27.78%11, 11, 11, 14, 14, 14, 18, 19, 21, 21, 21, 24, 28, 29, 29, 29, 31, 31, 31, 34, 37, 37, 43, 44, 48, 49, 49, 50, 50
   index.ts100%100%100%
   script.ts28.57%66.67%77.14%114, 41, 42, 44, 45, 48, 49, 51, 52, 56, 86, 94, 95
   scripts.ts100%0%50%18, 19
packages/signer/src
   index.ts100%100%100%
   signer.ts75%100%97.30%32, 32, 34
packages/sparsemerkle/src
   deepSparseMerkleSubTree.ts66.67%60%75%13, 14, 20, 21, 37, 38
   proofs.ts63.64%100%85.11%25, 27, 27, 27, 28, 31, 32, 32, 34, 36, 37
   sparseMerkleTree.ts77.50%100%91.60%105, 106, 116, 118, 126, 128, 129, 131, 139, 139, 143, 144, 147, 161, 162, 277, 280, 98, 99
   treeHasher.ts100%100%100%
   utils.ts100%100%100%
packages/sparsemerkle/src/types
   sparseCompactMerkleProof.ts100%100%100%
   sparseMerkleProof.ts100%100%100%
packages/transactions/src
   consts.ts100%100%100%
   index.ts100%100%100%
packages/transactions/src/coders
   byte-array.ts100%100%100%
   input.ts75%100%97.53%174, 184, 197, 207
   output.ts87.50%100%98.48%316, 342, 355, 381
   receipt.ts87.50%97.06%97.27%627, 629, 630, 632, 676, 676, 714, 715, 718, 731, 773
   storage-slot.ts100%100%100%
   transaction.ts75%100%98.55%304, 314, 327, 337
   utxo-id.ts100%100%100%
   witness.ts100%100%100%
packages/typechain-target-fuels/src/codegen
   types.ts66.04%66.67%61.19%102, 104, 116, 117, 120, 120, 120, 120, 148, 149, 152, 152, 152, 152, 153, 155, 156, 159, 161, 163, 24, 25, 25, 25, 27, 27, 28, 31, 39, 41, 41, 44, 44, 45, 47, 50, 52, 52, 53, 56, 64, 64, 95, 96
packages/typechain-target-fuels/src/parser
   abiParser.ts44.44%86.96%65%148, 200, 201, 209, 210, 218, 219, 227, 228, 252, 253, 253, 263, 264, 266, 269, 269, 270, 273, 273, 274, 277, 277, 278, 280, 280, 280, 280, 281, 284, 291, 292, 294, 297, 297, 297, 297, 297, 299, 299, 299, 302, 302, 303, 304, 304, 305, 305, 305, 306, 307, 307, 310
   parseSvmTypes.ts50%100%88%127, 128, 165, 176, 187, 192, 196, 196, 196, 196, 196, 200, 206, 208, 212, 216
packages/wallet-manager/src
   wallet-manager-spec.ts100%100%100%
   wallet-manager.ts100%100%100%
packages/wallet-manager/src/storages
   memory-storage.ts100%100%100%
packages/wallet-manager/src/vaults
   mnemonic-vault.ts85.71%100%93.33%20, 70, 73
   privatekey-vault.ts60%100%95%23, 56, 57
packages/wallet/src
   index.ts100%100%100%
   test-utils.ts66.67%100%100%8
   wallet-spec.ts100%100%100%
   wallet.ts73.33%95.24%93.75%138, 147, 148, 149, 175, 199, 270, 62, 63
packages/wordlists/src
   index.ts100%100%100%
packages/wordlists/src/words
   english.ts100%100%100%

@github-actions
Copy link
Contributor

Total Coverage: 89.12%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
packages/abi-coder/src
   abi-coder.ts87.10%100%95.89%115, 116, 34, 34, 43, 53, 54
   index.ts100%53.85%100%
   interface.ts73.08%90.91%90.32%111, 112, 130, 142, 142, 142, 144, 144, 145, 148, 42, 47, 90
   json-abi.ts50%100%100%35, 35, 35
   utilities.ts100%100%100%
packages/abi-coder/src/coders
   abstract-coder.ts100%100%87.50%46
   array.ts50%100%93.75%23, 24
   b256.ts66.67%100%94.12%31, 32
   boolean.ts60%100%82.35%17, 19, 20, 31, 32
   byte.ts50%100%94.12%29, 30
   enum.ts66.67%100%97.14%59, 60
   number.ts100%100%100%
   string.ts100%100%100%
   struct.ts100%100%100%
   tuple.ts100%100%100%
packages/abi-coder/src/fragments
   fragment.ts100%100%100%
   function-fragment.ts87.50%100%100%13
packages/constants/src
   index.ts100%100%100%
packages/contract/src
   index.ts100%100%100%
   scripts.ts81.25%100%93.88%35, 36, 88, 89, 91, 92
   util.ts0%66.67%64.29%18, 19, 20, 23, 24, 25, 26, 27, 30, 47, 48
packages/contract/src/contracts
   contract-factory.ts40%66.67%77.14%33, 37, 38, 43, 46, 46, 46, 47, 48, 50, 51, 56, 60, 61
   contract.ts80%100%100%22
packages/contract/src/contracts/functions
   base-invocation-scope.ts93.75%100%100%140, 163
   invocation-results.ts66.67%100%100%14, 28
   invocation-scope.ts60%100%100%23, 40
   multicall-scope.ts100%100%100%
packages/contract/src/contracts/multicall/out/debug
   multicall-bin.ts100%100%100%
packages/example-contract/src/example-contract-types
   index.ts100%100%100%
packages/example-contract/src/example-contract-types/factories
   ExampleContractAbi__factory.ts100%50%83.33%37
packages/fuels/src
   index.ts100%100%100%
packages/hasher/src
   hasher.ts87.50%100%97.44%39, 57
   index.ts100%100%100%
packages/hdwallet/src
   hdwallet-spec.ts100%100%100%
   hdwallet.ts80.39%100%95.96%127, 128, 190, 191, 22, 22, 229, 24, 26, 39, 42, 43, 96, 97
   index.ts100%100%100%
packages/interfaces/src
   index.ts50%100%91.67%33, 34
packages/keystore/src
   aes-ctr-node.ts100%100%100%
   aes-ctr-web.ts100%0%24%15, 16, 17, 18, 19, 24, 25, 27, 39, 40, 41, 42, 44, 49, 51, 52, 54, 55, 57
   aes-ctr.ts80%75%72.22%19, 19, 20, 23, 26, 38
   index.ts100%100%100%
   keystore.ts50%75%100%17, 27
   randomBytes.ts50%100%100%4
   universal-crypto.ts83.33%100%72.73%15, 18, 19, 29
packages/math/src
   convert.ts66.67%100%85.71%28, 29, 37, 38, 43, 49, 49, 50, 54, 55
   index.ts100%100%100%
   math.ts100%100%100%
packages/merkle-shared/src
   common.ts100%100%100%
   cryptography.ts100%100%100%
   index.ts100%100%100%
packages/merkle/src
   binaryMerkleTree.ts71.43%100%97.01%110, 113, 72, 73
   index.ts100%100%100%
packages/merkle/src/types
   node.ts100%100%100%
packages/merklesum/src
   sumMerkleTree.ts83.33%100%97.01%128, 132, 133
packages/merklesum/src/types
   node.ts100%100%100%
   proof.ts100%100%100%
packages/mnemonic/src
   index.ts100%100%100%
   mnemonic-specs.ts100%100%100%
   mnemonic.ts80.95%100%96.08%141, 142, 157, 40, 41, 83
   utils.ts56.25%100%79.17%17, 20, 20, 20, 21, 22, 24, 24, 24, 24, 25, 29, 30, 31, 32, 33, 35, 36, 37, 58, 62, 63
packages/predicate/src
   predicate.ts73.33%100%98.08%160, 161, 166, 40, 90
packages/predicate/src/test-predicate-address
   index.ts100%100%100%
packages/predicate/src/test-predicate-false
   index.ts100%100%100%
packages/predicate/src/test-predicate-struct
   index.ts100%100%100%
packages/predicate/src/test-predicate-true
   index.ts100%100%100%
packages/predicate/src/test-predicate-u32
   index.ts100%100%100%
packages/providers/src
   coin-quantity.ts66.67%100%100%16, 19
   coin.ts100%0%100%
   index.ts100%100%100%
   provider.ts38.46%70%66.35%106, 192, 202, 203, 241, 242, 245, 246, 337, 394, 394, 394, 395, 396, 396, 396, 397, 399, 402, 404, 404, 405, 408, 413, 425, 425, 425, 426, 427, 427, 427, 428, 430, 433, 435, 435, 436, 439, 444, 446, 455, 456, 456, 457, 459, 468, 469, 469, 470, 472, 98
   util.ts27.27%42.86%37.50%15, 16, 16, 16, 16, 18, 19, 22, 25, 29, 30, 30, 31, 41, 44, 45, 45, 45, 45, 45, 47, 54, 60, 68, 73, 77, 79, 81
packages/providers/src/__generated__
   operations.ts100%64%81.44%1457, 1459, 1486, 1488, 1500, 1502, 1515, 1517, 1529, 1531, 1544, 1546, 1558, 1560, 1600, 1602, 1698, 1700
packages/providers/src/transaction-request
   index.ts100%100%100%
   input.ts77.78%100%90%35, 49, 69
   output.ts71.43%100%83.33%106, 57, 57, 75
   storage-slot.ts0%0%25%16, 17, 18, 25, 25, 25, 26, 27, 29, 30, 33
   transaction-request.ts65.22%70.37%76.98%117, 127, 139, 140, 141, 190, 191, 197, 198, 203, 204, 231, 233, 233, 234, 237, 264, 265, 288, 315, 353, 354, 366, 373, 374, 399, 400, 409, 455, 455, 456, 458, 472, 480, 481, 483, 489, 490, 498, 499, 505, 507, 534, 534, 539, 542, 73, 74, 78, 79, 80, 81, 86, 87, 88, 89
   witness.ts100%100%100%
packages/providers/src/transaction-response
   index.ts100%100%100%
   transaction-response.ts33.33%100%75.76%100, 101, 110, 110, 110, 113, 116, 117, 118, 138, 147, 148, 63, 71
packages/script/src
   errors.ts0%0%27.78%11, 11, 11, 14, 14, 14, 18, 19, 21, 21, 21, 24, 28, 29, 29, 29, 31, 31, 31, 34, 37, 37, 43, 44, 48, 49, 49, 50, 50
   index.ts100%100%100%
   script.ts28.57%66.67%77.14%114, 41, 42, 44, 45, 48, 49, 51, 52, 56, 86, 94, 95
   scripts.ts100%0%50%18, 19
packages/signer/src
   index.ts100%100%100%
   signer.ts75%100%97.30%32, 32, 34
packages/sparsemerkle/src
   deepSparseMerkleSubTree.ts66.67%60%75%13, 14, 20, 21, 37, 38
   proofs.ts63.64%100%85.11%25, 27, 27, 27, 28, 31, 32, 32, 34, 36, 37
   sparseMerkleTree.ts77.50%100%91.60%105, 106, 116, 118, 126, 128, 129, 131, 139, 139, 143, 144, 147, 161, 162, 277, 280, 98, 99
   treeHasher.ts100%100%100%
   utils.ts100%100%100%
packages/sparsemerkle/src/types
   sparseCompactMerkleProof.ts100%100%100%
   sparseMerkleProof.ts100%100%100%
packages/transactions/src
   consts.ts100%100%100%
   index.ts100%100%100%
packages/transactions/src/coders
   byte-array.ts100%100%100%
   input.ts75%100%97.53%174, 184, 197, 207
   output.ts87.50%100%98.48%316, 342, 355, 381
   receipt.ts87.50%97.06%97.27%627, 629, 630, 632, 676, 676, 714, 715, 718, 731, 773
   storage-slot.ts100%100%100%
   transaction.ts75%100%98.55%304, 314, 327, 337
   utxo-id.ts100%100%100%
   witness.ts100%100%100%
packages/typechain-target-fuels/src/codegen
   types.ts66.04%66.67%61.19%102, 104, 116, 117, 120, 120, 120, 120, 148, 149, 152, 152, 152, 152, 153, 155, 156, 159, 161, 163, 24, 25, 25, 25, 27, 27, 28, 31, 39, 41, 41, 44, 44, 45, 47, 50, 52, 52, 53, 56, 64, 64, 95, 96
packages/typechain-target-fuels/src/parser
   abiParser.ts44.44%86.96%65%148, 200, 201, 209, 210, 218, 219, 227, 228, 252, 253, 253, 263, 264, 266, 269, 269, 270, 273, 273, 274, 277, 277, 278, 280, 280, 280, 280, 281, 284, 291, 292, 294, 297, 297, 297, 297, 297, 299, 299, 299, 302, 302, 303, 304, 304, 305, 305, 305, 306, 307, 307, 310
   parseSvmTypes.ts50%100%88%127, 128, 165, 176, 187, 192, 196, 196, 196, 196, 196, 200, 206, 208, 212, 216
packages/wallet-manager/src
   wallet-manager-spec.ts100%100%100%
   wallet-manager.ts100%100%100%
packages/wallet-manager/src/storages
   memory-storage.ts100%100%100%
packages/wallet-manager/src/vaults
   mnemonic-vault.ts85.71%100%93.33%20, 70, 73
   privatekey-vault.ts60%100%95%23, 56, 57
packages/wallet/src
   index.ts100%100%100%
   test-utils.ts66.67%100%100%8
   wallet-spec.ts100%100%100%
   wallet.ts73.33%95.24%93.83%134, 143, 144, 145, 171, 195, 266, 58, 59
packages/wordlists/src
   index.ts100%100%100%
packages/wordlists/src/words
   english.ts100%100%100%

@QuinnLee QuinnLee requested review from a team and luizstacio July 29, 2022 12:59
LuizAsFight
LuizAsFight previously approved these changes Jul 29, 2022
Copy link
Contributor

@LuizAsFight LuizAsFight left a comment

Choose a reason for hiding this comment

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

LGTM

luizstacio
luizstacio previously approved these changes Jul 29, 2022
Copy link
Contributor

@camsjams camsjams left a comment

Choose a reason for hiding this comment

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

Small request for test coverage

@QuinnLee QuinnLee dismissed stale reviews from luizstacio and LuizAsFight via cf0516b July 30, 2022 00:33
@github-actions
Copy link
Contributor

Total Coverage: 89.12%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
packages/abi-coder/src
   abi-coder.ts87.10%100%95.89%115, 116, 34, 34, 43, 53, 54
   index.ts100%53.85%100%
   interface.ts73.08%90.91%90.32%111, 112, 130, 142, 142, 142, 144, 144, 145, 148, 42, 47, 90
   json-abi.ts50%100%100%35, 35, 35
   utilities.ts100%100%100%
packages/abi-coder/src/coders
   abstract-coder.ts100%100%87.50%46
   array.ts50%100%93.75%23, 24
   b256.ts66.67%100%94.12%31, 32
   boolean.ts60%100%82.35%17, 19, 20, 31, 32
   byte.ts50%100%94.12%29, 30
   enum.ts66.67%100%97.14%59, 60
   number.ts100%100%100%
   string.ts100%100%100%
   struct.ts100%100%100%
   tuple.ts100%100%100%
packages/abi-coder/src/fragments
   fragment.ts100%100%100%
   function-fragment.ts87.50%100%100%13
packages/constants/src
   index.ts100%100%100%
packages/contract/src
   index.ts100%100%100%
   scripts.ts81.25%100%93.88%35, 36, 88, 89, 91, 92
   util.ts0%66.67%64.29%18, 19, 20, 23, 24, 25, 26, 27, 30, 47, 48
packages/contract/src/contracts
   contract-factory.ts40%66.67%77.14%33, 37, 38, 43, 46, 46, 46, 47, 48, 50, 51, 56, 60, 61
   contract.ts80%100%100%22
packages/contract/src/contracts/functions
   base-invocation-scope.ts93.75%100%100%140, 163
   invocation-results.ts66.67%100%100%14, 28
   invocation-scope.ts60%100%100%23, 40
   multicall-scope.ts100%100%100%
packages/contract/src/contracts/multicall/out/debug
   multicall-bin.ts100%100%100%
packages/example-contract/src/example-contract-types
   index.ts100%100%100%
packages/example-contract/src/example-contract-types/factories
   ExampleContractAbi__factory.ts100%50%83.33%37
packages/fuels/src
   index.ts100%100%100%
packages/hasher/src
   hasher.ts87.50%100%97.44%39, 57
   index.ts100%100%100%
packages/hdwallet/src
   hdwallet-spec.ts100%100%100%
   hdwallet.ts80.39%100%95.96%127, 128, 190, 191, 22, 22, 229, 24, 26, 39, 42, 43, 96, 97
   index.ts100%100%100%
packages/interfaces/src
   index.ts50%100%91.67%33, 34
packages/keystore/src
   aes-ctr-node.ts100%100%100%
   aes-ctr-web.ts100%0%24%15, 16, 17, 18, 19, 24, 25, 27, 39, 40, 41, 42, 44, 49, 51, 52, 54, 55, 57
   aes-ctr.ts80%75%72.22%19, 19, 20, 23, 26, 38
   index.ts100%100%100%
   keystore.ts50%75%100%17, 27
   randomBytes.ts50%100%100%4
   universal-crypto.ts83.33%100%72.73%15, 18, 19, 29
packages/math/src
   convert.ts66.67%100%85.71%28, 29, 37, 38, 43, 49, 49, 50, 54, 55
   index.ts100%100%100%
   math.ts100%100%100%
packages/merkle-shared/src
   common.ts100%100%100%
   cryptography.ts100%100%100%
   index.ts100%100%100%
packages/merkle/src
   binaryMerkleTree.ts71.43%100%97.01%110, 113, 72, 73
   index.ts100%100%100%
packages/merkle/src/types
   node.ts100%100%100%
packages/merklesum/src
   sumMerkleTree.ts83.33%100%97.01%128, 132, 133
packages/merklesum/src/types
   node.ts100%100%100%
   proof.ts100%100%100%
packages/mnemonic/src
   index.ts100%100%100%
   mnemonic-specs.ts100%100%100%
   mnemonic.ts80.95%100%96.08%141, 142, 157, 40, 41, 83
   utils.ts56.25%100%79.17%17, 20, 20, 20, 21, 22, 24, 24, 24, 24, 25, 29, 30, 31, 32, 33, 35, 36, 37, 58, 62, 63
packages/predicate/src
   predicate.ts73.33%100%98.08%160, 161, 166, 40, 90
packages/predicate/src/test-predicate-address
   index.ts100%100%100%
packages/predicate/src/test-predicate-false
   index.ts100%100%100%
packages/predicate/src/test-predicate-struct
   index.ts100%100%100%
packages/predicate/src/test-predicate-true
   index.ts100%100%100%
packages/predicate/src/test-predicate-u32
   index.ts100%100%100%
packages/providers/src
   coin-quantity.ts66.67%100%100%16, 19
   coin.ts100%0%100%
   index.ts100%100%100%
   provider.ts38.46%70%66.35%106, 192, 202, 203, 241, 242, 245, 246, 337, 394, 394, 394, 395, 396, 396, 396, 397, 399, 402, 404, 404, 405, 408, 413, 425, 425, 425, 426, 427, 427, 427, 428, 430, 433, 435, 435, 436, 439, 444, 446, 455, 456, 456, 457, 459, 468, 469, 469, 470, 472, 98
   util.ts27.27%42.86%37.50%15, 16, 16, 16, 16, 18, 19, 22, 25, 29, 30, 30, 31, 41, 44, 45, 45, 45, 45, 45, 47, 54, 60, 68, 73, 77, 79, 81
packages/providers/src/__generated__
   operations.ts100%64%81.44%1457, 1459, 1486, 1488, 1500, 1502, 1515, 1517, 1529, 1531, 1544, 1546, 1558, 1560, 1600, 1602, 1698, 1700
packages/providers/src/transaction-request
   index.ts100%100%100%
   input.ts77.78%100%90%35, 49, 69
   output.ts71.43%100%83.33%106, 57, 57, 75
   storage-slot.ts0%0%25%16, 17, 18, 25, 25, 25, 26, 27, 29, 30, 33
   transaction-request.ts65.22%70.37%76.98%117, 127, 139, 140, 141, 190, 191, 197, 198, 203, 204, 231, 233, 233, 234, 237, 264, 265, 288, 315, 353, 354, 366, 373, 374, 399, 400, 409, 455, 455, 456, 458, 472, 480, 481, 483, 489, 490, 498, 499, 505, 507, 534, 534, 539, 542, 73, 74, 78, 79, 80, 81, 86, 87, 88, 89
   witness.ts100%100%100%
packages/providers/src/transaction-response
   index.ts100%100%100%
   transaction-response.ts33.33%100%75.76%100, 101, 110, 110, 110, 113, 116, 117, 118, 138, 147, 148, 63, 71
packages/script/src
   errors.ts0%0%27.78%11, 11, 11, 14, 14, 14, 18, 19, 21, 21, 21, 24, 28, 29, 29, 29, 31, 31, 31, 34, 37, 37, 43, 44, 48, 49, 49, 50, 50
   index.ts100%100%100%
   script.ts28.57%66.67%77.14%114, 41, 42, 44, 45, 48, 49, 51, 52, 56, 86, 94, 95
   scripts.ts100%0%50%18, 19
packages/signer/src
   index.ts100%100%100%
   signer.ts75%100%97.30%32, 32, 34
packages/sparsemerkle/src
   deepSparseMerkleSubTree.ts66.67%60%75%13, 14, 20, 21, 37, 38
   proofs.ts63.64%100%85.11%25, 27, 27, 27, 28, 31, 32, 32, 34, 36, 37
   sparseMerkleTree.ts77.50%100%91.60%105, 106, 116, 118, 126, 128, 129, 131, 139, 139, 143, 144, 147, 161, 162, 277, 280, 98, 99
   treeHasher.ts100%100%100%
   utils.ts100%100%100%
packages/sparsemerkle/src/types
   sparseCompactMerkleProof.ts100%100%100%
   sparseMerkleProof.ts100%100%100%
packages/transactions/src
   consts.ts100%100%100%
   index.ts100%100%100%
packages/transactions/src/coders
   byte-array.ts100%100%100%
   input.ts75%100%97.53%174, 184, 197, 207
   output.ts87.50%100%98.48%316, 342, 355, 381
   receipt.ts87.50%97.06%97.27%627, 629, 630, 632, 676, 676, 714, 715, 718, 731, 773
   storage-slot.ts100%100%100%
   transaction.ts75%100%98.55%304, 314, 327, 337
   utxo-id.ts100%100%100%
   witness.ts100%100%100%
packages/typechain-target-fuels/src/codegen
   types.ts66.04%66.67%61.19%102, 104, 116, 117, 120, 120, 120, 120, 148, 149, 152, 152, 152, 152, 153, 155, 156, 159, 161, 163, 24, 25, 25, 25, 27, 27, 28, 31, 39, 41, 41, 44, 44, 45, 47, 50, 52, 52, 53, 56, 64, 64, 95, 96
packages/typechain-target-fuels/src/parser
   abiParser.ts44.44%86.96%65%148, 200, 201, 209, 210, 218, 219, 227, 228, 252, 253, 253, 263, 264, 266, 269, 269, 270, 273, 273, 274, 277, 277, 278, 280, 280, 280, 280, 281, 284, 291, 292, 294, 297, 297, 297, 297, 297, 299, 299, 299, 302, 302, 303, 304, 304, 305, 305, 305, 306, 307, 307, 310
   parseSvmTypes.ts50%100%88%127, 128, 165, 176, 187, 192, 196, 196, 196, 196, 196, 200, 206, 208, 212, 216
packages/wallet-manager/src
   wallet-manager-spec.ts100%100%100%
   wallet-manager.ts100%100%100%
packages/wallet-manager/src/storages
   memory-storage.ts100%100%100%
packages/wallet-manager/src/vaults
   mnemonic-vault.ts85.71%100%93.33%20, 70, 73
   privatekey-vault.ts60%100%95%23, 56, 57
packages/wallet/src
   index.ts100%100%100%
   test-utils.ts66.67%100%100%8
   wallet-spec.ts100%100%100%
   wallet.ts73.33%95.24%93.83%134, 143, 144, 145, 171, 195, 266, 58, 59
packages/wordlists/src
   index.ts100%100%100%
packages/wordlists/src/words
   english.ts100%100%100%

@camsjams
Copy link
Contributor

@QuinnLee I think it's nice to have both your original test and this new test.

@github-actions
Copy link
Contributor

Total Coverage: 89.12%

Coverage Report
FileBranchesFuncsLinesUncovered Lines
packages/abi-coder/src
   abi-coder.ts87.10%100%95.89%115, 116, 34, 34, 43, 53, 54
   index.ts100%53.85%100%
   interface.ts73.08%90.91%90.32%111, 112, 130, 142, 142, 142, 144, 144, 145, 148, 42, 47, 90
   json-abi.ts50%100%100%35, 35, 35
   utilities.ts100%100%100%
packages/abi-coder/src/coders
   abstract-coder.ts100%100%87.50%46
   array.ts50%100%93.75%23, 24
   b256.ts66.67%100%94.12%31, 32
   boolean.ts60%100%82.35%17, 19, 20, 31, 32
   byte.ts50%100%94.12%29, 30
   enum.ts66.67%100%97.14%59, 60
   number.ts100%100%100%
   string.ts100%100%100%
   struct.ts100%100%100%
   tuple.ts100%100%100%
packages/abi-coder/src/fragments
   fragment.ts100%100%100%
   function-fragment.ts87.50%100%100%13
packages/constants/src
   index.ts100%100%100%
packages/contract/src
   index.ts100%100%100%
   scripts.ts81.25%100%93.88%35, 36, 88, 89, 91, 92
   util.ts0%66.67%64.29%18, 19, 20, 23, 24, 25, 26, 27, 30, 47, 48
packages/contract/src/contracts
   contract-factory.ts40%66.67%77.14%33, 37, 38, 43, 46, 46, 46, 47, 48, 50, 51, 56, 60, 61
   contract.ts80%100%100%22
packages/contract/src/contracts/functions
   base-invocation-scope.ts93.75%100%100%140, 163
   invocation-results.ts66.67%100%100%14, 28
   invocation-scope.ts60%100%100%23, 40
   multicall-scope.ts100%100%100%
packages/contract/src/contracts/multicall/out/debug
   multicall-bin.ts100%100%100%
packages/example-contract/src/example-contract-types
   index.ts100%100%100%
packages/example-contract/src/example-contract-types/factories
   ExampleContractAbi__factory.ts100%50%83.33%37
packages/fuels/src
   index.ts100%100%100%
packages/hasher/src
   hasher.ts87.50%100%97.44%39, 57
   index.ts100%100%100%
packages/hdwallet/src
   hdwallet-spec.ts100%100%100%
   hdwallet.ts80.39%100%95.96%127, 128, 190, 191, 22, 22, 229, 24, 26, 39, 42, 43, 96, 97
   index.ts100%100%100%
packages/interfaces/src
   index.ts50%100%91.67%33, 34
packages/keystore/src
   aes-ctr-node.ts100%100%100%
   aes-ctr-web.ts100%0%24%15, 16, 17, 18, 19, 24, 25, 27, 39, 40, 41, 42, 44, 49, 51, 52, 54, 55, 57
   aes-ctr.ts80%75%72.22%19, 19, 20, 23, 26, 38
   index.ts100%100%100%
   keystore.ts50%75%100%17, 27
   randomBytes.ts50%100%100%4
   universal-crypto.ts83.33%100%72.73%15, 18, 19, 29
packages/math/src
   convert.ts66.67%100%85.71%28, 29, 37, 38, 43, 49, 49, 50, 54, 55
   index.ts100%100%100%
   math.ts100%100%100%
packages/merkle-shared/src
   common.ts100%100%100%
   cryptography.ts100%100%100%
   index.ts100%100%100%
packages/merkle/src
   binaryMerkleTree.ts71.43%100%97.01%110, 113, 72, 73
   index.ts100%100%100%
packages/merkle/src/types
   node.ts100%100%100%
packages/merklesum/src
   sumMerkleTree.ts83.33%100%97.01%128, 132, 133
packages/merklesum/src/types
   node.ts100%100%100%
   proof.ts100%100%100%
packages/mnemonic/src
   index.ts100%100%100%
   mnemonic-specs.ts100%100%100%
   mnemonic.ts80.95%100%96.08%141, 142, 157, 40, 41, 83
   utils.ts56.25%100%79.17%17, 20, 20, 20, 21, 22, 24, 24, 24, 24, 25, 29, 30, 31, 32, 33, 35, 36, 37, 58, 62, 63
packages/predicate/src
   predicate.ts73.33%100%98.08%160, 161, 166, 40, 90
packages/predicate/src/test-predicate-address
   index.ts100%100%100%
packages/predicate/src/test-predicate-false
   index.ts100%100%100%
packages/predicate/src/test-predicate-struct
   index.ts100%100%100%
packages/predicate/src/test-predicate-true
   index.ts100%100%100%
packages/predicate/src/test-predicate-u32
   index.ts100%100%100%
packages/providers/src
   coin-quantity.ts66.67%100%100%16, 19
   coin.ts100%0%100%
   index.ts100%100%100%
   provider.ts38.46%70%66.35%106, 192, 202, 203, 241, 242, 245, 246, 337, 394, 394, 394, 395, 396, 396, 396, 397, 399, 402, 404, 404, 405, 408, 413, 425, 425, 425, 426, 427, 427, 427, 428, 430, 433, 435, 435, 436, 439, 444, 446, 455, 456, 456, 457, 459, 468, 469, 469, 470, 472, 98
   util.ts27.27%42.86%37.50%15, 16, 16, 16, 16, 18, 19, 22, 25, 29, 30, 30, 31, 41, 44, 45, 45, 45, 45, 45, 47, 54, 60, 68, 73, 77, 79, 81
packages/providers/src/__generated__
   operations.ts100%64%81.44%1457, 1459, 1486, 1488, 1500, 1502, 1515, 1517, 1529, 1531, 1544, 1546, 1558, 1560, 1600, 1602, 1698, 1700
packages/providers/src/transaction-request
   index.ts100%100%100%
   input.ts77.78%100%90%35, 49, 69
   output.ts71.43%100%83.33%106, 57, 57, 75
   storage-slot.ts0%0%25%16, 17, 18, 25, 25, 25, 26, 27, 29, 30, 33
   transaction-request.ts65.22%70.37%76.98%117, 127, 139, 140, 141, 190, 191, 197, 198, 203, 204, 231, 233, 233, 234, 237, 264, 265, 288, 315, 353, 354, 366, 373, 374, 399, 400, 409, 455, 455, 456, 458, 472, 480, 481, 483, 489, 490, 498, 499, 505, 507, 534, 534, 539, 542, 73, 74, 78, 79, 80, 81, 86, 87, 88, 89
   witness.ts100%100%100%
packages/providers/src/transaction-response
   index.ts100%100%100%
   transaction-response.ts33.33%100%75.76%100, 101, 110, 110, 110, 113, 116, 117, 118, 138, 147, 148, 63, 71
packages/script/src
   errors.ts0%0%27.78%11, 11, 11, 14, 14, 14, 18, 19, 21, 21, 21, 24, 28, 29, 29, 29, 31, 31, 31, 34, 37, 37, 43, 44, 48, 49, 49, 50, 50
   index.ts100%100%100%
   script.ts28.57%66.67%77.14%114, 41, 42, 44, 45, 48, 49, 51, 52, 56, 86, 94, 95
   scripts.ts100%0%50%18, 19
packages/signer/src
   index.ts100%100%100%
   signer.ts75%100%97.30%32, 32, 34
packages/sparsemerkle/src
   deepSparseMerkleSubTree.ts66.67%60%75%13, 14, 20, 21, 37, 38
   proofs.ts63.64%100%85.11%25, 27, 27, 27, 28, 31, 32, 32, 34, 36, 37
   sparseMerkleTree.ts77.50%100%91.60%105, 106, 116, 118, 126, 128, 129, 131, 139, 139, 143, 144, 147, 161, 162, 277, 280, 98, 99
   treeHasher.ts100%100%100%
   utils.ts100%100%100%
packages/sparsemerkle/src/types
   sparseCompactMerkleProof.ts100%100%100%
   sparseMerkleProof.ts100%100%100%
packages/transactions/src
   consts.ts100%100%100%
   index.ts100%100%100%
packages/transactions/src/coders
   byte-array.ts100%100%100%
   input.ts75%100%97.53%174, 184, 197, 207
   output.ts87.50%100%98.48%316, 342, 355, 381
   receipt.ts87.50%97.06%97.27%627, 629, 630, 632, 676, 676, 714, 715, 718, 731, 773
   storage-slot.ts100%100%100%
   transaction.ts75%100%98.55%304, 314, 327, 337
   utxo-id.ts100%100%100%
   witness.ts100%100%100%
packages/typechain-target-fuels/src/codegen
   types.ts66.04%66.67%61.19%102, 104, 116, 117, 120, 120, 120, 120, 148, 149, 152, 152, 152, 152, 153, 155, 156, 159, 161, 163, 24, 25, 25, 25, 27, 27, 28, 31, 39, 41, 41, 44, 44, 45, 47, 50, 52, 52, 53, 56, 64, 64, 95, 96
packages/typechain-target-fuels/src/parser
   abiParser.ts44.44%86.96%65%148, 200, 201, 209, 210, 218, 219, 227, 228, 252, 253, 253, 263, 264, 266, 269, 269, 270, 273, 273, 274, 277, 277, 278, 280, 280, 280, 280, 281, 284, 291, 292, 294, 297, 297, 297, 297, 297, 299, 299, 299, 302, 302, 303, 304, 304, 305, 305, 305, 306, 307, 307, 310
   parseSvmTypes.ts50%100%88%127, 128, 165, 176, 187, 192, 196, 196, 196, 196, 196, 200, 206, 208, 212, 216
packages/wallet-manager/src
   wallet-manager-spec.ts100%100%100%
   wallet-manager.ts100%100%100%
packages/wallet-manager/src/storages
   memory-storage.ts100%100%100%
packages/wallet-manager/src/vaults
   mnemonic-vault.ts85.71%100%93.33%20, 70, 73
   privatekey-vault.ts60%100%95%23, 56, 57
packages/wallet/src
   index.ts100%100%100%
   test-utils.ts66.67%100%100%8
   wallet-spec.ts100%100%100%
   wallet.ts73.33%95.24%93.83%134, 143, 144, 145, 171, 195, 266, 58, 59
packages/wordlists/src
   index.ts100%100%100%
packages/wordlists/src/words
   english.ts100%100%100%

@QuinnLee
Copy link
Contributor Author

@QuinnLee I think it's nice to have both your original test and this new test.

🤦🏼 my bad. I think I still have brain fog from covid. I pushed an update - more tests with bool, b256 and strings

Copy link
Contributor

@camsjams camsjams left a comment

Choose a reason for hiding this comment

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

Amazing!

@QuinnLee QuinnLee requested a review from a team August 1, 2022 15:42
Copy link
Contributor

@LuizAsFight LuizAsFight left a comment

Choose a reason for hiding this comment

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

lgtm

@QuinnLee QuinnLee merged commit 212d51c into master Aug 1, 2022
@QuinnLee QuinnLee deleted the ql/tests branch August 1, 2022 21:12
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.

Update function format and sighash to work with array data types
5 participants