Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocustodio committed Jun 8, 2024
1 parent 501c04c commit 33c4574
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 0 deletions.
31 changes: 31 additions & 0 deletions app/src/substrate/substrate_dispatch_V7.c
Original file line number Diff line number Diff line change
Expand Up @@ -2262,6 +2262,13 @@ __Z_INLINE parser_error_t _readMethod_fueltanks_force_batch_add_account_V7(
return parser_ok;
}

__Z_INLINE parser_error_t _readMethod_configuration_set_async_backing_params_V7(
parser_context_t* c, pd_configuration_set_async_backing_params_V7_t* m)
{
CHECK_ERROR(_readAsyncBackingParams(c, &m->new_))
return parser_ok;
}

#endif

parser_error_t _readMethod_V7(
Expand Down Expand Up @@ -3128,6 +3135,9 @@ parser_error_t _readMethod_V7(
case 65039: /* module 254 call 15 */
CHECK_ERROR(_readMethod_fueltanks_force_batch_add_account_V7(c, &method->basic.fueltanks_force_batch_add_account_V7))
break;
case 13101: /* module 51 call 45 */
CHECK_ERROR(_readMethod_configuration_set_async_backing_params_V7(c, &method->basic.configuration_set_async_backing_params_V7))
break;
#endif
default:
return parser_unexpected_callIndex;
Expand Down Expand Up @@ -3803,6 +3813,8 @@ const char* _getMethod_Name_V7_ParserFull(uint16_t callPrivIdx)
return STR_ME_FORCE_CREATE_FUEL_TANK;
case 65039: /* module 254 call 15 */
return STR_ME_FORCE_BATCH_ADD_ACCOUNT;
case 13101: /* module 51 call 45 */
return STR_ME_SET_ASYNC_BACKING_PARAMS;
#endif
default:
return NULL;
Expand Down Expand Up @@ -4387,6 +4399,8 @@ uint8_t _getMethod_NumItems_V7(uint8_t moduleIdx, uint8_t callIdx)
return 2;
case 4636: /* module 18 call 28 */
return 0;
case 13101: /* module 51 call 45 */
return 1;
#endif
default:
return 0;
Expand Down Expand Up @@ -6867,6 +6881,13 @@ const char* _getMethod_ItemName_V7(uint8_t moduleIdx, uint8_t callIdx, uint8_t i
default:
return NULL;
}
case 13101: /* module 51 call 45 */
switch (itemIdx) {
case 0:
return STR_IT_new_;
default:
return NULL;
}
#endif
default:
return NULL;
Expand Down Expand Up @@ -10883,6 +10904,16 @@ parser_error_t _getMethod_ItemValue_V7(
default:
return parser_no_data;
}
case 13101: /* module 51 call 45 */
switch (itemIdx) {
case 0: /* configuration_set_async_backing_params_V7 - new_ */;
return _toStringAsyncBackingParams(
&m->basic.configuration_set_async_backing_params_V7.new_,
outValue, outValueLen,
pageIdx, pageCount);
default:
return NULL;
}
#endif
default:
return parser_ok;
Expand Down
16 changes: 16 additions & 0 deletions app/src/substrate/substrate_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ parser_error_t _readOptionUserAccountManagement(parser_context_t* c, pd_OptionUs
parser_error_t _readOptionVecAccountRuleDescriptor(parser_context_t* c, pd_OptionVecAccountRuleDescriptor_t* v);
parser_error_t _readRulesAccountRuleDescriptor(parser_context_t* c, pd_AccountRuleDescriptor_t* v);
parser_error_t _readVecAccountRuleDescriptor(parser_context_t* c, pd_VecAccountRuleDescriptor_t* v);
parser_error_t _readAsyncBackingParams(parser_context_t* c, pd_AsyncBackingParams_t* v);


// Common toString functions
Expand Down Expand Up @@ -1641,6 +1642,21 @@ parser_error_t _toStringVecDispatchRuleDescriptor(
uint8_t pageIdx,
uint8_t* pageCount);

parser_error_t _toStringNewAsyncBackingParams(
const pd_NewAsyncBackingParams_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
uint8_t* pageCount);

parser_error_t _toStringAsyncBackingParams(
const pd_AsyncBackingParams_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
uint8_t* pageCount);


#ifdef __cplusplus
}
#endif
6 changes: 6 additions & 0 deletions app/src/substrate/substrate_methods_V7.h
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,11 @@ typedef struct {
pd_VecAccountIdLookupOfT_t user_ids;
} pd_fueltanks_force_batch_add_account_V7_t;

#define PD_CALL_CONFIGURATION_SET_ASYNC_BACKING_PARAMS_V7 45
typedef struct {
pd_AsyncBackingParams_t new_;
} pd_configuration_set_async_backing_params_V7_t;

#endif

typedef union {
Expand Down Expand Up @@ -1737,6 +1742,7 @@ typedef union {
pd_fueltanks_destroy_fuel_tank_V7_t fueltanks_destroy_fuel_tank_V7;
pd_fueltanks_force_create_fuel_tank_V7_t fueltanks_force_create_fuel_tank_V7;
pd_fueltanks_force_batch_add_account_V7_t fueltanks_force_batch_add_account_V7;
pd_configuration_set_async_backing_params_V7_t configuration_set_async_backing_params_V7;
#endif
} pd_MethodBasic_V7_t;

Expand Down
1 change: 1 addition & 0 deletions app/src/substrate/substrate_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ static const char* STR_ME_FORCE_SET_CONSUMPTION = "Force set consumption";
static const char* STR_ME_DESTROY_FUEL_TANK = "Destroy fuel tank";
static const char* STR_ME_FORCE_CREATE_FUEL_TANK = "Force create fuel tank";
static const char* STR_ME_FORCE_BATCH_ADD_ACCOUNT = "Force batch add account";
static const char* STR_ME_SET_ASYNC_BACKING_PARAMS = "Set async backing params";

// Items names
static const char* STR_IT_remark = "Remark";
Expand Down
82 changes: 82 additions & 0 deletions app/src/substrate/substrate_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -3012,6 +3012,21 @@ parser_error_t _readVoteCurrency(parser_context_t* c, pd_VoteCurrency_t* v)
return parser_ok;
}

parser_error_t _readNewAsyncBackingParams(parser_context_t* c, pd_NewAsyncBackingParams_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readu32(c, &v->max_candidate_depth))
CHECK_ERROR(_readu32(c, &v->allowed_ancestry_len))
return parser_ok;
}

parser_error_t _readAsyncBackingParams(parser_context_t* c, pd_AsyncBackingParams_t* v)
{
CHECK_INPUT()
CHECK_ERROR(_readNewAsyncBackingParams(c, &v->new_))
return parser_ok;
}


///////////////////////////////////
///////////////////////////////////
Expand Down Expand Up @@ -10448,6 +10463,73 @@ parser_error_t _toStringVecDispatchRuleDescriptor(
GEN_DEF_TOSTRING_VECTOR(DispatchRuleDescriptor);
}

parser_error_t _toStringNewAsyncBackingParams(
const pd_NewAsyncBackingParams_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
uint8_t* pageCount)
{
CLEAN_AND_CHECK()

// First measure number of pages
uint8_t pages[2] = { 0 };
CHECK_ERROR(_toStringu32(&v->max_candidate_depth, outValue, outValueLen, 0, &pages[0]))
CHECK_ERROR(_toStringu32(&v->allowed_ancestry_len, outValue, outValueLen, 0, &pages[1]))

*pageCount = 0;
for (uint8_t i = 0; i < (uint8_t)sizeof(pages); i++) {
*pageCount += pages[i];
}

if (pageIdx > *pageCount) {
return parser_display_idx_out_of_range;
}

if (pageIdx < pages[0]) {
CHECK_ERROR(_toStringu32(&v->max_candidate_depth, outValue, outValueLen, pageIdx, &pages[0]))
return parser_ok;
}
pageIdx -= pages[0];

if (pageIdx < pages[1]) {
CHECK_ERROR(_toStringu32(&v->allowed_ancestry_len, outValue, outValueLen, pageIdx, &pages[1]))
return parser_ok;
}

return parser_display_idx_out_of_range;
}

parser_error_t _toStringAsyncBackingParams(
const pd_AsyncBackingParams_t* v,
char* outValue,
uint16_t outValueLen,
uint8_t pageIdx,
uint8_t* pageCount)
{
CLEAN_AND_CHECK()

// First measure number of pages
uint8_t pages[1] = { 0 };
CHECK_ERROR(_toStringNewAsyncBackingParams(&v->new_, outValue, outValueLen, 0, &pages[0]))

*pageCount = 0;
for (uint8_t i = 0; i < (uint8_t)sizeof(pages); i++) {
*pageCount += pages[i];
}

if (pageIdx > *pageCount) {
return parser_display_idx_out_of_range;
}

if (pageIdx < pages[0]) {
CHECK_ERROR(_toStringNewAsyncBackingParams(&v->new_, outValue, outValueLen, pageIdx, &pages[0]))
return parser_ok;
}

return parser_display_idx_out_of_range;
}


///////////////////////////////////
///////////////////////////////////
Expand Down
9 changes: 9 additions & 0 deletions app/src/substrate/substrate_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1599,6 +1599,15 @@ typedef struct {
pd_OptionVecAccountRuleDescriptor_t accountRules;
} pd_FuelTankMutationOf_t;

typedef struct {
pd_u32_t max_candidate_depth;
pd_u32_t allowed_ancestry_len;
} pd_NewAsyncBackingParams_t;

typedef struct {
pd_NewAsyncBackingParams_t new_;
} pd_AsyncBackingParams_t;

#ifdef __cplusplus
}
#endif

0 comments on commit 33c4574

Please sign in to comment.