Skip to content

Commit

Permalink
disable swap action to avoid code overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
abenso committed Jan 8, 2025
1 parent f21d7b5 commit 18fe341
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
14 changes: 7 additions & 7 deletions app/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ parser_error_t parser_getNumItems(const parser_context_t *ctx, uint8_t *num_item
case penumbra_core_transaction_v1_ActionPlan_output_tag:
CHECK_ERROR(output_getNumItems(ctx, &action_num_items));
break;
case penumbra_core_transaction_v1_ActionPlan_swap_tag:
CHECK_ERROR(swap_getNumItems(ctx, &action_num_items));
break;
case penumbra_core_transaction_v1_ActionPlan_ics20_withdrawal_tag:
CHECK_ERROR(ics20_withdrawal_getNumItems(ctx, &action_num_items));
break;
#if defined(FULL_APP)
case penumbra_core_transaction_v1_ActionPlan_swap_tag:
CHECK_ERROR(swap_getNumItems(ctx, &action_num_items));
break;
case penumbra_core_transaction_v1_ActionPlan_delegate_tag:
CHECK_ERROR(delegate_getNumItems(ctx, &action_num_items));
break;
Expand Down Expand Up @@ -183,16 +183,16 @@ parser_error_t parser_getItem(const parser_context_t *ctx, uint8_t displayIdx, c
CHECK_ERROR(output_getItem(ctx, &ctx->tx_obj->actions_plan[action_idx].action.output, action_idx + 1, outKey,
outKeyLen, outVal, outValLen, pageIdx, pageCount))
break;
case penumbra_core_transaction_v1_ActionPlan_swap_tag:
CHECK_ERROR(swap_getItem(ctx, &ctx->tx_obj->actions_plan[action_idx].action.swap, action_idx + 1, outKey,
outKeyLen, outVal, outValLen, pageIdx, pageCount))
break;
case penumbra_core_transaction_v1_ActionPlan_ics20_withdrawal_tag:
CHECK_ERROR(ics20_withdrawal_getItem(ctx, &ctx->tx_obj->actions_plan[action_idx].action.ics20_withdrawal,
action_idx + 1, outKey, outKeyLen, outVal, outValLen, pageIdx,
pageCount))
break;
#if defined(FULL_APP)
case penumbra_core_transaction_v1_ActionPlan_swap_tag:
CHECK_ERROR(swap_getItem(ctx, &ctx->tx_obj->actions_plan[action_idx].action.swap, action_idx + 1, outKey,
outKeyLen, outVal, outValLen, pageIdx, pageCount))
break;
case penumbra_core_transaction_v1_ActionPlan_delegate_tag:
CHECK_ERROR(delegate_getItem(ctx, &ctx->tx_obj->actions_plan[action_idx].action.delegate, action_idx + 1,
outKey, outKeyLen, outVal, outValLen, pageIdx, pageCount))
Expand Down
2 changes: 1 addition & 1 deletion app/src/parser_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ bool decode_action(pb_istream_t *stream, const pb_field_t *field, void **arg) {
CHECK_ACTION_ERROR(
decode_ics20_withdrawal_plan(&action_data_4, &decode_arg[actions_qty].action.ics20_withdrawal));
break;
#if defined(FULL_APP)
case penumbra_core_transaction_v1_ActionPlan_swap_tag:
decode_arg[actions_qty].action_data = action_data_3;
CHECK_ACTION_ERROR(decode_swap_plan(&action_data_3, &decode_arg[actions_qty].action.swap));
break;
#if defined(FULL_APP)
case penumbra_core_transaction_v1_ActionPlan_delegate_tag:
decode_arg[actions_qty].action_data = action_data_3;
CHECK_ACTION_ERROR(decode_delegate_plan(&action_data_3, &decode_arg[actions_qty].action.delegate));
Expand Down
10 changes: 5 additions & 5 deletions app/src/parser_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ zxerr_t compute_action_hash(action_t *action, bytes_t *memo_key, hash_t *output)
return zxerr_encoding_failed;
}
break;
case penumbra_core_transaction_v1_ActionPlan_swap_tag:
if (rs_swap_action_hash(&action->action.swap, (uint8_t *)output, 64) != parser_ok) {
return zxerr_encoding_failed;
}
break;
case penumbra_core_transaction_v1_ActionPlan_ics20_withdrawal_tag:
if (rs_generic_action_hash(&action->action_data, action->action_type, (uint8_t *)output, 64) != parser_ok) {
return zxerr_encoding_failed;
}
break;
#if defined(FULL_APP)
case penumbra_core_transaction_v1_ActionPlan_swap_tag:
if (rs_swap_action_hash(&action->action.swap, (uint8_t *)output, 64) != parser_ok) {
return zxerr_encoding_failed;
}
break;
case penumbra_core_transaction_v1_ActionPlan_delegate_tag:
case penumbra_core_transaction_v1_ActionPlan_undelegate_tag:
if (rs_generic_action_hash(&action->action_data, action->action_type, (uint8_t *)output, 64) != parser_ok) {
Expand Down

0 comments on commit 18fe341

Please sign in to comment.