Add 'sender' field to review screens

This commit is contained in:
Charles-Edouard de la Vergne
2024-03-11 16:14:31 +01:00
parent 76e8690a68
commit 273dd95937
13 changed files with 66 additions and 32 deletions

View File

@@ -346,12 +346,13 @@ __attribute__((noinline)) static bool finalize_parsing_helper(bool direct, bool
tmpCtx.transactionContext.hash,
32));
uint8_t msg_sender[ADDRESS_LENGTH] = {0};
get_public_key(msg_sender, sizeof(msg_sender));
// Finalize the plugin handling
if (dataContext.tokenContext.pluginStatus >= ETH_PLUGIN_RESULT_SUCCESSFUL) {
eth_plugin_prepare_finalize(&pluginFinalize);
uint8_t msg_sender[ADDRESS_LENGTH] = {0};
get_public_key(msg_sender, sizeof(msg_sender));
pluginFinalize.address = msg_sender;
if (!eth_plugin_call(ETH_PLUGIN_FINALIZE, (void *) &pluginFinalize)) {
@@ -465,14 +466,14 @@ __attribute__((noinline)) static bool finalize_parsing_helper(bool direct, bool
chainConfig->chainId);
if (G_called_from_swap) {
// Ensure the values are the same that the ones that have been previously validated
if (strcasecmp_workaround(strings.common.fullAddress, displayBuffer) != 0) {
if (strcasecmp_workaround(strings.common.toAddress, displayBuffer) != 0) {
PRINTF("ERR_SILENT_MODE_CHECK_FAILED, address check failed\n");
THROW(ERR_SILENT_MODE_CHECK_FAILED);
}
} else {
strlcpy(strings.common.fullAddress, displayBuffer, sizeof(strings.common.fullAddress));
strlcpy(strings.common.toAddress, displayBuffer, sizeof(strings.common.toAddress));
}
PRINTF("Address displayed: %s\n", strings.common.fullAddress);
PRINTF("Address displayed: %s\n", strings.common.toAddress);
// Format the amount in a temporary buffer, if in swap case compare it with validated
// amount, else commit it
@@ -498,6 +499,19 @@ __attribute__((noinline)) static bool finalize_parsing_helper(bool direct, bool
strlcpy(strings.common.fullAmount, displayBuffer, sizeof(strings.common.fullAmount));
}
PRINTF("Amount displayed: %s\n", strings.common.fullAmount);
if (G_called_from_swap) {
// Transaction parameters are managed by the Exchange caller app!
explicit_bzero(strings.common.fromAddress, sizeof(strings.common.fromAddress));
} else {
// Format the from address in a temporary buffer
address_to_string(msg_sender,
ADDRESS_LENGTH,
strings.common.fromAddress,
sizeof(strings.common.fromAddress),
chainConfig->chainId);
PRINTF("FROM Address displayed: %s\n", strings.common.fromAddress);
}
}
// Compute the max fee in a temporary buffer, if in swap case compare it with validated max fee,