From 4a7e50138a7fb44dad80fef3b819c478954cb546 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Tue, 7 May 2024 18:28:34 +0200 Subject: [PATCH] Revert "EIP-712 addresses can now be displayed as a token ticker or a trusted domain name" This reverts commit 77f5c9389ba9797ee1902656473b267fcd98487a. --- src_features/signMessageEIP712/ui_logic.c | 52 +++-------------------- 1 file changed, 5 insertions(+), 47 deletions(-) diff --git a/src_features/signMessageEIP712/ui_logic.c b/src_features/signMessageEIP712/ui_logic.c index c2a0b74..7f5843c 100644 --- a/src_features/signMessageEIP712/ui_logic.c +++ b/src_features/signMessageEIP712/ui_logic.c @@ -15,9 +15,7 @@ #include "apdu_constants.h" // APDU response codes #include "typed_data.h" #include "commands_712.h" -#include "manage_asset_info.h" #include "common_ui.h" -#include "domain_name.h" #include "uint_common.h" static t_ui_context *ui_ctx = NULL; @@ -186,39 +184,6 @@ static void ui_712_format_str(const uint8_t *const data, uint8_t length) { } } -/** - * Find a substitute token ticker for a given address - * - * @param[in] addr the given address - * @return the ticker name if found, \ref NULL otherwise - */ -static const char *get_address_token_ticker(const uint8_t *addr) { - extraInfo_t *extra_info = get_asset_info_by_addr(addr); - if (extra_info != NULL) { - return extra_info->token.ticker; - } - return NULL; -} - -/** - * Find a substitute (token ticker or domain name) for a given address - * - * @param[in] addr the given address - * @return the substitute if found, \ref NULL otherwise - */ -static const char *get_address_substitute(const uint8_t *addr) { - const char *str = NULL; - - str = get_address_token_ticker(addr); - if (str == NULL) { - if (has_domain_name(&eip712_context->chain_id, addr)) { - // No handling of the verbose domains setting - str = g_domain_name; - } - } - return str; -} - /** * Format a given data as a string representation of an address * @@ -231,19 +196,12 @@ static bool ui_712_format_addr(const uint8_t *const data, uint8_t length) { apdu_response_code = APDU_RESPONSE_INVALID_DATA; return false; } - if (ui_712_field_shown()) { - const char *sub; - - if (!N_storage.verbose_eip712 && ((sub = get_address_substitute(data)) != NULL)) { - ui_712_set_value(sub, strlen(sub)); - } else { - if (!getEthDisplayableAddress((uint8_t *) data, - strings.tmp.tmp, - sizeof(strings.tmp.tmp), - chainConfig->chainId)) { - THROW(APDU_RESPONSE_ERROR_NO_INFO); - } + if (!getEthDisplayableAddress((uint8_t *) data, + strings.tmp.tmp, + sizeof(strings.tmp.tmp), + chainConfig->chainId)) { + THROW(APDU_RESPONSE_ERROR_NO_INFO); } } return true;