Skip to content

Commit

Permalink
fix utility pallet as per runtime and log a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Raj-RR1 committed Sep 6, 2023
1 parent 3acf0af commit 17e74e0
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 90 deletions.
146 changes: 73 additions & 73 deletions app/src/substrate_dispatch_V2.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@
#include "zxmacros.h"
#include <stdint.h>

__Z_INLINE parser_error_t _readMethod_utility_batch_V2(
parser_context_t *c, pd_utility_batch_V2_t *m)
{
CHECK_ERROR(_readVecCall(c, &m->calls))
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_utility_batch_all_V2(
parser_context_t *c, pd_utility_batch_all_V2_t *m)
{
CHECK_ERROR(_readVecCall(c, &m->calls))
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_balances_transfer_V2(
parser_context_t *c, pd_balances_transfer_V2_t *m)
{
Expand Down Expand Up @@ -145,20 +159,6 @@ __Z_INLINE parser_error_t _readMethod_session_purge_keys_V2(
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_utility_batch_V2(
parser_context_t *c, pd_utility_batch_V2_t *m)
{
CHECK_ERROR(_readVecCall(c, &m->calls))
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_utility_batch_all_V2(
parser_context_t *c, pd_utility_batch_all_V2_t *m)
{
CHECK_ERROR(_readVecCall(c, &m->calls))
return parser_ok;
}

#ifdef SUBSTRATE_PARSER_FULL
__Z_INLINE parser_error_t _readMethod_system_fill_block_V2(
parser_context_t *c, pd_system_fill_block_V2_t *m)
Expand Down Expand Up @@ -1397,7 +1397,12 @@ parser_error_t _readMethod_V2(

switch (callPrivIdx)
{

case 256: /* module 1 call 0 */
CHECK_ERROR(_readMethod_utility_batch_V2(c, &method->basic.utility_batch_V2))
break;
case 258: /* module 1 call 2 */
CHECK_ERROR(_readMethod_utility_batch_all_V2(c, &method->basic.utility_batch_all_V2))
break;
case 1280: /* module 5 call 0 */
CHECK_ERROR(_readMethod_balances_transfer_V2(c, &method->nested.balances_transfer_V2))
break;
Expand Down Expand Up @@ -1449,12 +1454,6 @@ parser_error_t _readMethod_V2(
case 2305: /* module 9 call 1 */
CHECK_ERROR(_readMethod_session_purge_keys_V2(c, &method->basic.session_purge_keys_V2))
break;
case 6656: /* module 26 call 0 */
CHECK_ERROR(_readMethod_utility_batch_V2(c, &method->basic.utility_batch_V2))
break;
case 6658: /* module 26 call 2 */
CHECK_ERROR(_readMethod_utility_batch_all_V2(c, &method->basic.utility_batch_all_V2))
break;

#ifdef SUBSTRATE_PARSER_FULL
case 0: /* module 0 call 0 */
Expand Down Expand Up @@ -1944,14 +1943,15 @@ const char *_getMethod_ModuleName_V2(uint8_t moduleIdx)
{
switch (moduleIdx)
{
case 1:
return STR_MO_UTILITY;
case 5:
return STR_MO_BALANCES;
case 7:
return STR_MO_STAKING;
case 9:
return STR_MO_SESSION;
case 26:
return STR_MO_UTILITY;

#ifdef SUBSTRATE_PARSER_FULL
case 0:
return STR_MO_SYSTEM;
Expand Down Expand Up @@ -2009,6 +2009,10 @@ const char *_getMethod_Name_V2(uint8_t moduleIdx, uint8_t callIdx)

switch (callPrivIdx)
{
case 256: /* module 1 call 0 */
return STR_ME_BATCH;
case 258: /* module 1 call 2 */
return STR_ME_BATCH_ALL;
case 1280: /* module 5 call 0 */
return STR_ME_TRANSFER;
case 1282: /* module 5 call 2 */
Expand Down Expand Up @@ -2043,10 +2047,6 @@ const char *_getMethod_Name_V2(uint8_t moduleIdx, uint8_t callIdx)
return STR_ME_SET_KEYS;
case 2305: /* module 9 call 1 */
return STR_ME_PURGE_KEYS;
case 6656: /* module 26 call 0 */
return STR_ME_BATCH;
case 6658: /* module 26 call 2 */
return STR_ME_BATCH_ALL;

default:
return _getMethod_Name_V2_ParserFull(callPrivIdx);
Expand Down Expand Up @@ -2388,6 +2388,10 @@ uint8_t _getMethod_NumItems_V2(uint8_t moduleIdx, uint8_t callIdx)

switch (callPrivIdx)
{
case 256: /* module 1 call 0 */
return 1;
case 258: /* module 1 call 2 */
return 1;
case 1280: /* module 5 call 0 */
return 2;
case 1282: /* module 5 call 2 */
Expand Down Expand Up @@ -2422,10 +2426,6 @@ uint8_t _getMethod_NumItems_V2(uint8_t moduleIdx, uint8_t callIdx)
return 2;
case 2305: /* module 9 call 1 */
return 0;
case 6656: /* module 26 call 0 */
return 1;
case 6658: /* module 26 call 2 */
return 1;

#ifdef SUBSTRATE_PARSER_FULL
case 0: /* module 0 call 0 */
Expand Down Expand Up @@ -2756,6 +2756,22 @@ const char *_getMethod_ItemName_V2(uint8_t moduleIdx, uint8_t callIdx, uint8_t i

switch (callPrivIdx)
{
case 256: /* module 1 call 0 */
switch (itemIdx)
{
case 0:
return STR_IT_calls;
default:
return NULL;
}
case 258: /* module 1 call 2 */
switch (itemIdx)
{
case 0:
return STR_IT_calls;
default:
return NULL;
}
case 1280: /* module 5 call 0 */
switch (itemIdx)
{
Expand Down Expand Up @@ -2906,24 +2922,7 @@ const char *_getMethod_ItemName_V2(uint8_t moduleIdx, uint8_t callIdx, uint8_t i
default:
return NULL;
}
case 6656: /* module 26 call 0 */
switch (itemIdx)
{
case 0:
return STR_IT_calls;
default:
return NULL;
}
case 6658: /* module 26 call 2 */
switch (itemIdx)
{
case 0:
return STR_IT_calls;
default:
return NULL;
}



#ifdef SUBSTRATE_PARSER_FULL
case 0: /* module 0 call 0 */
switch (itemIdx)
Expand Down Expand Up @@ -4440,6 +4439,28 @@ parser_error_t _getMethod_ItemValue_V2(

switch (callPrivIdx)
{
case 256: /* module 1 call 0 */
switch (itemIdx)
{
case 0: /* utility_batch_V2 - calls */;
return _toStringVecCall(
&m->basic.utility_batch_V2.calls,
outValue, outValueLen,
pageIdx, pageCount);
default:
return parser_no_data;
}
case 258: /* module 1 call 2 */
switch (itemIdx)
{
case 0: /* utility_batch_all_V2 - calls */;
return _toStringVecCall(
&m->basic.utility_batch_all_V2.calls,
outValue, outValueLen,
pageIdx, pageCount);
default:
return parser_no_data;
}
case 1280: /* module 5 call 0 */
switch (itemIdx)
{
Expand Down Expand Up @@ -4662,28 +4683,7 @@ parser_error_t _getMethod_ItemValue_V2(
default:
return parser_no_data;
}
case 6656: /* module 26 call 0 */
switch (itemIdx)
{
case 0: /* utility_batch_V2 - calls */;
return _toStringVecCall(
&m->basic.utility_batch_V2.calls,
outValue, outValueLen,
pageIdx, pageCount);
default:
return parser_no_data;
}
case 6658: /* module 26 call 2 */
switch (itemIdx)
{
case 0: /* utility_batch_all_V2 - calls */;
return _toStringVecCall(
&m->basic.utility_batch_all_V2.calls,
outValue, outValueLen,
pageIdx, pageCount);
default:
return parser_no_data;
}


#ifdef SUBSTRATE_PARSER_FULL
case 0: /* module 0 call 0 */
Expand Down Expand Up @@ -7122,6 +7122,8 @@ bool _getMethod_IsNestingSupported_V2(uint8_t moduleIdx, uint8_t callIdx)

switch (callPrivIdx)
{
case 256: // Utility:Batch
case 258: // Utility:Batch all
case 2560: // Preimage:Note preimage
case 2561: // Preimage:Unnote preimage
case 2562: // Preimage:Request preimage
Expand Down Expand Up @@ -7205,8 +7207,6 @@ bool _getMethod_IsNestingSupported_V2(uint8_t moduleIdx, uint8_t callIdx)
case 6402: // Vesting:Vested transfer
case 6403: // Vesting:Force vested transfer
case 6404: // Vesting:Merge schedules
case 6656: // Utility:Batch
case 6658: // Utility:Batch all
case 6913: // Recovery:Cancel recovered
case 6914: // Recovery:Claim recovery
case 6915: // Recovery:Close recovery
Expand Down
25 changes: 13 additions & 12 deletions app/src/substrate_methods_V2.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern "C" {
#include <stdint.h>

#define PD_CALL_SYSTEM_V2 0
#define PD_CALL_UTILITY_V2 1
#define PD_CALL_PREIMAGE_V2 10
#define PD_CALL_TIMESTAMP_V2 3
#define PD_CALL_INDICES_V2 4
Expand All @@ -39,7 +40,6 @@ extern "C" {
#define PD_CALL_PHRAGMENELECTION_V2 17
#define PD_CALL_TREASURY_V2 19
#define PD_CALL_VESTING_V2 25
#define PD_CALL_UTILITY_V2 26
#define PD_CALL_RECOVERY_V22 27
#define PD_CALL_IDENTITY_V2 28
#define PD_CALL_PROXY_V2 29
Expand All @@ -52,6 +52,16 @@ extern "C" {
#define PD_CALL_ASSETS_V2 73
#define PD_CALL_CONTRACTS_V2 74

#define PD_CALL_UTILITY_BATCH_V2 0
typedef struct {
pd_VecCall_t calls;
} pd_utility_batch_V2_t;

#define PD_CALL_UTILITY_BATCH_ALL_V2 2
typedef struct {
pd_VecCall_t calls;
} pd_utility_batch_all_V2_t;

#define PD_CALL_BALANCES_TRANSFER_ALL_V2 4
typedef struct {
pd_LookupasStaticLookupSource_V2_t dest;
Expand Down Expand Up @@ -125,15 +135,6 @@ typedef struct {
typedef struct {
} pd_session_purge_keys_V2_t;

#define PD_CALL_UTILITY_BATCH_V2 0
typedef struct {
pd_VecCall_t calls;
} pd_utility_batch_V2_t;

#define PD_CALL_UTILITY_BATCH_ALL_V2 2
typedef struct {
pd_VecCall_t calls;
} pd_utility_batch_all_V2_t;

#ifdef SUBSTRATE_PARSER_FULL

Expand Down Expand Up @@ -984,6 +985,8 @@ typedef struct {
#endif

typedef union {
pd_utility_batch_V2_t utility_batch_V2;
pd_utility_batch_all_V2_t utility_batch_all_V2;
pd_balances_transfer_all_V2_t balances_transfer_all_V2;
pd_staking_bond_V2_t staking_bond_V2;
pd_staking_bond_extra_V2_t staking_bond_extra_V2;
Expand All @@ -998,8 +1001,6 @@ typedef union {
pd_staking_rebond_V2_t staking_rebond_V2;
pd_session_set_keys_V2_t session_set_keys_V2;
pd_session_purge_keys_V2_t session_purge_keys_V2;
pd_utility_batch_V2_t utility_batch_V2;
pd_utility_batch_all_V2_t utility_batch_all_V2;
#ifdef SUBSTRATE_PARSER_FULL
pd_preimage_note_preimage_V2_t preimage_note_preimage_V2;
pd_preimage_unnote_preimage_V2_t preimage_unnote_preimage_V2;
Expand Down
9 changes: 4 additions & 5 deletions tests_zemu/tests/sr25519.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ describe('SR25519', function () {
// do not wait here.. we need to navigate
const signatureRequest = app.sign(pathAccount, pathChange, pathIndex, txBlob, 1)
// Wait until we are not in the main menu
console.log("Before the main menu")
await sim.waitUntilScreenIsNot(sim.getMainMenuSnapshot())

console.log("We are in the main menu")
await sim.compareSnapshotsAndApprove('.', 's-sign_basic_normal')

const signatureResponse = await signatureRequest
Expand All @@ -152,7 +151,7 @@ describe('SR25519', function () {
} finally {
await sim.close()
}
},100000)
})

test('sign basic expert', async function () {
const sim = new Zemu(APP_PATH)
Expand Down Expand Up @@ -201,7 +200,7 @@ describe('SR25519', function () {
} finally {
await sim.close()
}
},100000)
})

test('sign large nomination', async function () {
const sim = new Zemu(APP_PATH)
Expand Down Expand Up @@ -243,5 +242,5 @@ describe('SR25519', function () {
} finally {
await sim.close()
}
},100000)
})
})

0 comments on commit 17e74e0

Please sign in to comment.