From 817eaf84d15a6acffa0dbeb9fc15608af7d1a918 Mon Sep 17 00:00:00 2001 From: Raj Raorane <41839716+Raj-RR1@users.noreply.github.com> Date: Sun, 1 Oct 2023 13:08:31 +0530 Subject: [PATCH] fix case and call index for contracts --- app/src/substrate_dispatch_V2.c | 62 ++++++++++++++++----------------- app/src/substrate_methods_V2.h | 10 +++--- tests/testcases_current.json | 10 +++--- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/app/src/substrate_dispatch_V2.c b/app/src/substrate_dispatch_V2.c index d0fe79e..ab8528b 100644 --- a/app/src/substrate_dispatch_V2.c +++ b/app/src/substrate_dispatch_V2.c @@ -1909,19 +1909,19 @@ parser_error_t _readMethod_V2( case 18711: /* module 73 call 24 */ CHECK_ERROR(_readMethod_assets_transfer_ownership_V2(c, &method->basic.assets_transfer_ownership_V2)) break; - case 18944: /* module 74 call 0 */ + case 4096: /* module 16 call 0 */ CHECK_ERROR(_readMethod_contracts_call_V2(c, &method->basic.contracts_call_V2)) break; - case 18945: /* module 74 call 1 */ + case 4098: /* module 16 call 2 */ CHECK_ERROR(_readMethod_contracts_instantiate_V2(c, &method->basic.contracts_instantiate_V2)) break; - case 18946: /* module 74 call 2 */ + case 4097: /* module 16 call 1 */ CHECK_ERROR(_readMethod_contracts_instantiate_with_code_V2(c, &method->basic.contracts_instantiate_with_code_V2)) break; - case 18947: /* module 74 call 3 */ + case 4100: /* module 16 call 4 */ CHECK_ERROR(_readMethod_contracts_remove_code_V2(c, &method->basic.contracts_remove_code_V2)) break; - case 18948: /* module 74 call 4 */ + case 4099: /* module 16 call 3 */ CHECK_ERROR(_readMethod_contracts_upload_code_V2(c, &method->basic.contracts_upload_code_V2)) break; @@ -1993,7 +1993,7 @@ const char *_getMethod_ModuleName_V2(uint8_t moduleIdx) return STR_MO_BAGSLIST; case 73: return STR_MO_ASSETS; - case 74: + case 16: return STR_MO_CONTRACTS; #endif default: @@ -2362,15 +2362,15 @@ const char *_getMethod_Name_V2_ParserFull(uint16_t callPrivIdx) return STR_ME_TRANSFER_KEEP_ALIVE; case 18711: /* module 73 call 24 */ return STR_ME_TRANSFER_OWNERSHIP; - case 18944: /* module 74 call 0 */ + case 4096: /* module 16 call 0 */ return STR_ME_CALL; - case 18945: /* module 74 call 1 */ + case 4098: /* module 16 call 2 */ return STR_ME_INSTANTIATE; - case 18946: /* module 74 call 2 */ + case 4097: /* module 16 call 1 */ return STR_ME_INSTANTIATE_WITH_CODE; - case 18947: /* module 74 call 3 */ + case 4100: /* module 16 call 4 */ return STR_ME_REMOVE_CODE; - case 18948: /* module 74 call 4 */ + case 4099: /* module 16 call 3 */ return STR_ME_UPLOAD_CODE; @@ -2730,15 +2730,15 @@ uint8_t _getMethod_NumItems_V2(uint8_t moduleIdx, uint8_t callIdx) return 3; case 18711: /* module 73 call 24 */ return 2; - case 18944: /* module 74 call 0 */ + case 4096: /* module 16 call 0 */ return 5; - case 18945: /* module 74 call 1 */ + case 4098: /* module 16 call 2 */ return 6 ; - case 18946: /* module 74 call 2 */ + case 4097: /* module 16 call 1 */ return 6; - case 18947: /* module 74 call 3 */ + case 4100: /* module 16 call 4 */ return 1; - case 18948: /* module 74 call 4 */ + case 4099: /* module 16 call 3 */ return 2; @@ -4355,7 +4355,7 @@ const char *_getMethod_ItemName_V2(uint8_t moduleIdx, uint8_t callIdx, uint8_t i default: return NULL; } - case 18944: /* module 74 call 0 */ + case 4096: /* module 16 call 0 */ switch (itemIdx) { case 0: return STR_IT_dest; @@ -4370,7 +4370,7 @@ const char *_getMethod_ItemName_V2(uint8_t moduleIdx, uint8_t callIdx, uint8_t i default: return NULL; } - case 18945: /* module 74 call 1 */ + case 4098: /* module 16 call 2 */ switch (itemIdx) { case 0: return STR_IT_value; @@ -4387,7 +4387,7 @@ const char *_getMethod_ItemName_V2(uint8_t moduleIdx, uint8_t callIdx, uint8_t i default: return NULL; } - case 18946: /* module 74 call 2 */ + case 4097: /* module 16 call 1 */ switch (itemIdx) { case 0: return STR_IT_value; @@ -4404,14 +4404,14 @@ const char *_getMethod_ItemName_V2(uint8_t moduleIdx, uint8_t callIdx, uint8_t i default: return NULL; } - case 18947: /* module 74 call 3 */ + case 4100: /* module 16 call 4 */ switch (itemIdx) { case 0: return STR_IT_code_hash; default: return NULL; } - case 18948: /* module 74 call 4 */ + case 4099: /* module 16 call 3 */ switch (itemIdx) { case 0: return STR_IT_code; @@ -6940,7 +6940,7 @@ parser_error_t _getMethod_ItemValue_V2( default: return parser_no_data; } - case 18944: /* module 74 call 0 */ + case 4096: /* module 16 call 0 */ switch (itemIdx) { case 0: /* contracts_call_V2 - dest */; return _toStringLookupasStaticLookupSource_V2( @@ -6970,7 +6970,7 @@ parser_error_t _getMethod_ItemValue_V2( default: return parser_no_data; } - case 18945: /* module 74 call 1 */ + case 4098: /* module 16 call 2 */ switch (itemIdx) { case 0: /* contracts_instantiate_V2 - value */; return _toStringCompactBalance( @@ -7007,7 +7007,7 @@ parser_error_t _getMethod_ItemValue_V2( return parser_no_data; } - case 18946: /* module 74 call 2 */ + case 4097: /* module 16 call 1 */ switch (itemIdx) { case 0: /* contracts_instantiate_with_code_V2 - value */; return _toStringCompactBalance( @@ -7043,7 +7043,7 @@ parser_error_t _getMethod_ItemValue_V2( default: return parser_no_data; } - case 18947: /* module 74 call 3 */ + case 4100: /* module 16 call 4 */ switch (itemIdx){ case 0: /* contracts_remove_code_V2 - code_hash */; return _toStringHash( @@ -7055,7 +7055,7 @@ parser_error_t _getMethod_ItemValue_V2( return parser_no_data; } - case 18948: /* module 74 call 4 */ + case 4099: /* module 16 call 3 */ switch (itemIdx) { case 0: /* contracts_upload_code_V2 - code */; return _toStringBytes( @@ -7274,11 +7274,11 @@ bool _getMethod_IsNestingSupported_V2(uint8_t moduleIdx, uint8_t callIdx) case 18709: // Assets:Transfer approved case 18710: // Assets:Transfer keep alive case 18711: // Assets:Transfer ownership - case 18944: // Contracts:Call - case 18945: // Contracts: Instantiate - case 18946: //Contracts: Instantiate with code - case 18947: //Contracts: Remove code - case 18948: //Contracts: Upload code + case 4096: // Contracts:Call + case 4098: // Contracts: Instantiate + case 4097: //Contracts: Instantiate with code + case 4100: //Contracts: Remove code + case 4099: //Contracts: Upload code return false; default: return true; diff --git a/app/src/substrate_methods_V2.h b/app/src/substrate_methods_V2.h index 5dda099..64bfa10 100644 --- a/app/src/substrate_methods_V2.h +++ b/app/src/substrate_methods_V2.h @@ -50,7 +50,7 @@ extern "C" { #define PD_CALL_ELECTIONPROVIDERMULTIPHASE_V2 36 #define PD_CALL_BAGSLIST_V2 42 #define PD_CALL_ASSETS_V2 73 -#define PD_CALL_CONTRACTS_V2 74 +#define PD_CALL_CONTRACTS_V2 16 #define PD_CALL_UTILITY_BATCH_V2 0 typedef struct { @@ -433,7 +433,7 @@ typedef struct { pd_Bytes_t data; } pd_contracts_call_V2_t; -#define PD_CALL_CONTRACTS_INSTANTIATE_V2 1 +#define PD_CALL_CONTRACTS_INSTANTIATE_V2 2 typedef struct { pd_CompactBalance_t value; pd_Compactu64_t gas_limit; @@ -443,7 +443,7 @@ typedef struct { pd_Bytes_t salt; } pd_contracts_instantiate_V2_t; -#define PD_CALL_CONTRACTS_INSTANTIATE_WITH_CODE_V2 2 +#define PD_CALL_CONTRACTS_INSTANTIATE_WITH_CODE_V2 1 typedef struct { pd_CompactBalance_t value; pd_Compactu64_t gas_limit; @@ -453,12 +453,12 @@ typedef struct { pd_Bytes_t salt; } pd_contracts_instantiate_with_code_V2_t; -#define PD_CALL_CONTRACTS_REMOVE_CODE_V2 3 +#define PD_CALL_CONTRACTS_REMOVE_CODE_V2 4 typedef struct { pd_Hash_t code_hash; } pd_contracts_remove_code_V2_t; -#define PD_CALL_CONTRACTS_UPLOAD_CODE_V2 4 +#define PD_CALL_CONTRACTS_UPLOAD_CODE_V2 3 typedef struct { pd_Bytes_t code; pd_OptionCompactu128_V2_t storage_deposit_limit; diff --git a/tests/testcases_current.json b/tests/testcases_current.json index a25226a..9c69069 100644 --- a/tests/testcases_current.json +++ b/tests/testcases_current.json @@ -8834,7 +8834,7 @@ { "index": 376, "name": "Contracts_Call", - "blob": "100200decd3e78683cdb7568c3135cd412b54b57930e0b9c7ee4c7a64762ba1ed613ef33158139ae28a3dfaac5fe1560a5e9e05c00010141685f8f7a6b927b36a04dadb2ee07b3b7d9ff17558ae7d2b0b00f8883cc148529b3479cbb429b3f22ad32e7405544f7f9e2ddd7c3273297b7e4d92168ceb158d50391010b63ce64c10c053500000002000000742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b", + "blob": "100000decd3e78683cdb7568c3135cd412b54b57930e0b9c7ee4c7a64762ba1ed613ef33158139ae28a3dfaac5fe1560a5e9e05c00010141685f8f7a6b927b36a04dadb2ee07b3b7d9ff17558ae7d2b0b00f8883cc148529b3479cbb429b3f22ad32e7405544f7f9e2ddd7c3273297b7e4d92168ceb158d50391010b63ce64c10c053500000002000000742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b", "output": [ "0 | Contracts : Call", "1 | Dest [1/2] : nYkQnG2wt4rPg6coxLF8U2ZdLYYW9L2Nkv1YC5", @@ -8871,7 +8871,7 @@ { "index": 377, "name": "Contracts_Call", - "blob": "100200decd3e78683cdb7568c3135cd412b54b57930e0b9c7ee4c7a64762ba1ed613ef000001020a834b158c1c2a1a025f459ad0423d33eb25042d71f3b30aa0b1f030dd0a3ab814e803221f0dc65b2ba5a350e69bec0a85d4e694a7a6063154d9f4d48e013919ec972e75934c5331e0025e0dfad31e87ff3679e00696e966a644d6d99ad9ffc764804ba6b88f4f75d1b6632c5d779283d7997f3606aa68fae51ea64d51ebc06bd503ae1103006d0f3500000002000000742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b", + "blob": "100000decd3e78683cdb7568c3135cd412b54b57930e0b9c7ee4c7a64762ba1ed613ef000001020a834b158c1c2a1a025f459ad0423d33eb25042d71f3b30aa0b1f030dd0a3ab814e803221f0dc65b2ba5a350e69bec0a85d4e694a7a6063154d9f4d48e013919ec972e75934c5331e0025e0dfad31e87ff3679e00696e966a644d6d99ad9ffc764804ba6b88f4f75d1b6632c5d779283d7997f3606aa68fae51ea64d51ebc06bd503ae1103006d0f3500000002000000742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b", "output": [ "0 | Contracts : Call", "1 | Dest [1/2] : nYkQnG2wt4rPg6coxLF8U2ZdLYYW9L2Nkv1YC5", @@ -8912,7 +8912,7 @@ { "index": 378, "name": "Contracts_Call", - "blob": "100200decd3e78683cdb7568c3135cd412b54b57930e0b9c7ee4c7a64762ba1ed613ef0000010141685f8f7a6b927b36a04dadb2ee07b3b7d9ff17558ae7d2b0b00f8883cc148529b3479cbb429b3f22ad32e7405544f7f9e2ddd7c3273297b7e4d92168ceb158d5030433158139ae28a3dfaac5fe1560a5e9e05c3500000002000000742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b", + "blob": "100000decd3e78683cdb7568c3135cd412b54b57930e0b9c7ee4c7a64762ba1ed613ef0000010141685f8f7a6b927b36a04dadb2ee07b3b7d9ff17558ae7d2b0b00f8883cc148529b3479cbb429b3f22ad32e7405544f7f9e2ddd7c3273297b7e4d92168ceb158d5030433158139ae28a3dfaac5fe1560a5e9e05c3500000002000000742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b", "output": [ "0 | Contracts : Call", "1 | Dest [1/2] : nYkQnG2wt4rPg6coxLF8U2ZdLYYW9L2Nkv1YC5", @@ -8949,7 +8949,7 @@ { "index": 379, "name": "Contracts_Call", - "blob": "100200decd3e78683cdb7568c3135cd412b54b57930e0b9c7ee4c7a64762ba1ed613ef33158139ae28a3dfaac5fe1560a5e9e05c0080ca9cf3dad8f276be2a153e494881b38b800fc9ba05ffcbffd3b52ff8f9f79d49d503040b63ce64c10c053500000002000000742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b", + "blob": "100000decd3e78683cdb7568c3135cd412b54b57930e0b9c7ee4c7a64762ba1ed613ef33158139ae28a3dfaac5fe1560a5e9e05c0080ca9cf3dad8f276be2a153e494881b38b800fc9ba05ffcbffd3b52ff8f9f79d49d503040b63ce64c10c053500000002000000742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b", "output": [ "0 | Contracts : Call", "1 | Dest [1/2] : nYkQnG2wt4rPg6coxLF8U2ZdLYYW9L2Nkv1YC5", @@ -8982,7 +8982,7 @@ { "index": 380, "name": "Contracts_Call", - "blob": "100200decd3e78683cdb7568c3135cd412b54b57930e0b9c7ee4c7a64762ba1ed613ef0b63ce64c10c050001024716453f25210b8bf1251fc7d47db3317d3d1c6e4b72c3c0bbe46cb51c834bd86edcc4088b301815dc3696619ea5d08a31b2cf2da750617096aa6f119f82896b88599f3ab4f7b8603be48e8c68b8296ebac0069e64ce563536a2492ff1df9babfba84007ec7be0f8509b01167dcacf65a017e5497afdda5ff1101c02b8679488d5038d248ed73e0d3500000002000000742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b", + "blob": "100000decd3e78683cdb7568c3135cd412b54b57930e0b9c7ee4c7a64762ba1ed613ef0b63ce64c10c050001024716453f25210b8bf1251fc7d47db3317d3d1c6e4b72c3c0bbe46cb51c834bd86edcc4088b301815dc3696619ea5d08a31b2cf2da750617096aa6f119f82896b88599f3ab4f7b8603be48e8c68b8296ebac0069e64ce563536a2492ff1df9babfba84007ec7be0f8509b01167dcacf65a017e5497afdda5ff1101c02b8679488d5038d248ed73e0d3500000002000000742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b", "output": [ "0 | Contracts : Call", "1 | Dest [1/2] : nYkQnG2wt4rPg6coxLF8U2ZdLYYW9L2Nkv1YC5",