Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
apaillier-ledger authored and cedelavergne-ledger committed Jun 20, 2024
1 parent 18889d6 commit e503373
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
11 changes: 9 additions & 2 deletions src_bagl/ui_flow_signTx.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ void ux_approve_tx(bool fromPlugin) {
if (fromPlugin) {
// Add the special dynamic display logic
ux_approval_tx_flow[step++] = &ux_plugin_approval_id_step;
if (pluginType != EXTERNAL) {
if (strings.common.fromAddress[0] != 0) {
ux_approval_tx_flow[step++] = &ux_approval_from_step;
}
}
ux_approval_tx_flow[step++] = &ux_plugin_approval_before_step;
ux_approval_tx_flow[step++] = &ux_plugin_approval_display_step;
ux_approval_tx_flow[step++] = &ux_plugin_approval_after_step;
Expand All @@ -234,6 +239,9 @@ void ux_approve_tx(bool fromPlugin) {
uint64_t chain_id = get_tx_chain_id();
if (has_domain_name(&chain_id, tmpContent.txContent.destination)) {
ux_approval_tx_flow[step++] = &ux_domain_name_step;
if (N_storage.verbose_domain_name) {
ux_approval_tx_flow[step++] = &ux_approval_to_step;
}
} else {
#endif // HAVE_DOMAIN_NAME
ux_approval_tx_flow[step++] = &ux_approval_to_step;
Expand All @@ -242,8 +250,6 @@ void ux_approve_tx(bool fromPlugin) {
#endif // HAVE_DOMAIN_NAME
}

ux_approval_tx_flow[step++] = &ux_approval_fees_step;

if (N_storage.displayNonce) {
ux_approval_tx_flow[step++] = &ux_approval_nonce_step;
}
Expand All @@ -253,6 +259,7 @@ void ux_approve_tx(bool fromPlugin) {
ux_approval_tx_flow[step++] = &ux_approval_network_step;
}

ux_approval_tx_flow[step++] = &ux_approval_fees_step;
ux_approval_tx_flow[step++] = &ux_approval_accept_step;
ux_approval_tx_flow[step++] = &ux_approval_reject_step;
ux_approval_tx_flow[step++] = FLOW_END_STEP;
Expand Down
21 changes: 7 additions & 14 deletions src_features/signTx/logic_signTx.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ __attribute__((noinline)) static bool finalize_parsing_helper(bool direct, bool
uint8_t msg_sender[ADDRESS_LENGTH] = {0};
get_public_key(msg_sender, sizeof(msg_sender));

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);
// Finalize the plugin handling
if (dataContext.tokenContext.pluginStatus >= ETH_PLUGIN_RESULT_SUCCESSFUL) {
eth_plugin_prepare_finalize(&pluginFinalize);
Expand Down Expand Up @@ -473,7 +479,7 @@ __attribute__((noinline)) static bool finalize_parsing_helper(bool direct, bool
} else {
strlcpy(strings.common.toAddress, displayBuffer, sizeof(strings.common.toAddress));
}
PRINTF("Address displayed: %s\n", strings.common.toAddress);
PRINTF("TO 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
Expand All @@ -499,19 +505,6 @@ __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,
Expand Down
16 changes: 12 additions & 4 deletions src_nbgl/ui_approve_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ static uint8_t setTagValuePairs(void) {

// Setup data to display
if (tx_approval_context.fromPlugin) {
if (pluginType != EXTERNAL) {
if (strings.common.fromAddress[0] != 0) {
pairs[nbPairs].item = "From";
pairs[nbPairs].value = strings.common.fromAddress;
nbPairs++;
}
}
for (pairIndex = 0; pairIndex < dataContext.tokenContext.pluginUiMaxItems; pairIndex++) {
// for the next dataContext.tokenContext.pluginUiMaxItems items, get tag/value from
// plugin_ui_get_item_internal()
Expand Down Expand Up @@ -143,15 +150,16 @@ static uint8_t setTagValuePairs(void) {
#ifdef HAVE_DOMAIN_NAME
}
#endif
pairs[nbPairs].item = "Max fees";
pairs[nbPairs].value = strings.common.maxFee;
nbPairs++;

if (N_storage.displayNonce) {
pairs[nbPairs].item = "Nonce";
pairs[nbPairs].value = strings.common.nonce;
nbPairs++;
}

pairs[nbPairs].item = "Max fees";
pairs[nbPairs].value = strings.common.maxFee;
nbPairs++;

if (tx_approval_context.displayNetwork) {
pairs[nbPairs].item = "Network";
pairs[nbPairs].value = strings.common.network_name;
Expand Down

0 comments on commit e503373

Please sign in to comment.