Skip to content

Commit

Permalink
fix for nanox
Browse files Browse the repository at this point in the history
  • Loading branch information
abenso committed Jan 24, 2025
1 parent ada2fcb commit 7d9ce24
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
12 changes: 9 additions & 3 deletions app/src/plan/undelegate.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,15 @@ parser_error_t undelegate_printValue(const parser_context_t *ctx, const undelega
written_value = strlen(outVal);

// add unbonded amount
snprintf((char *)metadata_buffer, sizeof(metadata_buffer), "uunbonding_start_at_%llu_%s", undelegate->from_epoch.index,
validator_identity_bytes);
metadata.len = strlen((char *)metadata_buffer);
snprintf((char *)metadata_buffer, sizeof(metadata_buffer), "uunbonding_start_at_");
uint16_t written_value_metadata = strlen((char *)metadata_buffer);
snprintf((char *)metadata_buffer + written_value_metadata, sizeof(metadata_buffer) - written_value_metadata, "%llu", undelegate->from_epoch.index);
written_value_metadata = strlen((char *)metadata_buffer);
snprintf((char *)metadata_buffer + written_value_metadata, sizeof(metadata_buffer) - written_value_metadata, "_");
written_value_metadata = strlen((char *)metadata_buffer);
snprintf((char *)metadata_buffer + written_value_metadata, sizeof(metadata_buffer) - written_value_metadata, "%s", validator_identity_bytes);
written_value_metadata = strlen((char *)metadata_buffer);
metadata.len = written_value_metadata;
rs_get_asset_id_from_metadata(&metadata, asset_id_bytes, ASSET_ID_LEN);

value_t local_unbonded_amount = {.amount = undelegate->unbonded_amount,
Expand Down
16 changes: 13 additions & 3 deletions app/src/plan/undelegate_claim.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,26 @@ parser_error_t undelegate_claim_printValue(const parser_context_t *ctx, const un
rs_get_asset_id_from_metadata(&metadata, asset_id_bytes, ASSET_ID_LEN);

// add unbonded amount
snprintf((char *)metadata_buffer, sizeof(metadata_buffer), "uunbonding_start_at_%llu_%s",
undelegate->unbonding_start_height, validator_identity_bytes);
metadata.len = strlen((char *)metadata_buffer);
snprintf((char *)metadata_buffer, sizeof(metadata_buffer), "uunbonding_start_at_");
uint16_t written_value_metadata = strlen((char *)metadata_buffer);
snprintf((char *)metadata_buffer + written_value_metadata, sizeof(metadata_buffer) - written_value_metadata, "%llu", undelegate->unbonding_start_height);
written_value_metadata = strlen((char *)metadata_buffer);
snprintf((char *)metadata_buffer + written_value_metadata, sizeof(metadata_buffer) - written_value_metadata, "_");
written_value_metadata = strlen((char *)metadata_buffer);
snprintf((char *)metadata_buffer + written_value_metadata, sizeof(metadata_buffer) - written_value_metadata, "%s", validator_identity_bytes);
written_value_metadata = strlen((char *)metadata_buffer);
metadata.len = written_value_metadata;
rs_get_asset_id_from_metadata(&metadata, asset_id_bytes, ASSET_ID_LEN);


value_t local_unbonded_amount = {.amount = undelegate->unbonding_amount,
.asset_id.inner = {.ptr = asset_id_bytes, .len = ASSET_ID_LEN},
.has_amount = true,
.has_asset_id = true};
CHECK_ERROR(printValue(ctx, &local_unbonded_amount, &ctx->tx_obj->parameters_plan.chain_id, true, outVal + written_value,
outValLen - written_value));

ZEMU_LOGF(50, "STEP 1.6 !!!\n");

return parser_ok;
}

0 comments on commit 7d9ce24

Please sign in to comment.