diff --git a/.github/workflows/coding_style_checks.yml b/.github/workflows/coding_style_checks.yml index 85ddb84..35ce6ff 100644 --- a/.github/workflows/coding_style_checks.yml +++ b/.github/workflows/coding_style_checks.yml @@ -19,5 +19,3 @@ jobs: uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1 with: source: './src' - extensions: 'h,c' - version: 11 diff --git a/CHANGELOG.md b/CHANGELOG.md index 39f8d92..91c8d6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.10.1] + +### Fixed + +- Amount displayed for tokens with non-8 decimals. + ## [0.10.0] ### Added diff --git a/Makefile b/Makefile index 5a38ad2..63a5217 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ APPNAME = "Aptos" # Application version APPVERSION_M = 0 APPVERSION_N = 10 -APPVERSION_P = 0 +APPVERSION_P = 1 APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" # Application source files diff --git a/fuzzing/CMakeLists.txt b/fuzzing/CMakeLists.txt index ecdbeee..56059bd 100644 --- a/fuzzing/CMakeLists.txt +++ b/fuzzing/CMakeLists.txt @@ -8,7 +8,7 @@ endif() project(FuzzTxParser VERSION 1.0 DESCRIPTION "Fuzzing of transaction parser" - LANGUAGES CXX) + LANGUAGES C CXX) # guard against bad build-type strings if (NOT CMAKE_BUILD_TYPE) @@ -55,7 +55,8 @@ endif() include(extra/TxParser.cmake) -add_executable(fuzz_tx_parser fuzz_tx_parser.cc) +add_executable(fuzz_tx_parser fuzz_tx_parser.c) +set_target_properties(fuzz_tx_parser PROPERTIES LINKER_LANGUAGE CXX) target_compile_options(fuzz_tx_parser PRIVATE ${COMPILATION_FLAGS} diff --git a/fuzzing/fuzz_tx_parser.cc b/fuzzing/fuzz_tx_parser.c similarity index 88% rename from fuzzing/fuzz_tx_parser.cc rename to fuzzing/fuzz_tx_parser.c index 7694597..3436177 100644 --- a/fuzzing/fuzz_tx_parser.cc +++ b/fuzzing/fuzz_tx_parser.c @@ -3,19 +3,17 @@ #include #include -extern "C" { #include "bcs/init.h" #include "buffer.h" #include "format.h" #include "transaction/deserialize.h" #include "transaction/utils.h" #include "transaction/types.h" -} #define DEBUG 0 -extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - buffer_t buf = {.ptr = data, .size = size, .offset = 0}; +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + buffer_t buf = {.ptr = (uint8_t *) data, .size = size, .offset = 0}; transaction_t tx; parser_status_e status; char sender[65] = {0}; diff --git a/src/address.c b/src/address.c index c13eb30..f8b0b42 100644 --- a/src/address.c +++ b/src/address.c @@ -15,19 +15,19 @@ * limitations under the License. *****************************************************************************/ -#include // uint*_t -#include // size_t +#include "address.h" + #include // bool +#include // size_t +#include // uint*_t #include // memmove -#include "os.h" #include "cx.h" - -#include "address.h" - +#include "os.h" #include "transaction/types.h" -bool address_from_pubkey(const uint8_t public_key[static 32], uint8_t *out, size_t out_len) { +bool address_from_pubkey(const uint8_t public_key[static 32], uint8_t* out, + size_t out_len) { const uint8_t signature_scheme_id = 0x00; uint8_t address[32] = {0}; @@ -40,15 +40,15 @@ bool address_from_pubkey(const uint8_t public_key[static 32], uint8_t *out, size if (error != CX_OK) { return false; } - error = cx_hash_update((cx_hash_t *) &sha3, public_key, 32); + error = cx_hash_update((cx_hash_t*)&sha3, public_key, 32); if (error != CX_OK) { return false; } - error = cx_hash_update((cx_hash_t *) &sha3, &signature_scheme_id, 1); + error = cx_hash_update((cx_hash_t*)&sha3, &signature_scheme_id, 1); if (error != CX_OK) { return false; } - error = cx_hash_final((cx_hash_t *) &sha3, address); + error = cx_hash_final((cx_hash_t*)&sha3, address); if (error != CX_OK) { return false; } @@ -58,18 +58,22 @@ bool address_from_pubkey(const uint8_t public_key[static 32], uint8_t *out, size return true; } -bool validate_aptos_bip32_path(const uint32_t *path, size_t path_len) { +bool validate_aptos_bip32_path(const uint32_t* path, size_t path_len) { // m/purpose'/coin_type'/account'/change/address_index // m/44' /637' /0' /0' /0' const uint32_t aptos_prefix[2] = {0x8000002C, 0x8000027D}; // A 3-element HD path limit (`m/44'/637'/x'`) is enforced for: - // 1. BIP44 compliance, ensuring proper structure (`m/44'/637'` - purpose and coin type). - // 2. Operational flexibility, allowing basic account-level (`x'`) fund segregation. - // 3. A balance between security and usability, preventing the potential privacy and security - // risks associated with using an overly simple path (e.g., `m/44'/637'`), while not - // requiring the full 5-element path that may be unnecessary for users seeking - // straightforward wallet functionality. + // 1. BIP44 compliance, ensuring proper structure (`m/44'/637'` - purpose + // and coin type). + // 2. Operational flexibility, allowing basic account-level (`x'`) fund + // segregation. + // 3. A balance between security and usability, preventing the potential + // privacy and security + // risks associated with using an overly simple path (e.g., + // `m/44'/637'`), while not requiring the full 5-element path that may + // be unnecessary for users seeking straightforward wallet + // functionality. if (path_len < 3) { return false; } diff --git a/src/apdu/dispatcher.c b/src/apdu/dispatcher.c index a636e93..d810499 100644 --- a/src/apdu/dispatcher.c +++ b/src/apdu/dispatcher.c @@ -15,23 +15,23 @@ * limitations under the License. *****************************************************************************/ -#include -#include +#include "dispatcher.h" -#include "buffer.h" -#include "io.h" +#include +#include -#include "dispatcher.h" #include "../constants.h" #include "../globals.h" -#include "../types.h" -#include "../sw.h" -#include "../handler/get_version.h" #include "../handler/get_app_name.h" #include "../handler/get_public_key.h" +#include "../handler/get_version.h" #include "../handler/sign_tx.h" +#include "../sw.h" +#include "../types.h" +#include "buffer.h" +#include "io.h" -int apdu_dispatcher(const command_t *cmd) { +int apdu_dispatcher(const command_t* cmd) { PRINTF("Inside Aptos apdu_dispatcher\n"); if (cmd->cla != CLA) { return io_send_sw(SW_CLA_NOT_SUPPORTED); @@ -68,7 +68,7 @@ int apdu_dispatcher(const command_t *cmd) { buf.size = cmd->lc; buf.offset = 0; - return handler_get_public_key(&buf, (bool) cmd->p1); + return handler_get_public_key(&buf, (bool)cmd->p1); case SIGN_TX: PRINTF("SIGN_TX\n"); if ((cmd->p1 == P1_START && cmd->p2 != P2_MORE) || // @@ -86,8 +86,10 @@ int apdu_dispatcher(const command_t *cmd) { buf.ptr = cmd->data; buf.size = cmd->lc; buf.offset = 0; - PRINTF("Inside Aptos apdu_dispatcher: ready to call handler_sign_tx\n"); - return handler_sign_tx(&buf, cmd->p1, (bool) (cmd->p2 & P2_MORE)); + PRINTF( + "Inside Aptos apdu_dispatcher: ready to call " + "handler_sign_tx\n"); + return handler_sign_tx(&buf, cmd->p1, (bool)(cmd->p2 & P2_MORE)); default: return io_send_sw(SW_INS_NOT_SUPPORTED); } diff --git a/src/app_main.c b/src/app_main.c index 70f7df4..0904d72 100644 --- a/src/app_main.c +++ b/src/app_main.c @@ -18,15 +18,14 @@ #include // uint*_t #include // memset, explicit_bzero -#include "os.h" -#include "ux.h" - -#include "types.h" +#include "apdu/dispatcher.h" #include "globals.h" #include "io.h" +#include "os.h" #include "sw.h" +#include "types.h" #include "ui/menu.h" -#include "apdu/dispatcher.h" +#include "ux.h" #ifdef HAVE_SWAP #include "swap.h" @@ -41,7 +40,7 @@ void nvm_app_storage_init() { storage.settings.show_full_message = 0x00; storage.settings.allow_blind_signing = 0x00; storage.initialized = 0x01; - nvm_write((void *) &N_storage, (void *) &storage, sizeof(app_storage_t)); + nvm_write((void*)&N_storage, (void*)&storage, sizeof(app_storage_t)); } } @@ -80,20 +79,17 @@ void app_main() { // Parse APDU command from G_io_apdu_buffer if (!apdu_parser(&cmd, G_io_apdu_buffer, input_len)) { - PRINTF("=> /!\\ BAD LENGTH: %.*H\n", input_len, G_io_apdu_buffer); + PRINTF("=> /!\\ BAD LENGTH: %.*H\n", input_len, + G_io_apdu_buffer); io_send_sw(SW_WRONG_DATA_LENGTH); CLOSE_TRY; continue; } - PRINTF("=> CLA=%02X | INS=%02X | P1=%02X | P2=%02X | Lc=%02X | CData=%.*H\n", - cmd.cla, - cmd.ins, - cmd.p1, - cmd.p2, - cmd.lc, - cmd.lc, - cmd.data); + PRINTF( + "=> CLA=%02X | INS=%02X | P1=%02X | P2=%02X | Lc=%02X | " + "CData=%.*H\n", + cmd.cla, cmd.ins, cmd.p1, cmd.p2, cmd.lc, cmd.lc, cmd.data); // Dispatch structured APDU command to handler if (apdu_dispatcher(&cmd) < 0) { @@ -101,14 +97,9 @@ void app_main() { return; } } - CATCH(EXCEPTION_IO_RESET) { - THROW(EXCEPTION_IO_RESET); - } - CATCH_OTHER(e) { - io_send_sw(e); - } - FINALLY { - } + CATCH(EXCEPTION_IO_RESET) { THROW(EXCEPTION_IO_RESET); } + CATCH_OTHER(e) { io_send_sw(e); } + FINALLY {} END_TRY; } } diff --git a/src/bcs/decoder.c b/src/bcs/decoder.c index fb42c98..03c9d07 100644 --- a/src/bcs/decoder.c +++ b/src/bcs/decoder.c @@ -1,12 +1,13 @@ -#include +#include "decoder.h" + #include +#include #include #include -#include "decoder.h" #include "utf8.h" -bool bcs_read_bool(buffer_t *buffer, bool *value) { +bool bcs_read_bool(buffer_t* buffer, bool* value) { uint8_t tmp_value = 0; if (!buffer_read_u8(buffer, &tmp_value)) { return false; @@ -19,91 +20,91 @@ bool bcs_read_bool(buffer_t *buffer, bool *value) { return true; } -bool bcs_read_option_tag(buffer_t *buffer, bool *value) { +bool bcs_read_option_tag(buffer_t* buffer, bool* value) { return bcs_read_bool(buffer, value); } -bool bcs_read_u8(buffer_t *buffer, uint8_t *value) { +bool bcs_read_u8(buffer_t* buffer, uint8_t* value) { return buffer_read_u8(buffer, value); } -bool bcs_read_u16(buffer_t *buffer, uint16_t *value) { +bool bcs_read_u16(buffer_t* buffer, uint16_t* value) { return buffer_read_u16(buffer, value, LE); } -bool bcs_read_u32(buffer_t *buffer, uint32_t *value) { +bool bcs_read_u32(buffer_t* buffer, uint32_t* value) { return buffer_read_u32(buffer, value, LE); } -bool bcs_read_u64(buffer_t *buffer, uint64_t *value) { +bool bcs_read_u64(buffer_t* buffer, uint64_t* value) { return buffer_read_u64(buffer, value, LE); } -bool bcs_read_u128(buffer_t *buffer, uint128_t *value) { +bool bcs_read_u128(buffer_t* buffer, uint128_t* value) { if (!buffer_read_u64(buffer, &value->low, LE)) { return false; } return buffer_read_u64(buffer, &value->high, LE); } -bool bcs_read_i8(buffer_t *buffer, int8_t *value) { +bool bcs_read_i8(buffer_t* buffer, int8_t* value) { uint8_t tmp = 0; if (!buffer_read_u8(buffer, &tmp)) { return false; } - *value = (int8_t) tmp; + *value = (int8_t)tmp; return true; } -bool bcs_read_i16(buffer_t *buffer, int16_t *value) { +bool bcs_read_i16(buffer_t* buffer, int16_t* value) { uint16_t tmp = 0; if (!buffer_read_u16(buffer, &tmp, LE)) { return false; } - *value = (int16_t) tmp; + *value = (int16_t)tmp; return true; } -bool bcs_read_i32(buffer_t *buffer, int32_t *value) { +bool bcs_read_i32(buffer_t* buffer, int32_t* value) { uint32_t tmp = 0; if (!buffer_read_u32(buffer, &tmp, LE)) { return false; } - *value = (int32_t) tmp; + *value = (int32_t)tmp; return true; } -bool bcs_read_i64(buffer_t *buffer, int64_t *value) { +bool bcs_read_i64(buffer_t* buffer, int64_t* value) { uint64_t tmp = 0; if (!buffer_read_u64(buffer, &tmp, LE)) { return false; } - *value = (int64_t) tmp; + *value = (int64_t)tmp; return true; } -bool bcs_read_i128(buffer_t *buffer, int128_t *value) { +bool bcs_read_i128(buffer_t* buffer, int128_t* value) { if (!buffer_read_u64(buffer, &value->low, LE)) { return false; } return bcs_read_i64(buffer, &value->high); } -bool bcs_read_f32(buffer_t *buffer, float *value) { - (void) buffer; - (void) value; +bool bcs_read_f32(buffer_t* buffer, float* value) { + (void)buffer; + (void)value; // Not implemented return false; } -bool bcs_read_f64(buffer_t *buffer, double *value) { - (void) buffer; - (void) value; +bool bcs_read_f64(buffer_t* buffer, double* value) { + (void)buffer; + (void)value; // Not implemented return false; } -bool bcs_read_u32_from_uleb128(buffer_t *buffer, uint32_t *value) { +bool bcs_read_u32_from_uleb128(buffer_t* buffer, uint32_t* value) { uint64_t tmp_value = 0; uint8_t tmp_byte = 0; int digit; @@ -112,7 +113,7 @@ bool bcs_read_u32_from_uleb128(buffer_t *buffer, uint32_t *value) { return false; } digit = tmp_byte & 0x7F; - tmp_value |= (uint64_t) digit << shift; + tmp_value |= (uint64_t)digit << shift; if (tmp_value > UINT32_MAX) { // Overflow while parsing uleb128-encoded uint32 value return false; @@ -122,7 +123,7 @@ bool bcs_read_u32_from_uleb128(buffer_t *buffer, uint32_t *value) { // Invalid uleb128 number (unexpected zero digit) return false; } - *value = (uint32_t) tmp_value; + *value = (uint32_t)tmp_value; return true; } } @@ -130,16 +131,16 @@ bool bcs_read_u32_from_uleb128(buffer_t *buffer, uint32_t *value) { return false; } -bool bcs_read_variant_index(buffer_t *buffer, uint32_t *out) { +bool bcs_read_variant_index(buffer_t* buffer, uint32_t* out) { return bcs_read_u32_from_uleb128(buffer, out); } -bool bcs_read_length(buffer_t *buffer, size_t *out_len) { +bool bcs_read_length(buffer_t* buffer, size_t* out_len) { uint32_t tmp_length = 0; if (!bcs_read_u32_from_uleb128(buffer, &tmp_length)) { return false; } - *out_len = (size_t) tmp_length; + *out_len = (size_t)tmp_length; if (tmp_length > MAX_SEQUENCE_LENGTH) { // Length is too large @@ -148,14 +149,15 @@ bool bcs_read_length(buffer_t *buffer, size_t *out_len) { return true; } -bool bcs_read_char(buffer_t *buffer, uint8_t *out) { - (void) buffer; - (void) out; +bool bcs_read_char(buffer_t* buffer, uint8_t* out) { + (void)buffer; + (void)out; // Not implemented return false; } -bool bcs_read_string(buffer_t *buffer, unsigned char *out, size_t out_size, size_t *out_len) { +bool bcs_read_string(buffer_t* buffer, unsigned char* out, size_t out_size, + size_t* out_len) { size_t str_len = 0; if (!bcs_read_length(buffer, &str_len)) { return false; @@ -164,7 +166,7 @@ bool bcs_read_string(buffer_t *buffer, unsigned char *out, size_t out_size, size return false; } - const uint8_t *str_start = buffer->ptr + buffer->offset; + const uint8_t* str_start = buffer->ptr + buffer->offset; int ascii_len = try_utf8_to_ascii(str_start, str_len, out, out_size, NULL); if (ascii_len < 0) { return false; @@ -174,7 +176,7 @@ bool bcs_read_string(buffer_t *buffer, unsigned char *out, size_t out_size, size return buffer_seek_cur(buffer, str_len); } -bool bcs_read_fixed_bytes(buffer_t *buffer, uint8_t *out, size_t size) { +bool bcs_read_fixed_bytes(buffer_t* buffer, uint8_t* out, size_t size) { if (!buffer_can_read(buffer, size)) { return false; } @@ -183,16 +185,17 @@ bool bcs_read_fixed_bytes(buffer_t *buffer, uint8_t *out, size_t size) { return buffer_seek_cur(buffer, size); } -bool bcs_read_ptr_to_fixed_bytes(buffer_t *buffer, uint8_t **out, size_t size) { +bool bcs_read_ptr_to_fixed_bytes(buffer_t* buffer, uint8_t** out, size_t size) { if (!buffer_can_read(buffer, size)) { return false; } - *out = (uint8_t *) buffer->ptr + buffer->offset; + *out = (uint8_t*)buffer->ptr + buffer->offset; return buffer_seek_cur(buffer, size); } -bool bcs_read_dynamic_bytes(buffer_t *buffer, uint8_t *out, size_t out_size, size_t *out_len) { +bool bcs_read_dynamic_bytes(buffer_t* buffer, uint8_t* out, size_t out_size, + size_t* out_len) { *out_len = 0; if (!bcs_read_length(buffer, out_len)) { return false; @@ -203,24 +206,25 @@ bool bcs_read_dynamic_bytes(buffer_t *buffer, uint8_t *out, size_t out_size, siz return bcs_read_fixed_bytes(buffer, out, *out_len); } -bool bcs_read_type_tag_fixed(buffer_t *buffer, type_tag_t *ty_val) { +bool bcs_read_type_tag_fixed(buffer_t* buffer, type_tag_t* ty_val) { switch (ty_val->type_tag) { case TYPE_TAG_BOOL: ty_val->size = sizeof(bool); - return bcs_read_bool(buffer, (bool *) &ty_val->value); + return bcs_read_bool(buffer, (bool*)&ty_val->value); case TYPE_TAG_U8: ty_val->size = sizeof(uint8_t); - return bcs_read_u8(buffer, (uint8_t *) &ty_val->value); + return bcs_read_u8(buffer, (uint8_t*)&ty_val->value); case TYPE_TAG_U64: ty_val->size = sizeof(uint64_t); - return bcs_read_u64(buffer, (uint64_t *) &ty_val->value); + return bcs_read_u64(buffer, (uint64_t*)&ty_val->value); case TYPE_TAG_U128: ty_val->size = sizeof(uint128_t); - return bcs_read_u128(buffer, (uint128_t *) &ty_val->value); + return bcs_read_u128(buffer, (uint128_t*)&ty_val->value); case TYPE_TAG_ADDRESS: case TYPE_TAG_SIGNER: ty_val->size = ADDRESS_LEN; - return bcs_read_fixed_bytes(buffer, (uint8_t *) &ty_val->value, ADDRESS_LEN); + return bcs_read_fixed_bytes(buffer, (uint8_t*)&ty_val->value, + ADDRESS_LEN); default: return false; } diff --git a/src/bcs/init.c b/src/bcs/init.c index 1890b54..732d0e1 100644 --- a/src/bcs/init.c +++ b/src/bcs/init.c @@ -1,14 +1,14 @@ -#include - #include "init.h" -void type_tag_init(type_tag_t *type_tag) { +#include + +void type_tag_init(type_tag_t* type_tag) { type_tag->type_tag = 0; type_tag->size = 0; type_tag->value = NULL; } -void type_tag_struct_init(type_tag_struct_t *type_tag_struct) { +void type_tag_struct_init(type_tag_struct_t* type_tag_struct) { memset(&type_tag_struct->address, 0, ADDRESS_LEN); fixed_bytes_init(&type_tag_struct->module_name); fixed_bytes_init(&type_tag_struct->name); @@ -16,17 +16,17 @@ void type_tag_struct_init(type_tag_struct_t *type_tag_struct) { type_tag_struct->type_args = NULL; } -void fixed_bytes_init(fixed_bytes_t *fixed_bytes) { +void fixed_bytes_init(fixed_bytes_t* fixed_bytes) { fixed_bytes->bytes = NULL; fixed_bytes->len = 0; } -void module_id_init(module_id_t *module_id) { +void module_id_init(module_id_t* module_id) { memset(module_id->address, 0, ADDRESS_LEN); fixed_bytes_init(&module_id->name); } -void entry_function_payload_init(entry_function_payload_t *payload) { +void entry_function_payload_init(entry_function_payload_t* payload) { module_id_init(&payload->module_id); fixed_bytes_init(&payload->function_name); payload->known_type = FUNC_UNKNOWN; @@ -34,7 +34,7 @@ void entry_function_payload_init(entry_function_payload_t *payload) { payload->args.args_size = 0; } -void script_payload_init(script_payload_t *payload) { +void script_payload_init(script_payload_t* payload) { fixed_bytes_init(&payload->code); payload->ty_size = 0; payload->ty_args = NULL; @@ -42,7 +42,7 @@ void script_payload_init(script_payload_t *payload) { payload->args = NULL; } -void transaction_init(aptos_transaction_t *tx) { +void transaction_init(aptos_transaction_t* tx) { memset(tx->sender, 0, ADDRESS_LEN); tx->tx_variant = TX_UNDEFINED; tx->sequence = 0; diff --git a/src/bcs/utf8.c b/src/bcs/utf8.c index b19aef1..40da275 100644 --- a/src/bcs/utf8.c +++ b/src/bcs/utf8.c @@ -1,10 +1,10 @@ +#include "utf8.h" + #include -#include #include +#include -#include "utf8.h" - -bool try_push_char(uint8_t *out, size_t *out_len, uint8_t ch, size_t max_len) { +bool try_push_char(uint8_t* out, size_t* out_len, uint8_t ch, size_t max_len) { if (*out_len < max_len) { out[(*out_len)++] = ch; return true; @@ -16,11 +16,8 @@ bool try_push_char(uint8_t *out, size_t *out_len, uint8_t ch, size_t max_len) { * Checks if the data is in UTF-8 format and tries to convert it to ASCII * Adapted from: https://www.cl.cam.ac.uk/~mgk25/ucs/utf8_check.c */ -int try_utf8_to_ascii(const uint8_t *in, - size_t in_len, - uint8_t *out, - size_t max_out_len, - bool *out_is_utf8) { +int try_utf8_to_ascii(const uint8_t* in, size_t in_len, uint8_t* out, + size_t max_out_len, bool* out_is_utf8) { if (!in) { return 0; } @@ -48,9 +45,11 @@ int try_utf8_to_ascii(const uint8_t *in, } } else if ((in[i] & 0xf0) == 0xe0) { /* 1110XXXX 10Xxxxxx 10xxxxxx */ - if (i + 2 >= in_len || (in[i + 1] & 0xc0) != 0x80 || (in[i + 2] & 0xc0) != 0x80 || + if (i + 2 >= in_len || (in[i + 1] & 0xc0) != 0x80 || + (in[i + 2] & 0xc0) != 0x80 || (in[i] == 0xe0 && (in[i + 1] & 0xe0) == 0x80) || /* overlong? */ - (in[i] == 0xed && (in[i + 1] & 0xe0) == 0xa0) || /* surrogate? */ + (in[i] == 0xed && + (in[i + 1] & 0xe0) == 0xa0) || /* surrogate? */ (in[i] == 0xef && in[i + 1] == 0xbf && (in[i + 2] & 0xfe) == 0xbe)) /* U+FFFE or U+FFFF? */ { return -1; @@ -63,10 +62,11 @@ int try_utf8_to_ascii(const uint8_t *in, } } else if ((in[i] & 0xf8) == 0xf0) { /* 11110XXX 10XXxxxx 10xxxxxx 10xxxxxx */ - if (i + 3 >= in_len || (in[i + 1] & 0xc0) != 0x80 || (in[i + 2] & 0xc0) != 0x80 || - (in[i + 3] & 0xc0) != 0x80 || + if (i + 3 >= in_len || (in[i + 1] & 0xc0) != 0x80 || + (in[i + 2] & 0xc0) != 0x80 || (in[i + 3] & 0xc0) != 0x80 || (in[i] == 0xf0 && (in[i + 1] & 0xf0) == 0x80) || /* overlong? */ - (in[i] == 0xf4 && in[i + 1] > 0x8f) || in[i] > 0xf4) /* > U+10FFFF? */ { + (in[i] == 0xf4 && in[i + 1] > 0x8f) || + in[i] > 0xf4) /* > U+10FFFF? */ { return -1; } else { if (!try_push_char(out, &out_len, unknown_char, max_out_len)) { @@ -83,5 +83,5 @@ int try_utf8_to_ascii(const uint8_t *in, if (out_is_utf8) { *out_is_utf8 = is_utf8; } - return (int) out_len; + return (int)out_len; } diff --git a/src/common/parse.c b/src/common/parse.c index bb33e67..e4259eb 100644 --- a/src/common/parse.c +++ b/src/common/parse.c @@ -15,15 +15,16 @@ * limitations under the License. ********************************************************************************/ -#include #include "parse.h" +#include + #define MAX_AMOUNT_STR_LEN 21 // 19 for u64 + 1 for '\0' +1 for '.' /** * Adjusts the number of decimals of a string representation of a number. - * If the number of decimals is greater than the number of decimals in the string, - * it adds zeros at the end of the string. + * If the number of decimals is greater than the number of decimals in the + * string, it adds zeros at the end of the string. * * @param[in] src * The string representation of the number. @@ -42,11 +43,8 @@ * * @return true if success, false otherwise. */ -bool adjust_decimals(const char *src, - uint32_t src_length, - uint8_t decimals, - char *target, - uint32_t target_length) { +bool adjust_decimals(const char* src, uint32_t src_length, uint8_t decimals, + char* target, uint32_t target_length) { uint32_t start_offset; uint32_t last_zero_offset = 0; uint32_t offset = 0; @@ -102,7 +100,8 @@ bool adjust_decimals(const char *src, return true; } -unsigned short print_amount(uint64_t amount, uint8_t decimals, char *out, uint32_t out_len) { +unsigned short print_amount(uint64_t amount, uint8_t decimals, char* out, + uint32_t out_len) { if (amount == 0) { if (out_len < 2) { return 0; @@ -140,9 +139,7 @@ unsigned short print_amount(uint64_t amount, uint8_t decimals, char *out, uint32 return strlen(out); } -static bool is_digit(char c) { - return '0' <= c && c <= '9'; -} +static bool is_digit(char c) { return '0' <= c && c <= '9'; } static bool is_alpha(char c) { return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'); @@ -167,7 +164,7 @@ static uint8_t lowercase_hex_to_int(char c) { return (uint8_t)(is_digit(c) ? c - '0' : c - 'a' + 10); } -int hex_str_to_u8(const char *str, uint8_t *out, size_t n) { +int hex_str_to_u8(const char* str, uint8_t* out, size_t n) { if (strlen(str) < 2 * n) { return -1; } diff --git a/src/common/user_format.c b/src/common/user_format.c index 0e638e7..5ab506c 100644 --- a/src/common/user_format.c +++ b/src/common/user_format.c @@ -15,6 +15,8 @@ * limitations under the License. *****************************************************************************/ +#include "user_format.h" + #include // bool #include // size_t #include // int*_t, uint*_t @@ -22,9 +24,8 @@ #include "format.h" -#include "user_format.h" - -int format_prefixed_hex(const uint8_t *in, size_t in_len, char *out, size_t out_len) { +int format_prefixed_hex(const uint8_t* in, size_t in_len, char* out, + size_t out_len) { const char prefix[] = "0x"; const size_t prefix_len = sizeof(prefix) - 1; @@ -35,7 +36,7 @@ int format_prefixed_hex(const uint8_t *in, size_t in_len, char *out, size_t out_ return format_hex(in, in_len, out + prefix_len, out_len - prefix_len); } -bool is_str_interrupted(const char *src, size_t len) { +bool is_str_interrupted(const char* src, size_t len) { bool interrupted = false; for (size_t i = 0; i < len; i++) { if (!interrupted && src[i] == 0) { diff --git a/src/crypto.c b/src/crypto.c index de2e606..a63c1e2 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -15,47 +15,44 @@ * limitations under the License. *****************************************************************************/ +#include "crypto.h" + +#include // bool #include // uint*_t #include // memset, explicit_bzero -#include // bool - -#include "crypto.h" #include "globals.h" -cx_err_t crypto_derive_private_key(cx_ecfp_private_key_t *private_key, +cx_err_t crypto_derive_private_key(cx_ecfp_private_key_t* private_key, uint8_t chain_code[static 32], - const uint32_t *bip32_path, + const uint32_t* bip32_path, uint8_t bip32_path_len) { uint8_t raw_private_key[64] = {0}; cx_err_t error = CX_OK; // derive the seed with bip32_path - error = os_derive_bip32_with_seed_no_throw(HDW_ED25519_SLIP10, - CX_CURVE_Ed25519, - bip32_path, - bip32_path_len, - raw_private_key, - chain_code, - (unsigned char *) "ed25519 seed", - 12); + error = os_derive_bip32_with_seed_no_throw( + HDW_ED25519_SLIP10, CX_CURVE_Ed25519, bip32_path, bip32_path_len, + raw_private_key, chain_code, (unsigned char*)"ed25519 seed", 12); if (error != CX_OK) { explicit_bzero(&raw_private_key, sizeof(raw_private_key)); return error; } // new private_key from raw - error = cx_ecfp_init_private_key_no_throw(CX_CURVE_Ed25519, raw_private_key, 32, private_key); + error = cx_ecfp_init_private_key_no_throw(CX_CURVE_Ed25519, raw_private_key, + 32, private_key); explicit_bzero(&raw_private_key, sizeof(raw_private_key)); return error; } -cx_err_t crypto_init_public_key(cx_ecfp_private_key_t *private_key, - cx_ecfp_public_key_t *public_key, +cx_err_t crypto_init_public_key(cx_ecfp_private_key_t* private_key, + cx_ecfp_public_key_t* public_key, uint8_t raw_public_key[static 32]) { // generate corresponding public key - cx_err_t error = cx_ecfp_generate_pair_no_throw(CX_CURVE_Ed25519, public_key, private_key, 1); + cx_err_t error = cx_ecfp_generate_pair_no_throw(CX_CURVE_Ed25519, + public_key, private_key, 1); if (error != CX_OK) { return error; @@ -76,8 +73,7 @@ cx_err_t crypto_sign_message() { uint8_t chain_code[32] = {0}; // derive private key according to BIP32 path - cx_err_t error = crypto_derive_private_key(&private_key, - chain_code, + cx_err_t error = crypto_derive_private_key(&private_key, chain_code, G_context.bip32_path, G_context.bip32_path_len); if (error != CX_OK) { @@ -85,12 +81,10 @@ cx_err_t crypto_sign_message() { return error; } - error = cx_eddsa_sign_no_throw(&private_key, - CX_SHA512, - G_context.tx_info.raw_tx, - G_context.tx_info.raw_tx_len, - G_context.tx_info.signature, - sizeof(G_context.tx_info.signature)); + error = cx_eddsa_sign_no_throw( + &private_key, CX_SHA512, G_context.tx_info.raw_tx, + G_context.tx_info.raw_tx_len, G_context.tx_info.signature, + sizeof(G_context.tx_info.signature)); if (error != CX_OK) { explicit_bzero(&private_key, sizeof(private_key)); @@ -105,7 +99,8 @@ cx_err_t crypto_sign_message() { } G_context.tx_info.signature_len = 2 * size; - PRINTF("Signature: %.*H\n", G_context.tx_info.signature_len, G_context.tx_info.signature); + PRINTF("Signature: %.*H\n", G_context.tx_info.signature_len, + G_context.tx_info.signature); explicit_bzero(&private_key, sizeof(private_key)); return error; diff --git a/src/handler/get_app_name.c b/src/handler/get_app_name.c index a2e3873..8bd7ccb 100644 --- a/src/handler/get_app_name.c +++ b/src/handler/get_app_name.c @@ -15,19 +15,20 @@ * limitations under the License. *****************************************************************************/ -#include // uint*_t +#include "get_app_name.h" -#include "io.h" -#include "buffer.h" +#include // uint*_t -#include "get_app_name.h" #include "../constants.h" #include "../globals.h" #include "../sw.h" #include "../types.h" +#include "buffer.h" +#include "io.h" int handler_get_app_name() { - _Static_assert(APPNAME_LEN < MAX_APPNAME_LEN, "APPNAME must be at most 64 characters!"); + _Static_assert(APPNAME_LEN < MAX_APPNAME_LEN, + "APPNAME must be at most 64 characters!"); return io_send_response_pointer(PIC(APPNAME), APPNAME_LEN, SW_OK); } diff --git a/src/handler/get_public_key.c b/src/handler/get_public_key.c index 7652178..1a721bd 100644 --- a/src/handler/get_public_key.c +++ b/src/handler/get_public_key.c @@ -15,24 +15,24 @@ * limitations under the License. *****************************************************************************/ -#include // uint*_t +#include "get_public_key.h" + #include // bool #include // size_t +#include // uint*_t #include // memset, explicit_bzero -#include "os.h" -#include "cx.h" -#include "io.h" -#include "buffer.h" - -#include "get_public_key.h" +#include "../address.h" +#include "../crypto.h" #include "../globals.h" -#include "../types.h" +#include "../helper/send_response.h" #include "../sw.h" -#include "../crypto.h" -#include "../address.h" +#include "../types.h" #include "../ui/display.h" -#include "../helper/send_response.h" +#include "buffer.h" +#include "cx.h" +#include "io.h" +#include "os.h" /***************************************************************************** * Ledger App Aptos. @@ -51,33 +51,32 @@ * limitations under the License. *****************************************************************************/ -#include // uint*_t #include // bool #include // size_t +#include // uint*_t #include // memset, explicit_bzero -#include "os.h" -#include "cx.h" -#include "io.h" -#include "buffer.h" - -#include "get_public_key.h" +#include "../address.h" +#include "../crypto.h" #include "../globals.h" -#include "../types.h" +#include "../helper/send_response.h" #include "../sw.h" -#include "../crypto.h" -#include "../address.h" +#include "../types.h" #include "../ui/display.h" -#include "../helper/send_response.h" +#include "buffer.h" +#include "cx.h" +#include "get_public_key.h" +#include "io.h" +#include "os.h" -int get_public_key(buffer_t *cdata, - uint8_t *output_bip32_path_len, - uint32_t *output_bip32_path, - pubkey_ctx_t *output_pubkey_ctx) { +int get_public_key(buffer_t* cdata, uint8_t* output_bip32_path_len, + uint32_t* output_bip32_path, + pubkey_ctx_t* output_pubkey_ctx) { if (!buffer_read_u8(cdata, output_bip32_path_len)) { return io_send_sw(SW_WRONG_DATA_LENGTH); } - if (!buffer_read_bip32_path(cdata, output_bip32_path, (size_t) *output_bip32_path_len)) { + if (!buffer_read_bip32_path(cdata, output_bip32_path, + (size_t)*output_bip32_path_len)) { return io_send_sw(SW_WRONG_DATA_LENGTH); } @@ -87,10 +86,9 @@ int get_public_key(buffer_t *cdata, // Derive private key according to BIP32 path cx_ecfp_private_key_t private_key = {0}; - cx_err_t error = crypto_derive_private_key(&private_key, - output_pubkey_ctx->chain_code, - output_bip32_path, - *output_bip32_path_len); + cx_err_t error = + crypto_derive_private_key(&private_key, output_pubkey_ctx->chain_code, + output_bip32_path, *output_bip32_path_len); if (error != CX_OK) { PRINTF("crypto_derive_private_key error code: %x.\n", error); // Wipe the private key from memory to protect against memory attacks @@ -100,7 +98,8 @@ int get_public_key(buffer_t *cdata, // Generate corresponding public key cx_ecfp_public_key_t public_key = {0}; - error = crypto_init_public_key(&private_key, &public_key, output_pubkey_ctx->raw_public_key); + error = crypto_init_public_key(&private_key, &public_key, + output_pubkey_ctx->raw_public_key); // Wipe the private key from memory to protect against memory attacks explicit_bzero(&private_key, sizeof(private_key)); @@ -112,12 +111,12 @@ int get_public_key(buffer_t *cdata, return 0; } -int handler_get_public_key(buffer_t *cdata, bool display) { +int handler_get_public_key(buffer_t* cdata, bool display) { explicit_bzero(&G_context, sizeof(G_context)); G_context.req_type = CONFIRM_ADDRESS; - int err = - get_public_key(cdata, &G_context.bip32_path_len, G_context.bip32_path, &G_context.pk_info); + int err = get_public_key(cdata, &G_context.bip32_path_len, + G_context.bip32_path, &G_context.pk_info); if (err) { G_context.req_type = REQUEST_UNDEFINED; @@ -126,10 +125,12 @@ int handler_get_public_key(buffer_t *cdata, bool display) { if (display) { int ui_status = ui_display_address(); - G_context.req_type = REQUEST_UNDEFINED; // all the work is done, reset the context + G_context.req_type = + REQUEST_UNDEFINED; // all the work is done, reset the context return ui_status; } - G_context.req_type = REQUEST_UNDEFINED; // all the work is done, reset the context + G_context.req_type = + REQUEST_UNDEFINED; // all the work is done, reset the context return helper_send_response_pubkey(); } diff --git a/src/handler/get_version.c b/src/handler/get_version.c index dc4f76a..300e4a7 100644 --- a/src/handler/get_version.c +++ b/src/handler/get_version.c @@ -15,21 +15,22 @@ * limitations under the License. *****************************************************************************/ -#include // uint*_t -#include // UINT8_MAX -#include // _Static_assert +#include "get_version.h" -#include "io.h" -#include "buffer.h" +#include // _Static_assert +#include // UINT8_MAX +#include // uint*_t -#include "get_version.h" -#include "../globals.h" #include "../constants.h" +#include "../globals.h" #include "../sw.h" #include "../types.h" +#include "buffer.h" +#include "io.h" int handler_get_version() { - _Static_assert(APPVERSION_LEN == 3, "Length of (MAJOR || MINOR || PATCH) must be 3!"); + _Static_assert(APPVERSION_LEN == 3, + "Length of (MAJOR || MINOR || PATCH) must be 3!"); _Static_assert(MAJOR_VERSION >= 0 && MAJOR_VERSION <= UINT8_MAX, "MAJOR version must be between 0 and 255!"); _Static_assert(MINOR_VERSION >= 0 && MINOR_VERSION <= UINT8_MAX, @@ -38,9 +39,8 @@ int handler_get_version() { "PATCH version must be between 0 and 255!"); return io_send_response_pointer( - (const uint8_t *) &(uint8_t[APPVERSION_LEN]){(uint8_t) MAJOR_VERSION, - (uint8_t) MINOR_VERSION, - (uint8_t) PATCH_VERSION}, - APPVERSION_LEN, - SW_OK); + (const uint8_t*)&(uint8_t[APPVERSION_LEN]){(uint8_t)MAJOR_VERSION, + (uint8_t)MINOR_VERSION, + (uint8_t)PATCH_VERSION}, + APPVERSION_LEN, SW_OK); } diff --git a/src/handler/sign_tx.c b/src/handler/sign_tx.c index 2a8a09a..c64ddf4 100644 --- a/src/handler/sign_tx.c +++ b/src/handler/sign_tx.c @@ -15,32 +15,32 @@ * limitations under the License. *****************************************************************************/ -#include // uint*_t +#include "sign_tx.h" + #include // bool #include // size_t +#include // uint*_t #include // memset, explicit_bzero -#include "os.h" -#include "cx.h" -#include "buffer.h" - -#include "sign_tx.h" -#include "../sw.h" -#include "../globals.h" -#include "../crypto.h" #include "../address.h" -#include "../ui/display.h" -#include "../transaction/types.h" +#include "../crypto.h" +#include "../globals.h" +#include "../sw.h" +#include "../swap/handle_swap_sign_transaction.h" #include "../transaction/deserialize.h" +#include "../transaction/types.h" #include "../ui/action/validate.h" -#include "../swap/handle_swap_sign_transaction.h" +#include "../ui/display.h" +#include "buffer.h" +#include "cx.h" +#include "os.h" #ifdef HAVE_SWAP -#include "swap.h" #include "handle_swap_sign_transaction.h" +#include "swap.h" #endif -int handler_sign_tx(buffer_t *cdata, uint8_t chunk, bool more) { +int handler_sign_tx(buffer_t* cdata, uint8_t chunk, bool more) { PRINTF("handler_sign_tx called\n"); #ifdef HAVE_SWAP if (G_called_from_swap) { @@ -57,15 +57,15 @@ int handler_sign_tx(buffer_t *cdata, uint8_t chunk, bool more) { prev_chunk = chunk; if (!buffer_read_u8(cdata, &G_context.bip32_path_len) || - !buffer_read_bip32_path(cdata, - G_context.bip32_path, - (size_t) G_context.bip32_path_len)) { + !buffer_read_bip32_path(cdata, G_context.bip32_path, + (size_t)G_context.bip32_path_len)) { // unable to recover from this error, reset the context G_context.req_type = REQUEST_UNDEFINED; return io_send_sw(SW_WRONG_DATA_LENGTH); } - if (!validate_aptos_bip32_path(G_context.bip32_path, G_context.bip32_path_len)) { + if (!validate_aptos_bip32_path(G_context.bip32_path, + G_context.bip32_path_len)) { G_context.req_type = REQUEST_UNDEFINED; return io_send_sw(SW_GET_PUB_KEY_FAIL); } @@ -73,12 +73,15 @@ int handler_sign_tx(buffer_t *cdata, uint8_t chunk, bool more) { return io_send_sw(SW_OK); } else { // parse transaction if (G_context.req_type != CONFIRM_TRANSACTION) { - // there may be data in the global context's union, reset the context anyway + // there may be data in the global context's union, reset the + // context anyway G_context.req_type = REQUEST_UNDEFINED; return io_send_sw(SW_BAD_STATE); } - if (G_context.state == STATE_PARSED || G_context.state == STATE_APPROVED) { - // should not get here, double check, context should already be reset + if (G_context.state == STATE_PARSED || + G_context.state == STATE_APPROVED) { + // should not get here, double check, context should already be + // reset return io_send_sw(SW_BAD_STATE); } if (chunk != prev_chunk + 1) { @@ -87,10 +90,11 @@ int handler_sign_tx(buffer_t *cdata, uint8_t chunk, bool more) { } prev_chunk = chunk; - if (G_context.tx_info.raw_tx_len + cdata->size > sizeof(G_context.tx_info.raw_tx) || - !buffer_move(cdata, - G_context.tx_info.raw_tx + G_context.tx_info.raw_tx_len, - cdata->size)) { + if (G_context.tx_info.raw_tx_len + cdata->size > + sizeof(G_context.tx_info.raw_tx) || + !buffer_move( + cdata, G_context.tx_info.raw_tx + G_context.tx_info.raw_tx_len, + cdata->size)) { // copying did not happen, allow the smaller chunk to be resent return io_send_sw(SW_WRONG_TX_LENGTH); } @@ -102,16 +106,19 @@ int handler_sign_tx(buffer_t *cdata, uint8_t chunk, bool more) { return io_send_sw(SW_OK); } else { - // last APDU for this transaction, let's parse, display and request a sign confirmation + // last APDU for this transaction, let's parse, display and request + // a sign confirmation buffer_t buf = {.ptr = G_context.tx_info.raw_tx, .size = G_context.tx_info.raw_tx_len, .offset = 0}; - parser_status_e status = transaction_deserialize(&buf, &G_context.tx_info.transaction); + parser_status_e status = + transaction_deserialize(&buf, &G_context.tx_info.transaction); PRINTF("Parsing status: %d.\n", status); if (status != PARSING_OK) { - // reset the context to prevent sending the "last" chunk multiple times + // reset the context to prevent sending the "last" chunk + // multiple times G_context.req_type = REQUEST_UNDEFINED; return io_send_sw(SW_TX_PARSING_FAIL); } @@ -120,20 +127,24 @@ int handler_sign_tx(buffer_t *cdata, uint8_t chunk, bool more) { #ifdef HAVE_SWAP // If we are in swap context, do not redisplay the message data - // Instead, ensure they are identical with what was previously displayed + // Instead, ensure they are identical with what was previously + // displayed if (G_called_from_swap) { if (G_swap_response_ready) { // Safety against trying to make the app sign multiple TX - // This code should never be triggered as the app is supposed to exit after - // sending the signed transaction + // This code should never be triggered as the app is + // supposed to exit after sending the signed transaction PRINTF("Safety against double signing triggered\n"); io_send_sw(SW_SWAP_CHECKING_FAIL); os_sched_exit(-1); } else { - // We will quit the app after this transaction, whether it succeeds or fails - PRINTF("Swap response is ready, the app will quit after the next send\n"); - // This boolean will make the io_send_sw family instant reply + return to - // exchange + // We will quit the app after this transaction, whether it + // succeeds or fails + PRINTF( + "Swap response is ready, the app will quit after the " + "next send\n"); + // This boolean will make the io_send_sw family instant + // reply + return to exchange G_swap_response_ready = true; } if (swap_check_validity()) { @@ -152,7 +163,8 @@ int handler_sign_tx(buffer_t *cdata, uint8_t chunk, bool more) { } #else int ui_status = ui_display_transaction(); - G_context.req_type = REQUEST_UNDEFINED; // all the work is done, reset the context + G_context.req_type = + REQUEST_UNDEFINED; // all the work is done, reset the context return ui_status; #endif } diff --git a/src/helper/send_reponse.c b/src/helper/send_reponse.c index 9339282..b622e98 100644 --- a/src/helper/send_reponse.c +++ b/src/helper/send_reponse.c @@ -19,12 +19,11 @@ #include // uint*_t #include // memmove -#include "buffer.h" - -#include "send_response.h" #include "../constants.h" #include "../globals.h" #include "../sw.h" +#include "buffer.h" +#include "send_response.h" int helper_send_response_pubkey() { uint8_t resp[1 + 1 + PUBKEY_LEN + 1 + CHAINCODE_LEN] = {0}; @@ -46,7 +45,8 @@ int helper_send_response_sig() { size_t offset = 0; resp[offset++] = G_context.tx_info.signature_len; - memmove(resp + offset, G_context.tx_info.signature, G_context.tx_info.signature_len); + memmove(resp + offset, G_context.tx_info.signature, + G_context.tx_info.signature_len); offset += G_context.tx_info.signature_len; return io_send_response_pointer(resp, offset, SW_OK); diff --git a/src/swap/handle_check_address.c b/src/swap/handle_check_address.c index f68671a..e780234 100644 --- a/src/swap/handle_check_address.c +++ b/src/swap/handle_check_address.c @@ -16,16 +16,18 @@ *****************************************************************************/ #ifdef HAVE_SWAP +#include #include -#include "swap.h" -#include "os.h" + #include "../address.h" -#include "../handler/get_public_key.h" #include "../common/user_format.h" +#include "../handler/get_public_key.h" #include "../transaction/utils.h" -#include +#include "os.h" +#include "swap.h" -// The address string length is 66, 2 characters for the prefix and 64 for the address +// The address string length is 66, 2 characters for the prefix and 64 for the +// address #define ADDRESS_STRING_LENGTH 66 /** @@ -37,18 +39,19 @@ * Command data address parameters and address to check. * */ -void swap_handle_check_address(check_address_parameters_t *params) { +void swap_handle_check_address(check_address_parameters_t* params) { PRINTF("Inside Aptos swap_handle_check_address\n"); params->result = 0; // Checking that parameters are correct - if (params->address_parameters == NULL || params->address_parameters_length == 0) { + if (params->address_parameters == NULL || + params->address_parameters_length == 0) { PRINTF("address_parameters is empty\n"); return; } - PRINTF("address_parameters_length: %d\n", params->address_parameters_length); - PRINTF("address_parameters: %.*H\n", - params->address_parameters_length, + PRINTF("address_parameters_length: %d\n", + params->address_parameters_length); + PRINTF("address_parameters: %.*H\n", params->address_parameters_length, params->address_parameters); if (params->address_to_check == NULL) { @@ -58,8 +61,7 @@ void swap_handle_check_address(check_address_parameters_t *params) { if (strlen(params->address_to_check) != ADDRESS_STRING_LENGTH) { PRINTF("address_to_check length should be %d, not %d\n", - ADDRESS_STRING_LENGTH, - strlen(params->address_to_check)); + ADDRESS_STRING_LENGTH, strlen(params->address_to_check)); return; } @@ -76,14 +78,16 @@ void swap_handle_check_address(check_address_parameters_t *params) { PRINTF("get_public_key failed\n"); return; } - // Calculate the address from the public key, and decode it to readable format + // Calculate the address from the public key, and decode it to readable + // format uint8_t address[ADDRESS_LEN] = {0}; - if (!address_from_pubkey(public_key.raw_public_key, address, sizeof(address))) { + if (!address_from_pubkey(public_key.raw_public_key, address, + sizeof(address))) { return; } char prefixed_address[ADDRESS_STRING_LENGTH + 1]; - if (0 > - format_prefixed_hex(address, sizeof(address), prefixed_address, sizeof(prefixed_address))) { + if (0 > format_prefixed_hex(address, sizeof(address), prefixed_address, + sizeof(prefixed_address))) { return; } diff --git a/src/swap/handle_get_printable_amount.c b/src/swap/handle_get_printable_amount.c index 47f221e..26d6af1 100644 --- a/src/swap/handle_get_printable_amount.c +++ b/src/swap/handle_get_printable_amount.c @@ -1,14 +1,16 @@ #ifdef HAVE_SWAP #include // memset, explicit_bzero -#include "swap.h" -#include "constants.h" + #include "common/parse.h" +#include "constants.h" +#include "swap.h" #define MAX_TICKER_LEN 16 /* Set empty printable_amount on error, printable amount otherwise */ -void swap_handle_get_printable_amount(get_printable_amount_parameters_t* params) { +void swap_handle_get_printable_amount( + get_printable_amount_parameters_t* params) { uint64_t amount; uint8_t decimals; char ticker[MAX_TICKER_LEN] = {0}; @@ -22,10 +24,8 @@ void swap_handle_get_printable_amount(get_printable_amount_parameters_t* params) decimals = APT_DECIMAL_PRECISION; } else { if (!swap_parse_config(params->coin_configuration, - params->coin_configuration_length, - ticker, - sizeof(ticker), - &decimals)) { + params->coin_configuration_length, ticker, + sizeof(ticker), &decimals)) { PRINTF("Fail to parse coin_configuration\n"); goto error; } @@ -36,9 +36,7 @@ void swap_handle_get_printable_amount(get_printable_amount_parameters_t* params) goto error; } - if (print_amount(amount, - decimals, - params->printable_amount, + if (print_amount(amount, decimals, params->printable_amount, sizeof(params->printable_amount)) == 0) { PRINTF("print_amount failed\n"); goto error; diff --git a/src/swap/handle_swap_sign_transaction.c b/src/swap/handle_swap_sign_transaction.c index c372fa6..5fa7215 100644 --- a/src/swap/handle_swap_sign_transaction.c +++ b/src/swap/handle_swap_sign_transaction.c @@ -1,17 +1,18 @@ #ifdef HAVE_SWAP #include "handle_swap_sign_transaction.h" + +#include "../globals.h" +#include "common/parse.h" +#include "constants.h" #include "display.h" -#include "swap.h" -#include "string.h" +#include "globals.h" +#include "os.h" #include "os_lib.h" -#include "constants.h" #include "os_utils.h" -#include "globals.h" +#include "string.h" #include "sw.h" -#include "os.h" -#include "../globals.h" -#include "common/parse.h" +#include "swap.h" typedef struct swap_validated_s { bool initialized; @@ -62,11 +63,10 @@ bool swap_copy_transaction_parameters(create_transaction_parameters_t* params) { return false; } // first copy parameters to stack, and then to global data. - // We need this "trick" as the input data position can overlap with app globals - // and also because we want to memset the whole bss segment as it is not done - // when an app is called as a lib. - // This is necessary as many part of the code expect bss variables to - // initialized at 0. + // We need this "trick" as the input data position can overlap with app + // globals and also because we want to memset the whole bss segment as it is + // not done when an app is called as a lib. This is necessary as many part + // of the code expect bss variables to initialized at 0. swap_validated_t swap_validated; memset(&swap_validated, 0, sizeof(swap_validated)); @@ -76,11 +76,10 @@ bool swap_copy_transaction_parameters(create_transaction_parameters_t* params) { memcpy(swap_validated.ticker, "APT", sizeof("APT")); swap_validated.decimals = APT_DECIMAL_PRECISION; } else { - if (!swap_parse_config(params->coin_configuration, - params->coin_configuration_length, - swap_validated.ticker, - sizeof(swap_validated.ticker), - &swap_validated.decimals)) { + if (!swap_parse_config( + params->coin_configuration, params->coin_configuration_length, + swap_validated.ticker, sizeof(swap_validated.ticker), + &swap_validated.decimals)) { PRINTF("Fail to parse coin_configuration\n"); return false; } @@ -88,18 +87,20 @@ bool swap_copy_transaction_parameters(create_transaction_parameters_t* params) { // Save recipient PRINTF("Recipient in params: %s\n", params->destination_address); - if (hex_str_to_u8(params->destination_address + 2, swap_validated.recipient, ADDRESS_LEN) != - 0) { + if (hex_str_to_u8(params->destination_address + 2, swap_validated.recipient, + ADDRESS_LEN) != 0) { PRINTF("Fail to parse recipient\n"); }; // Save amount - if (!swap_str_to_u64(params->amount, params->amount_length, &swap_validated.amount)) { + if (!swap_str_to_u64(params->amount, params->amount_length, + &swap_validated.amount)) { return false; } // Save the fee - if (!swap_str_to_u64(params->fee_amount, params->fee_amount_length, &swap_validated.fee)) { + if (!swap_str_to_u64(params->fee_amount, params->fee_amount_length, + &swap_validated.fee)) { return false; } @@ -111,7 +112,8 @@ bool swap_copy_transaction_parameters(create_transaction_parameters_t* params) { // Keep the address at which we'll reply the signing status G_swap_sign_return_value_address = ¶ms->result; - // Commit from stack to global data, params becomes tainted but we won't access it anymore + // Commit from stack to global data, params becomes tainted but we won't + // access it anymore memcpy(&G_swap_validated, &swap_validated, sizeof(swap_validated)); PRINTF("Exiting Aptos swap_copy_transaction_parameters\n"); @@ -132,17 +134,17 @@ static bool validate_swap_amount(uint64_t amount) { if (amount != G_swap_validated.amount) { return false; } - // NOTE: in other Nano Apps the validation is done in string type. We're keeping it as well. + // NOTE: in other Nano Apps the validation is done in string type. We're + // keeping it as well. char validated_amount_str[MAX_PRINTABLE_AMOUNT_SIZE]; - if (print_amount(G_swap_validated.amount, - G_swap_validated.decimals, - validated_amount_str, - sizeof(validated_amount_str)) == 0) { + if (print_amount(G_swap_validated.amount, G_swap_validated.decimals, + validated_amount_str, sizeof(validated_amount_str)) == 0) { PRINTF("Conversion failed\n"); return false; } char amount_str[MAX_PRINTABLE_AMOUNT_SIZE]; - if (print_amount(amount, G_swap_validated.decimals, amount_str, sizeof(amount_str)) == 0) { + if (print_amount(amount, G_swap_validated.decimals, amount_str, + sizeof(amount_str)) == 0) { PRINTF("Conversion failed\n"); return false; } @@ -171,7 +173,8 @@ bool swap_check_validity() { // Validate it's and actual coin transfer type transaction_t* transaction = &G_context.tx_info.transaction; if (transaction->tx_variant != TX_RAW) { - PRINTF("TX variant different from TX_RAW is not compatible with Swap.\n"); + PRINTF( + "TX variant different from TX_RAW is not compatible with Swap.\n"); return false; } @@ -184,16 +187,20 @@ bool swap_check_validity() { // Differentiate between the different types of transaction-> uint64_t amount = 0; uint8_t* receiver; - uint64_t gas_fee_value = transaction->gas_unit_price * transaction->max_gas_amount; + uint64_t gas_fee_value = + transaction->gas_unit_price * transaction->max_gas_amount; switch (transaction->payload.entry_function.known_type) { case FUNC_APTOS_ACCOUNT_TRANSFER: amount = transaction->payload.entry_function.args.transfer.amount; - receiver = transaction->payload.entry_function.args.transfer.receiver; + receiver = + transaction->payload.entry_function.args.transfer.receiver; break; case FUNC_COIN_TRANSFER: case FUNC_APTOS_ACCOUNT_TRANSFER_COINS: - amount = transaction->payload.entry_function.args.coin_transfer.amount; - receiver = transaction->payload.entry_function.args.coin_transfer.receiver; + amount = + transaction->payload.entry_function.args.coin_transfer.amount; + receiver = + transaction->payload.entry_function.args.coin_transfer.receiver; break; default: PRINTF("Unknown function type\n"); @@ -214,9 +221,12 @@ bool swap_check_validity() { // Validate recipient if (memcmp(receiver, G_swap_validated.recipient, ADDRESS_LEN) != 0) { - PRINTF("Recipient on Transaction is different from validated package.\n"); - PRINTF("Recipient requested in the transaction: %.*H\n", ADDRESS_LEN, receiver); - PRINTF("Recipient validated in the swap: %.*H\n", ADDRESS_LEN, G_swap_validated.recipient); + PRINTF( + "Recipient on Transaction is different from validated package.\n"); + PRINTF("Recipient requested in the transaction: %.*H\n", ADDRESS_LEN, + receiver); + PRINTF("Recipient validated in the swap: %.*H\n", ADDRESS_LEN, + G_swap_validated.recipient); return false; } diff --git a/src/transaction/deserialize.c b/src/transaction/deserialize.c index 86e59a0..550a5a5 100644 --- a/src/transaction/deserialize.c +++ b/src/transaction/deserialize.c @@ -1,15 +1,15 @@ +#include "deserialize.h" + #include +#include "../bcs/decoder.h" +#include "../bcs/init.h" +#include "../constants.h" #include "buffer.h" - -#include "deserialize.h" -#include "utils.h" #include "types.h" -#include "../constants.h" -#include "../bcs/init.h" -#include "../bcs/decoder.h" +#include "utils.h" -parser_status_e transaction_deserialize(buffer_t *buf, transaction_t *tx) { +parser_status_e transaction_deserialize(buffer_t* buf, transaction_t* tx) { if (buf->size > MAX_TRANSACTION_LEN) { return WRONG_LENGTH_ERROR; } @@ -25,11 +25,13 @@ parser_status_e transaction_deserialize(buffer_t *buf, transaction_t *tx) { case TX_RAW_WITH_DATA: break; case TX_RAW_MESSAGE: - break; // Since the raw message is processed before display without direct transaction - // buffer reads, null-termination concerns are mitigated. + break; // Since the raw message is processed before display without + // direct transaction buffer reads, null-termination + // concerns are mitigated. case TX_MESSAGE: // To make sure the message is a null-terminated string - if (buf->size == MAX_TRANSACTION_LEN && buf->ptr[MAX_TRANSACTION_LEN - 1] != 0) { + if (buf->size == MAX_TRANSACTION_LEN && + buf->ptr[MAX_TRANSACTION_LEN - 1] != 0) { return WRONG_LENGTH_ERROR; } @@ -41,13 +43,13 @@ parser_status_e transaction_deserialize(buffer_t *buf, transaction_t *tx) { return PARSING_OK; } -parser_status_e tx_raw_deserialize(buffer_t *buf, transaction_t *tx) { +parser_status_e tx_raw_deserialize(buffer_t* buf, transaction_t* tx) { if (tx->tx_variant != TX_RAW) { return TX_VARIANT_UNDEFINED_ERROR; } // read sender address - if (!bcs_read_fixed_bytes(buf, (uint8_t *) &tx->sender, ADDRESS_LEN)) { + if (!bcs_read_fixed_bytes(buf, (uint8_t*)&tx->sender, ADDRESS_LEN)) { return SENDER_READ_ERROR; } // read sequence @@ -56,7 +58,8 @@ parser_status_e tx_raw_deserialize(buffer_t *buf, transaction_t *tx) { } const size_t buf_footer_begin = buf->size - TX_FOOTER_LEN; - buffer_t buf_footer = {.ptr = buf->ptr, .size = buf->size, .offset = buf_footer_begin}; + buffer_t buf_footer = { + .ptr = buf->ptr, .size = buf->size, .offset = buf_footer_begin}; // read max_gas_amount if (!bcs_read_u64(&buf_footer, &tx->max_gas_amount)) { return MAX_GAS_READ_ERROR; @@ -79,7 +82,8 @@ parser_status_e tx_raw_deserialize(buffer_t *buf, transaction_t *tx) { if (!bcs_read_u32_from_uleb128(buf, &payload_variant)) { return PAYLOAD_VARIANT_READ_ERROR; } - if (payload_variant != PAYLOAD_ENTRY_FUNCTION && payload_variant != PAYLOAD_SCRIPT && + if (payload_variant != PAYLOAD_ENTRY_FUNCTION && + payload_variant != PAYLOAD_SCRIPT && payload_variant != PAYLOAD_MULTISIG) { return PAYLOAD_UNDEFINED_ERROR; } @@ -88,12 +92,15 @@ parser_status_e tx_raw_deserialize(buffer_t *buf, transaction_t *tx) { parser_status_e payload_parsing_status = 0; switch (tx->payload_variant) { case PAYLOAD_ENTRY_FUNCTION: - payload_parsing_status = entry_function_payload_deserialize(buf, tx); + payload_parsing_status = + entry_function_payload_deserialize(buf, tx); if (payload_parsing_status != PARSING_OK) { return payload_parsing_status; } - if (tx->payload.entry_function.known_type == FUNC_APTOS_ACCOUNT_TRANSFER) { - return (buf->offset == buf_footer_begin) ? PARSING_OK : WRONG_LENGTH_ERROR; + if (tx->payload.entry_function.known_type == + FUNC_APTOS_ACCOUNT_TRANSFER) { + return (buf->offset == buf_footer_begin) ? PARSING_OK + : WRONG_LENGTH_ERROR; } return PARSING_OK; case PAYLOAD_SCRIPT: @@ -109,17 +116,18 @@ parser_status_e tx_raw_deserialize(buffer_t *buf, transaction_t *tx) { return PARSING_OK; } -parser_status_e tx_variant_deserialize(buffer_t *buf, transaction_t *tx) { +parser_status_e tx_variant_deserialize(buffer_t* buf, transaction_t* tx) { if (buf->offset != 0) { return TX_VARIANT_READ_ERROR; } tx->tx_variant = TX_UNDEFINED; - uint8_t *prefix; + uint8_t* prefix; // read hashed prefix bytes if (bcs_read_ptr_to_fixed_bytes(buf, &prefix, TX_HASHED_PREFIX_LEN)) { - if (memcmp(prefix, PREFIX_RAW_TX_WITH_DATA_HASHED, TX_HASHED_PREFIX_LEN) == 0) { + if (memcmp(prefix, PREFIX_RAW_TX_WITH_DATA_HASHED, + TX_HASHED_PREFIX_LEN) == 0) { tx->tx_variant = TX_RAW_WITH_DATA; return PARSING_OK; } @@ -130,46 +138,48 @@ parser_status_e tx_variant_deserialize(buffer_t *buf, transaction_t *tx) { } } - // Not a transaction prefix, so we reset the offer to consider the full message + // Not a transaction prefix, so we reset the offer to consider the full + // message buf->offset = 0; // Try to display the message as UTF8 if possible - tx->tx_variant = - transaction_utils_check_encoding(buf->ptr, buf->size) ? TX_MESSAGE : TX_RAW_MESSAGE; + tx->tx_variant = transaction_utils_check_encoding(buf->ptr, buf->size) + ? TX_MESSAGE + : TX_RAW_MESSAGE; return PARSING_OK; } -parser_status_e entry_function_payload_deserialize(buffer_t *buf, transaction_t *tx) { +parser_status_e entry_function_payload_deserialize(buffer_t* buf, + transaction_t* tx) { if (tx->payload_variant != PAYLOAD_ENTRY_FUNCTION) { return PAYLOAD_UNDEFINED_ERROR; } - entry_function_payload_t *payload = &tx->payload.entry_function; + entry_function_payload_t* payload = &tx->payload.entry_function; entry_function_payload_init(payload); // read module id address field - if (!bcs_read_fixed_bytes(buf, - (uint8_t *) payload->module_id.address, + if (!bcs_read_fixed_bytes(buf, (uint8_t*)payload->module_id.address, sizeof payload->module_id.address)) { return MODULE_ID_ADDR_READ_ERROR; } // read module_id name len field - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &payload->module_id.name.len)) { + if (!bcs_read_u32_from_uleb128(buf, + (uint32_t*)&payload->module_id.name.len)) { return MODULE_ID_NAME_LEN_READ_ERROR; } // read module_id name bytes field - if (!bcs_read_ptr_to_fixed_bytes(buf, - &payload->module_id.name.bytes, + if (!bcs_read_ptr_to_fixed_bytes(buf, &payload->module_id.name.bytes, payload->module_id.name.len)) { return MODULE_ID_NAME_BYTES_READ_ERROR; } // read function_name len field - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &payload->function_name.len)) { + if (!bcs_read_u32_from_uleb128(buf, + (uint32_t*)&payload->function_name.len)) { return FUNCTION_NAME_LEN_READ_ERROR; } // read function_name bytes field - if (!bcs_read_ptr_to_fixed_bytes(buf, - &payload->function_name.bytes, + if (!bcs_read_ptr_to_fixed_bytes(buf, &payload->function_name.bytes, payload->function_name.len)) { return FUNCTION_NAME_BYTES_READ_ERROR; } @@ -195,24 +205,25 @@ parser_status_e entry_function_payload_deserialize(buffer_t *buf, transaction_t return PARSING_OK; } -parser_status_e aptos_account_transfer_function_deserialize(buffer_t *buf, transaction_t *tx) { +parser_status_e aptos_account_transfer_function_deserialize(buffer_t* buf, + transaction_t* tx) { if (tx->payload_variant != PAYLOAD_ENTRY_FUNCTION) { return PAYLOAD_UNDEFINED_ERROR; } - entry_function_payload_t *payload = &tx->payload.entry_function; + entry_function_payload_t* payload = &tx->payload.entry_function; if (payload->known_type != FUNC_APTOS_ACCOUNT_TRANSFER) { return PAYLOAD_UNDEFINED_ERROR; } // read type args size - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &payload->args.ty_size)) { + if (!bcs_read_u32_from_uleb128(buf, (uint32_t*)&payload->args.ty_size)) { return TYPE_ARGS_SIZE_READ_ERROR; } if (payload->args.ty_size != 0) { return TYPE_ARGS_SIZE_UNEXPECTED_ERROR; } // read args size - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &payload->args.args_size)) { + if (!bcs_read_u32_from_uleb128(buf, (uint32_t*)&payload->args.args_size)) { return ARGS_SIZE_READ_ERROR; } if (payload->args.args_size != 2) { @@ -227,7 +238,8 @@ parser_status_e aptos_account_transfer_function_deserialize(buffer_t *buf, trans return WRONG_ADDRESS_LEN_ERROR; } // read receiver address field - if (!bcs_read_fixed_bytes(buf, (uint8_t *) &payload->args.transfer.receiver, ADDRESS_LEN)) { + if (!bcs_read_fixed_bytes(buf, (uint8_t*)&payload->args.transfer.receiver, + ADDRESS_LEN)) { return RECEIVER_ADDR_READ_ERROR; } uint32_t amount_len; @@ -246,18 +258,19 @@ parser_status_e aptos_account_transfer_function_deserialize(buffer_t *buf, trans return PARSING_OK; } -parser_status_e coin_transfer_function_deserialize(buffer_t *buf, transaction_t *tx) { +parser_status_e coin_transfer_function_deserialize(buffer_t* buf, + transaction_t* tx) { if (tx->payload_variant != PAYLOAD_ENTRY_FUNCTION) { return PAYLOAD_UNDEFINED_ERROR; } - entry_function_payload_t *payload = &tx->payload.entry_function; + entry_function_payload_t* payload = &tx->payload.entry_function; if (payload->known_type != FUNC_COIN_TRANSFER && payload->known_type != FUNC_APTOS_ACCOUNT_TRANSFER_COINS) { return PAYLOAD_UNDEFINED_ERROR; } // read type args size field - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &payload->args.ty_size)) { + if (!bcs_read_u32_from_uleb128(buf, (uint32_t*)&payload->args.ty_size)) { return TYPE_ARGS_SIZE_READ_ERROR; } if (payload->args.ty_size != 1) { @@ -273,13 +286,15 @@ parser_status_e coin_transfer_function_deserialize(buffer_t *buf, transaction_t return TYPE_TAG_UNEXPECTED_ERROR; } - args_coin_transfer_t *coin_transfer = &payload->args.coin_transfer; + args_coin_transfer_t* coin_transfer = &payload->args.coin_transfer; // read coin struct address field - if (!bcs_read_fixed_bytes(buf, (uint8_t *) &coin_transfer->ty_coin.address, ADDRESS_LEN)) { + if (!bcs_read_fixed_bytes(buf, (uint8_t*)&coin_transfer->ty_coin.address, + ADDRESS_LEN)) { return STRUCT_ADDRESS_READ_ERROR; } // read coin struct module name len - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &coin_transfer->ty_coin.module_name.len)) { + if (!bcs_read_u32_from_uleb128( + buf, (uint32_t*)&coin_transfer->ty_coin.module_name.len)) { return STRUCT_MODULE_LEN_READ_ERROR; } // read coin struct module name field @@ -289,17 +304,18 @@ parser_status_e coin_transfer_function_deserialize(buffer_t *buf, transaction_t return STRUCT_MODULE_BYTES_READ_ERROR; } // read coin struct name len - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &coin_transfer->ty_coin.name.len)) { + if (!bcs_read_u32_from_uleb128( + buf, (uint32_t*)&coin_transfer->ty_coin.name.len)) { return STRUCT_NAME_LEN_READ_ERROR; } // read coin struct name field - if (!bcs_read_ptr_to_fixed_bytes(buf, - &coin_transfer->ty_coin.name.bytes, + if (!bcs_read_ptr_to_fixed_bytes(buf, &coin_transfer->ty_coin.name.bytes, coin_transfer->ty_coin.name.len)) { return STRUCT_NAME_BYTES_READ_ERROR; } // read coin struct args size - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &coin_transfer->ty_coin.type_args_size)) { + if (!bcs_read_u32_from_uleb128( + buf, (uint32_t*)&coin_transfer->ty_coin.type_args_size)) { return STRUCT_TYPE_ARGS_SIZE_READ_ERROR; } if (coin_transfer->ty_coin.type_args_size != 0) { @@ -307,7 +323,7 @@ parser_status_e coin_transfer_function_deserialize(buffer_t *buf, transaction_t } // read args size - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &payload->args.args_size)) { + if (!bcs_read_u32_from_uleb128(buf, (uint32_t*)&payload->args.args_size)) { return ARGS_SIZE_READ_ERROR; } if (payload->args.args_size != 2) { @@ -322,7 +338,8 @@ parser_status_e coin_transfer_function_deserialize(buffer_t *buf, transaction_t return WRONG_ADDRESS_LEN_ERROR; } // read receiver address field - if (!bcs_read_fixed_bytes(buf, (uint8_t *) &payload->args.transfer.receiver, ADDRESS_LEN)) { + if (!bcs_read_fixed_bytes(buf, (uint8_t*)&payload->args.transfer.receiver, + ADDRESS_LEN)) { return RECEIVER_ADDR_READ_ERROR; } uint32_t amount_len; @@ -341,17 +358,18 @@ parser_status_e coin_transfer_function_deserialize(buffer_t *buf, transaction_t return PARSING_OK; } -parser_status_e fa_transfer_function_deserialize(buffer_t *buf, transaction_t *tx) { +parser_status_e fa_transfer_function_deserialize(buffer_t* buf, + transaction_t* tx) { if (tx->payload_variant != PAYLOAD_ENTRY_FUNCTION) { return PAYLOAD_UNDEFINED_ERROR; } - entry_function_payload_t *payload = &tx->payload.entry_function; + entry_function_payload_t* payload = &tx->payload.entry_function; if (payload->known_type != FUNC_FUNGIBLE_STORE_TRANSFER) { return PAYLOAD_UNDEFINED_ERROR; } // read type args size - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &payload->args.ty_size)) { + if (!bcs_read_u32_from_uleb128(buf, (uint32_t*)&payload->args.ty_size)) { return TYPE_ARGS_SIZE_READ_ERROR; } @@ -369,13 +387,15 @@ parser_status_e fa_transfer_function_deserialize(buffer_t *buf, transaction_t *t } // READ type Arguments - args_fungible_asset_transfer_t *fa_transfer = &payload->args.fa_transfer; + args_fungible_asset_transfer_t* fa_transfer = &payload->args.fa_transfer; // read coin struct address field - if (!bcs_read_fixed_bytes(buf, (uint8_t *) &fa_transfer->ty_args.address, ADDRESS_LEN)) { + if (!bcs_read_fixed_bytes(buf, (uint8_t*)&fa_transfer->ty_args.address, + ADDRESS_LEN)) { return STRUCT_ADDRESS_READ_ERROR; } // read coin struct module name len - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &fa_transfer->ty_args.module_name.len)) { + if (!bcs_read_u32_from_uleb128( + buf, (uint32_t*)&fa_transfer->ty_args.module_name.len)) { return STRUCT_MODULE_LEN_READ_ERROR; } // read coin struct module name field @@ -385,18 +405,19 @@ parser_status_e fa_transfer_function_deserialize(buffer_t *buf, transaction_t *t return STRUCT_MODULE_BYTES_READ_ERROR; } // read coin struct name len - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &fa_transfer->ty_args.name.len)) { + if (!bcs_read_u32_from_uleb128(buf, + (uint32_t*)&fa_transfer->ty_args.name.len)) { return STRUCT_NAME_LEN_READ_ERROR; } // read coin struct name field - if (!bcs_read_ptr_to_fixed_bytes(buf, - &fa_transfer->ty_args.name.bytes, + if (!bcs_read_ptr_to_fixed_bytes(buf, &fa_transfer->ty_args.name.bytes, fa_transfer->ty_args.name.len)) { return STRUCT_NAME_BYTES_READ_ERROR; } // read coin struct args size - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &fa_transfer->ty_args.type_args_size)) { + if (!bcs_read_u32_from_uleb128( + buf, (uint32_t*)&fa_transfer->ty_args.type_args_size)) { return STRUCT_TYPE_ARGS_SIZE_READ_ERROR; } if (fa_transfer->ty_args.type_args_size != 0) { @@ -405,7 +426,7 @@ parser_status_e fa_transfer_function_deserialize(buffer_t *buf, transaction_t *t // READ function arguments // read args size - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &payload->args.args_size)) { + if (!bcs_read_u32_from_uleb128(buf, (uint32_t*)&payload->args.args_size)) { return ARGS_SIZE_READ_ERROR; } if (payload->args.args_size != 3) { @@ -422,7 +443,8 @@ parser_status_e fa_transfer_function_deserialize(buffer_t *buf, transaction_t *t } // add fungible store address - if (!bcs_read_fixed_bytes(buf, (uint8_t *) &fa_transfer->fungible_asset.address, ADDRESS_LEN)) { + if (!bcs_read_fixed_bytes( + buf, (uint8_t*)&fa_transfer->fungible_asset.address, ADDRESS_LEN)) { return STRUCT_ADDRESS_READ_ERROR; } @@ -435,7 +457,8 @@ parser_status_e fa_transfer_function_deserialize(buffer_t *buf, transaction_t *t return WRONG_ADDRESS_LEN_ERROR; } // read receiver address field - if (!bcs_read_fixed_bytes(buf, (uint8_t *) &payload->args.fa_transfer.receiver, ADDRESS_LEN)) { + if (!bcs_read_fixed_bytes( + buf, (uint8_t*)&payload->args.fa_transfer.receiver, ADDRESS_LEN)) { return RECEIVER_ADDR_READ_ERROR; } uint32_t amount_len; @@ -454,19 +477,20 @@ parser_status_e fa_transfer_function_deserialize(buffer_t *buf, transaction_t *t return PARSING_OK; } -parser_status_e delegation_pool_deserialize(buffer_t *buf, transaction_t *tx) { +parser_status_e delegation_pool_deserialize(buffer_t* buf, transaction_t* tx) { if (tx->payload_variant != PAYLOAD_ENTRY_FUNCTION) { return PAYLOAD_UNDEFINED_ERROR; } - entry_function_payload_t *payload = &tx->payload.entry_function; - if (payload->known_type != FUNC_ADD_STAKE && payload->known_type != FUNC_UNLOCK_STAKE && + entry_function_payload_t* payload = &tx->payload.entry_function; + if (payload->known_type != FUNC_ADD_STAKE && + payload->known_type != FUNC_UNLOCK_STAKE && payload->known_type != FUNC_REACTIVATE_STAKE && payload->known_type != FUNC_WITHDRAW_STAKE) { return PAYLOAD_UNDEFINED_ERROR; } // read type args size - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &payload->args.ty_size)) { + if (!bcs_read_u32_from_uleb128(buf, (uint32_t*)&payload->args.ty_size)) { return TYPE_ARGS_SIZE_READ_ERROR; } @@ -475,7 +499,7 @@ parser_status_e delegation_pool_deserialize(buffer_t *buf, transaction_t *tx) { } // read args size - if (!bcs_read_u32_from_uleb128(buf, (uint32_t *) &payload->args.args_size)) { + if (!bcs_read_u32_from_uleb128(buf, (uint32_t*)&payload->args.args_size)) { return ARGS_SIZE_READ_ERROR; } if (payload->args.args_size != 2) { @@ -492,7 +516,8 @@ parser_status_e delegation_pool_deserialize(buffer_t *buf, transaction_t *tx) { return WRONG_ADDRESS_LEN_ERROR; } // read receiver pool field - if (!bcs_read_fixed_bytes(buf, (uint8_t *) &payload->args.delegation.pool, ADDRESS_LEN)) { + if (!bcs_read_fixed_bytes(buf, (uint8_t*)&payload->args.delegation.pool, + ADDRESS_LEN)) { return RECEIVER_ADDR_READ_ERROR; } @@ -513,47 +538,59 @@ parser_status_e delegation_pool_deserialize(buffer_t *buf, transaction_t *tx) { return PARSING_OK; } -entry_function_known_type_t determine_function_type(transaction_t *tx) { +entry_function_known_type_t determine_function_type(transaction_t* tx) { if (tx->payload_variant != PAYLOAD_ENTRY_FUNCTION) { return FUNC_UNKNOWN; } if (tx->payload.entry_function.module_id.address[ADDRESS_LEN - 1] == 0x01 && - bcs_cmp_bytes(&tx->payload.entry_function.module_id.name, "aptos_account", 13) && - bcs_cmp_bytes(&tx->payload.entry_function.function_name, "transfer", 8)) { + bcs_cmp_bytes(&tx->payload.entry_function.module_id.name, + "aptos_account", 13) && + bcs_cmp_bytes(&tx->payload.entry_function.function_name, "transfer", + 8)) { return FUNC_APTOS_ACCOUNT_TRANSFER; } if (tx->payload.entry_function.module_id.address[ADDRESS_LEN - 1] == 0x01 && bcs_cmp_bytes(&tx->payload.entry_function.module_id.name, "coin", 4) && - bcs_cmp_bytes(&tx->payload.entry_function.function_name, "transfer", 8)) { + bcs_cmp_bytes(&tx->payload.entry_function.function_name, "transfer", + 8)) { return FUNC_COIN_TRANSFER; } if (tx->payload.entry_function.module_id.address[ADDRESS_LEN - 1] == 0x01 && - bcs_cmp_bytes(&tx->payload.entry_function.module_id.name, "aptos_account", 13) && - bcs_cmp_bytes(&tx->payload.entry_function.function_name, "transfer_coins", 14)) { + bcs_cmp_bytes(&tx->payload.entry_function.module_id.name, + "aptos_account", 13) && + bcs_cmp_bytes(&tx->payload.entry_function.function_name, + "transfer_coins", 14)) { return FUNC_APTOS_ACCOUNT_TRANSFER_COINS; } if (tx->payload.entry_function.module_id.address[ADDRESS_LEN - 1] == 0x01 && - bcs_cmp_bytes(&tx->payload.entry_function.module_id.name, "primary_fungible_store", 22) && - bcs_cmp_bytes(&tx->payload.entry_function.function_name, "transfer", 8)) { + bcs_cmp_bytes(&tx->payload.entry_function.module_id.name, + "primary_fungible_store", 22) && + bcs_cmp_bytes(&tx->payload.entry_function.function_name, "transfer", + 8)) { return FUNC_FUNGIBLE_STORE_TRANSFER; } if (tx->payload.entry_function.module_id.address[ADDRESS_LEN - 1] == 0x01 && - bcs_cmp_bytes(&tx->payload.entry_function.module_id.name, "delegation_pool", 15)) { - if (bcs_cmp_bytes(&tx->payload.entry_function.function_name, "add_stake", 9)) { + bcs_cmp_bytes(&tx->payload.entry_function.module_id.name, + "delegation_pool", 15)) { + if (bcs_cmp_bytes(&tx->payload.entry_function.function_name, + "add_stake", 9)) { return FUNC_ADD_STAKE; } - if (bcs_cmp_bytes(&tx->payload.entry_function.function_name, "unlock", 6)) { + if (bcs_cmp_bytes(&tx->payload.entry_function.function_name, "unlock", + 6)) { return FUNC_UNLOCK_STAKE; } - if (bcs_cmp_bytes(&tx->payload.entry_function.function_name, "reactivate_stake", 16)) { + if (bcs_cmp_bytes(&tx->payload.entry_function.function_name, + "reactivate_stake", 16)) { return FUNC_REACTIVATE_STAKE; } - if (bcs_cmp_bytes(&tx->payload.entry_function.function_name, "withdraw", 8)) { + if (bcs_cmp_bytes(&tx->payload.entry_function.function_name, "withdraw", + 8)) { return FUNC_WITHDRAW_STAKE; } } diff --git a/src/transaction/utils.c b/src/transaction/utils.c index 88d2eb7..bf1eb11 100644 --- a/src/transaction/utils.c +++ b/src/transaction/utils.c @@ -15,14 +15,14 @@ * limitations under the License. *****************************************************************************/ -#include // uint*_t +#include #include // bool +#include // uint*_t #include // memcmp -#include #include "types.h" -bool transaction_utils_check_encoding(const uint8_t *msg, uint64_t msg_len) { +bool transaction_utils_check_encoding(const uint8_t* msg, uint64_t msg_len) { for (uint64_t i = 0; i < msg_len; i++) { if (msg[i] > 0x7F) { return false; @@ -32,13 +32,14 @@ bool transaction_utils_check_encoding(const uint8_t *msg, uint64_t msg_len) { return true; } -bool bcs_cmp_bytes(const fixed_bytes_t *bcs_bytes, const void *value, size_t len) { +bool bcs_cmp_bytes(const fixed_bytes_t* bcs_bytes, const void* value, + size_t len) { return bcs_bytes->len == len && memcmp(bcs_bytes->bytes, value, len) == 0; } -int _strcasecmp(const char *s1, const char *s2) { - const unsigned char *p1 = (const unsigned char *) s1; - const unsigned char *p2 = (const unsigned char *) s2; +int _strcasecmp(const char* s1, const char* s2) { + const unsigned char* p1 = (const unsigned char*)s1; + const unsigned char* p2 = (const unsigned char*)s2; int result = 0; if (p1 == p2) return 0; while ((result = toupper(*p1) - toupper(*p2++)) == 0) diff --git a/src/ui/action/validate.c b/src/ui/action/validate.c index e28c3bf..e81c9df 100644 --- a/src/ui/action/validate.c +++ b/src/ui/action/validate.c @@ -15,15 +15,15 @@ * limitations under the License. *****************************************************************************/ -#include // bool +#include "validate.h" -#include "io.h" +#include // bool -#include "validate.h" -#include "../../sw.h" #include "../../crypto.h" #include "../../globals.h" #include "../../helper/send_response.h" +#include "../../sw.h" +#include "io.h" void validate_pubkey(bool choice) { if (choice) { diff --git a/src/ui/bagl_display.c b/src/ui/bagl_display.c index 99a3ded..ddd2452 100644 --- a/src/ui/bagl_display.c +++ b/src/ui/bagl_display.c @@ -17,24 +17,24 @@ #ifdef HAVE_BAGL +#include "bagl_display.h" + #include // bool #include // memset -#include "os.h" -#include "ux.h" -#include "glyphs.h" -#include "io.h" -#include "format.h" - -#include "bagl_display.h" -#include "display.h" -#include "settings.h" -#include "menu.h" -#include "constants.h" +#include "../common/user_format.h" #include "../globals.h" #include "../sw.h" #include "action/validate.h" -#include "../common/user_format.h" +#include "constants.h" +#include "display.h" +#include "format.h" +#include "glyphs.h" +#include "io.h" +#include "menu.h" +#include "os.h" +#include "settings.h" +#include "ux.h" #define DOTS "[...]" @@ -54,41 +54,35 @@ static void ui_action_validate_transaction(bool choice) { } // Action to allow blind signing in settings -static void ui_action_allow_blind_signing(const ux_flow_step_t *const *steps) { +static void ui_action_allow_blind_signing(const ux_flow_step_t* const* steps) { settings_allow_blind_signing_change(1); - // Passed UX_FLOW steps are expected to contain a blind signing warning on the first step. - // Skip it for better UX here. + // Passed UX_FLOW steps are expected to contain a blind signing warning on + // the first step. Skip it for better UX here. ux_flow_init(0, steps, steps[1]); } // Step with icon and text -UX_STEP_NOCB(ux_display_blind_sign_banner_step, - pnn, +UX_STEP_NOCB(ux_display_blind_sign_banner_step, pnn, { &C_icon_warning, "Blind signing must be", "enabled in Settings", }); // Step with approve button -UX_STEP_CB(ux_display_approve_step, - pb, - (*g_validate_callback)(true), +UX_STEP_CB(ux_display_approve_step, pb, (*g_validate_callback)(true), { &C_icon_validate_14, "Approve", }); // Step with reject button -UX_STEP_CB(ux_display_reject_step, - pb, - (*g_validate_callback)(false), +UX_STEP_CB(ux_display_reject_step, pb, (*g_validate_callback)(false), { &C_icon_crossmark, "Reject", }); // Step with the button to change settings -UX_STEP_CB(ux_display_allow_blind_sign_step, - pnn, +UX_STEP_CB(ux_display_allow_blind_sign_step, pnn, { g_allow_blind_sign_ctx.call(g_allow_blind_sign_ctx.steps); }, { &C_icon_validate_14, @@ -99,17 +93,16 @@ UX_STEP_CB(ux_display_allow_blind_sign_step, // FLOW to display blind signing banner: // #1 screen : warning icon + "Blind signing must be enabled in Settings" // #2 screen : reject button -UX_FLOW(ux_display_blind_sign_banner_flow, - &ux_display_blind_sign_banner_step, - &ux_display_allow_blind_sign_step, - &ux_display_reject_step); +UX_FLOW(ux_display_blind_sign_banner_flow, &ux_display_blind_sign_banner_step, + &ux_display_allow_blind_sign_step, &ux_display_reject_step); -void ui_flow_display(const ux_flow_step_t *const *steps) { +void ui_flow_display(const ux_flow_step_t* const* steps) { ux_flow_init(0, steps, NULL); } -// This function should always use UX_FLOW containing the blind signing warning on the first step! -void ui_flow_verified_display(const ux_flow_step_t *const *steps) { +// This function should always use UX_FLOW containing the blind signing warning +// on the first step! +void ui_flow_verified_display(const ux_flow_step_t* const* steps) { if (N_storage.settings.allow_blind_signing) { ui_flow_display(steps); } else { @@ -120,17 +113,16 @@ void ui_flow_verified_display(const ux_flow_step_t *const *steps) { } // Step with icon and text -UX_STEP_NOCB(ux_display_confirm_addr_step, pn, {&C_icon_eye, "Confirm Address"}); +UX_STEP_NOCB(ux_display_confirm_addr_step, pn, + {&C_icon_eye, "Confirm Address"}); // Step with title/text for BIP32 path -UX_STEP_NOCB(ux_display_path_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_path_step, bnnn_paging, { .title = "Path", .text = g_bip32_path, }); // Step with title/text for address -UX_STEP_NOCB(ux_display_address_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_address_step, bnnn_paging, { .title = "Address", .text = g_address, @@ -142,12 +134,9 @@ UX_STEP_NOCB(ux_display_address_step, // #3 screen: display address // #4 screen: approve button // #5 screen: reject button -UX_FLOW(ux_display_pubkey_flow, - &ux_display_confirm_addr_step, - &ux_display_path_step, - &ux_display_address_step, - &ux_display_approve_step, - &ux_display_reject_step); +UX_FLOW(ux_display_pubkey_flow, &ux_display_confirm_addr_step, + &ux_display_path_step, &ux_display_address_step, + &ux_display_approve_step, &ux_display_reject_step); int ui_display_address() { g_validate_callback = &ui_action_validate_pubkey; @@ -162,95 +151,82 @@ int ui_display_address() { } // Step with icon and text -UX_STEP_NOCB(ux_display_blind_warn_step, - pnn, +UX_STEP_NOCB(ux_display_blind_warn_step, pnn, { &C_icon_warning, "Blind", "Signing", }); // Step with icon and text -UX_STEP_NOCB(ux_display_review_step, - pnn, +UX_STEP_NOCB(ux_display_review_step, pnn, { &C_icon_eye, "Review", "Transaction", }); // Step with icon and text -UX_STEP_NOCB(ux_display_review_msg_step, - pnn, +UX_STEP_NOCB(ux_display_review_msg_step, pnn, { &C_icon_eye, "Review", "Message", }); // Step with title/text for message -UX_STEP_NOCB(ux_display_msg_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_msg_step, bnnn_paging, { .title = "Message", - .text = (const char *) G_context.tx_info.raw_tx, + .text = (const char*)G_context.tx_info.raw_tx, }); // Step with title/text for message in short form -UX_STEP_NOCB(ux_display_short_msg_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_short_msg_step, bnnn_paging, { .title = "Message", .text = g_struct, }); // Step with title/text for message in raw form -UX_STEP_NOCB(ux_display_raw_msg_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_raw_msg_step, bnnn_paging, { .title = "Raw message", .text = g_struct, }); // Step with title/text for transaction type -UX_STEP_NOCB(ux_display_tx_type_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_tx_type_step, bnnn_paging, { .title = "Transaction Type", .text = g_tx_type, }); // Step with title/text for function -UX_STEP_NOCB(ux_display_function_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_function_step, bnnn_paging, { .title = "Function", .text = g_function, }); // Step with title/text for coin type -UX_STEP_NOCB(ux_display_coin_type_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_coin_type_step, bnnn_paging, { .title = "Coin Type", .text = g_struct, }); // Step with title/text for amount -UX_STEP_NOCB(ux_display_amount_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_amount_step, bnnn_paging, { .title = "Amount", .text = g_amount, }); // Step with title/text for receiver -UX_STEP_NOCB(ux_display_receiver_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_receiver_step, bnnn_paging, { .title = "To", .text = g_address, }); // Step with title/text for receiver -UX_STEP_NOCB(ux_display_pool_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_pool_step, bnnn_paging, { .title = "Pool", .text = g_address, }); // Step with title/text for gas fee -UX_STEP_NOCB(ux_display_gas_fee_step, - bnnn_paging, +UX_STEP_NOCB(ux_display_gas_fee_step, bnnn_paging, { .title = "Gas Fee", .text = g_gas_fee, @@ -263,12 +239,9 @@ UX_STEP_NOCB(ux_display_gas_fee_step, // #4 screen : display gas fee // #5 screen : approve button // #6 screen : reject button -UX_FLOW(ux_display_blind_tx_default_flow, - &ux_display_blind_warn_step, - &ux_display_review_step, - &ux_display_tx_type_step, - &ux_display_gas_fee_step, - &ux_display_approve_step, +UX_FLOW(ux_display_blind_tx_default_flow, &ux_display_blind_warn_step, + &ux_display_review_step, &ux_display_tx_type_step, + &ux_display_gas_fee_step, &ux_display_approve_step, &ux_display_reject_step); // SEQUENCE to display message information: @@ -276,36 +249,39 @@ UX_FLOW(ux_display_blind_tx_default_flow, // #2 screen : display message // #3 screen : approve button // #4 screen : reject button -#define SEQUENCE_MESSAGE \ - &ux_display_review_msg_step, &ux_display_msg_step, &ux_display_approve_step, \ - &ux_display_reject_step +#define SEQUENCE_MESSAGE \ + &ux_display_review_msg_step, &ux_display_msg_step, \ + &ux_display_approve_step, &ux_display_reject_step UX_FLOW(ux_display_message_flow, SEQUENCE_MESSAGE); // preceding screen : warning icon + "Blind Signing" -UX_FLOW(ux_display_blind_message_flow, &ux_display_blind_warn_step, SEQUENCE_MESSAGE); +UX_FLOW(ux_display_blind_message_flow, &ux_display_blind_warn_step, + SEQUENCE_MESSAGE); // FLOW to display message information in short form: // #1 screen : eye icon + "Review Message" // #2 screen : display short message // #3 screen : approve button // #4 screen : reject button -#define SEQUENCE_SHORT_MESSAGE \ - &ux_display_review_msg_step, &ux_display_short_msg_step, &ux_display_approve_step, \ - &ux_display_reject_step +#define SEQUENCE_SHORT_MESSAGE \ + &ux_display_review_msg_step, &ux_display_short_msg_step, \ + &ux_display_approve_step, &ux_display_reject_step UX_FLOW(ux_display_short_message_flow, SEQUENCE_SHORT_MESSAGE); // preceding screen : warning icon + "Blind Signing" -UX_FLOW(ux_display_blind_short_message_flow, &ux_display_blind_warn_step, SEQUENCE_SHORT_MESSAGE); +UX_FLOW(ux_display_blind_short_message_flow, &ux_display_blind_warn_step, + SEQUENCE_SHORT_MESSAGE); // FLOW to display message information in raw form: // #1 screen : eye icon + "Review Message" // #2 screen : display raw message // #3 screen : approve button // #4 screen : reject button -#define SEQUENCE_RAW_MESSAGE \ - &ux_display_review_msg_step, &ux_display_raw_msg_step, &ux_display_approve_step, \ - &ux_display_reject_step +#define SEQUENCE_RAW_MESSAGE \ + &ux_display_review_msg_step, &ux_display_raw_msg_step, \ + &ux_display_approve_step, &ux_display_reject_step UX_FLOW(ux_display_raw_message_flow, SEQUENCE_RAW_MESSAGE); // preceding screen : warning icon + "Blind Signing" -UX_FLOW(ux_display_blind_raw_message_flow, &ux_display_blind_warn_step, SEQUENCE_RAW_MESSAGE); +UX_FLOW(ux_display_blind_raw_message_flow, &ux_display_blind_warn_step, + SEQUENCE_RAW_MESSAGE); // FLOW to display entry_function transaction information: // #1 screen : warning icon + "Blind Signing" @@ -315,14 +291,10 @@ UX_FLOW(ux_display_blind_raw_message_flow, &ux_display_blind_warn_step, SEQUENCE // #5 screen : display gas fee // #6 screen : approve button // #7 screen : reject button -UX_FLOW(ux_display_blind_tx_entry_function_flow, - &ux_display_blind_warn_step, - &ux_display_review_step, - &ux_display_tx_type_step, - &ux_display_function_step, - &ux_display_gas_fee_step, - &ux_display_approve_step, - &ux_display_reject_step); +UX_FLOW(ux_display_blind_tx_entry_function_flow, &ux_display_blind_warn_step, + &ux_display_review_step, &ux_display_tx_type_step, + &ux_display_function_step, &ux_display_gas_fee_step, + &ux_display_approve_step, &ux_display_reject_step); // FLOW to display aptos_account_transfer transaction information: // #1 screen : eye icon + "Review Transaction" @@ -333,14 +305,10 @@ UX_FLOW(ux_display_blind_tx_entry_function_flow, // #6 screen : display gas fee // #7 screen : approve button // #8 screen : reject button -UX_FLOW(ux_display_tx_aptos_account_transfer_flow, - &ux_display_review_step, - &ux_display_tx_type_step, - &ux_display_function_step, - &ux_display_receiver_step, - &ux_display_amount_step, - &ux_display_gas_fee_step, - &ux_display_approve_step, +UX_FLOW(ux_display_tx_aptos_account_transfer_flow, &ux_display_review_step, + &ux_display_tx_type_step, &ux_display_function_step, + &ux_display_receiver_step, &ux_display_amount_step, + &ux_display_gas_fee_step, &ux_display_approve_step, &ux_display_reject_step); // FLOW to display coin_transfer transaction information: @@ -352,14 +320,10 @@ UX_FLOW(ux_display_tx_aptos_account_transfer_flow, // #6 screen : display gas fee // #7 screen : approve button // #8 screen : reject button -UX_FLOW(ux_display_tx_listed_coin_transfer_flow, - &ux_display_review_step, - &ux_display_tx_type_step, - &ux_display_function_step, - &ux_display_amount_step, - &ux_display_receiver_step, - &ux_display_gas_fee_step, - &ux_display_approve_step, +UX_FLOW(ux_display_tx_listed_coin_transfer_flow, &ux_display_review_step, + &ux_display_tx_type_step, &ux_display_function_step, + &ux_display_amount_step, &ux_display_receiver_step, + &ux_display_gas_fee_step, &ux_display_approve_step, &ux_display_reject_step); // FLOW to display coin_transfer transaction information: @@ -372,16 +336,11 @@ UX_FLOW(ux_display_tx_listed_coin_transfer_flow, // #7 screen : display gas fee // #8 screen : approve button // #9 screen : reject button -UX_FLOW(ux_display_tx_unlisted_coin_transfer_flow, - &ux_display_review_step, - &ux_display_tx_type_step, - &ux_display_function_step, - &ux_display_coin_type_step, - &ux_display_amount_step, - &ux_display_receiver_step, - &ux_display_gas_fee_step, - &ux_display_approve_step, - &ux_display_reject_step); +UX_FLOW(ux_display_tx_unlisted_coin_transfer_flow, &ux_display_review_step, + &ux_display_tx_type_step, &ux_display_function_step, + &ux_display_coin_type_step, &ux_display_amount_step, + &ux_display_receiver_step, &ux_display_gas_fee_step, + &ux_display_approve_step, &ux_display_reject_step); // FLOW to display delegation pool transactions: // #1 screen : eye icon + "Review Transaction" @@ -392,14 +351,10 @@ UX_FLOW(ux_display_tx_unlisted_coin_transfer_flow, // #6 screen : display gas fee // #7 screen : approve button // #8 screen : reject button -UX_FLOW(ux_display_tx_delegation_flow, - &ux_display_review_step, - &ux_display_tx_type_step, - &ux_display_function_step, - &ux_display_amount_step, - &ux_display_pool_step, - &ux_display_gas_fee_step, - &ux_display_approve_step, +UX_FLOW(ux_display_tx_delegation_flow, &ux_display_review_step, + &ux_display_tx_type_step, &ux_display_function_step, + &ux_display_amount_step, &ux_display_pool_step, + &ux_display_gas_fee_step, &ux_display_approve_step, &ux_display_reject_step); int ui_display_transaction() { @@ -416,7 +371,7 @@ int ui_display_transaction() { int ui_display_message() { if (N_storage.settings.show_full_message) { - if (is_str_interrupted((const char *) G_context.tx_info.raw_tx, + if (is_str_interrupted((const char*)G_context.tx_info.raw_tx, G_context.tx_info.raw_tx_len)) { ui_flow_verified_display(ux_display_blind_message_flow); } else { @@ -425,10 +380,10 @@ int ui_display_message() { } else { memset(g_struct, 0, sizeof(g_struct)); bool short_enough = G_context.tx_info.raw_tx_len < sizeof(g_struct); - snprintf(g_struct, - sizeof(g_struct), + snprintf(g_struct, sizeof(g_struct), short_enough ? "%.*s" : "%.*s" DOTS, - short_enough ? G_context.tx_info.raw_tx_len : sizeof(g_struct) - sizeof(DOTS), + short_enough ? G_context.tx_info.raw_tx_len + : sizeof(g_struct) - sizeof(DOTS), G_context.tx_info.raw_tx); PRINTF("Message: %s\n", g_struct); @@ -448,15 +403,15 @@ int ui_display_message() { int ui_display_raw_message() { memset(g_struct, 0, sizeof(g_struct)); - const bool short_enough = sizeof(g_struct) >= 2 * G_context.tx_info.raw_tx_len + 1; + const bool short_enough = + sizeof(g_struct) >= 2 * G_context.tx_info.raw_tx_len + 1; if (short_enough) { - format_hex(G_context.tx_info.raw_tx, - G_context.tx_info.raw_tx_len, - g_struct, - sizeof(g_struct)); + format_hex(G_context.tx_info.raw_tx, G_context.tx_info.raw_tx_len, + g_struct, sizeof(g_struct)); } else { const size_t cropped_bytes_len = (sizeof(g_struct) - sizeof(DOTS)) / 2; - format_hex(G_context.tx_info.raw_tx, cropped_bytes_len, g_struct, sizeof(g_struct)); + format_hex(G_context.tx_info.raw_tx, cropped_bytes_len, g_struct, + sizeof(g_struct)); strncpy(g_struct + cropped_bytes_len * 2, DOTS, sizeof(DOTS)); } PRINTF("Message: %s\n", g_struct); @@ -519,7 +474,8 @@ int ui_display_tx_fungible_asset_transfer() { } #pragma GCC diagnostic ignored "-Wunused-parameter" -int ui_display_delegation_pool_transfer(entry_function_known_type_t function_type) { +int ui_display_delegation_pool_transfer( + entry_function_known_type_t function_type) { const int ret = ui_prepare_delegation_pool_transfer(); if (ret == UI_PREPARED) { ui_flow_display(ux_display_tx_delegation_flow); diff --git a/src/ui/bagl_menu.c b/src/ui/bagl_menu.c index 424b7f1..3bb9939 100644 --- a/src/ui/bagl_menu.c +++ b/src/ui/bagl_menu.c @@ -17,31 +17,30 @@ #ifdef HAVE_BAGL -#include "os.h" -#include "ux.h" -#include "glyphs.h" - #include "../globals.h" +#include "bagl_display.h" +#include "glyphs.h" #include "menu.h" +#include "os.h" #include "settings.h" -#include "bagl_display.h" +#include "ux.h" -UX_STEP_NOCB(ux_menu_ready_step, pnn, {&C_aptos_logo_16px, "Aptos", "is ready"}); -UX_STEP_CB(ux_menu_settings_step, pb, ui_menu_settings(), {&C_icon_coggle, "Settings"}); -UX_STEP_CB(ux_menu_about_step, pb, ui_menu_about(), {&C_icon_certificate, "About"}); -UX_STEP_VALID(ux_menu_exit_step, pb, os_sched_exit(-1), {&C_icon_dashboard_x, "Quit"}); +UX_STEP_NOCB(ux_menu_ready_step, pnn, + {&C_aptos_logo_16px, "Aptos", "is ready"}); +UX_STEP_CB(ux_menu_settings_step, pb, ui_menu_settings(), + {&C_icon_coggle, "Settings"}); +UX_STEP_CB(ux_menu_about_step, pb, ui_menu_about(), + {&C_icon_certificate, "About"}); +UX_STEP_VALID(ux_menu_exit_step, pb, os_sched_exit(-1), + {&C_icon_dashboard_x, "Quit"}); // FLOW for the main menu: // #1 screen: ready // #2 screen: settings // #3 screen: about submenu // #4 screen: quit -UX_FLOW(ux_menu_main_flow, - &ux_menu_ready_step, - &ux_menu_settings_step, - &ux_menu_about_step, - &ux_menu_exit_step, - FLOW_LOOP); +UX_FLOW(ux_menu_main_flow, &ux_menu_ready_step, &ux_menu_settings_step, + &ux_menu_about_step, &ux_menu_exit_step, FLOW_LOOP); void ui_menu_main() { if (G_ux.stack_count == 0) { @@ -59,14 +58,9 @@ UX_STEP_CB(ux_menu_back_step, pb, ui_menu_main(), {&C_icon_back, "Back"}); // #1 screen: app info // #2 screen: version of the app // #3 screen: back button to main menu -UX_FLOW(ux_menu_about_flow, - &ux_menu_info_step, - &ux_menu_version_step, - &ux_menu_back_step, - FLOW_LOOP); +UX_FLOW(ux_menu_about_flow, &ux_menu_info_step, &ux_menu_version_step, + &ux_menu_back_step, FLOW_LOOP); -void ui_menu_about() { - ui_flow_display(ux_menu_about_flow); -} +void ui_menu_about() { ui_flow_display(ux_menu_about_flow); } #endif diff --git a/src/ui/bagl_settings.c b/src/ui/bagl_settings.c index 987993e..6f673ea 100644 --- a/src/ui/bagl_settings.c +++ b/src/ui/bagl_settings.c @@ -17,11 +17,10 @@ #ifdef HAVE_BAGL +#include "../globals.h" +#include "menu.h" #include "os.h" - #include "settings.h" -#include "menu.h" -#include "../globals.h" static const char* settings_submenu_getter(unsigned int idx); @@ -40,20 +39,17 @@ static const char* binary_choice_getter(unsigned int idx) { static void show_full_message_selector(unsigned int idx) { if (idx == 0 || idx == 1) { - settings_show_full_message_change((uint8_t) idx); + settings_show_full_message_change((uint8_t)idx); } - ux_menulist_init_select(0, - settings_submenu_getter, - settings_submenu_selector, - MENU_SHOW_FULL_MSG); + ux_menulist_init_select(0, settings_submenu_getter, + settings_submenu_selector, MENU_SHOW_FULL_MSG); } static void allow_blind_signing_selector(unsigned int idx) { if (idx == 0 || idx == 1) { - settings_allow_blind_signing_change((uint8_t) idx); + settings_allow_blind_signing_change((uint8_t)idx); } - ux_menulist_init_select(0, - settings_submenu_getter, + ux_menulist_init_select(0, settings_submenu_getter, settings_submenu_selector, MENU_ALLOW_BLIND_SIGNING); } @@ -74,14 +70,12 @@ static const char* settings_submenu_getter(unsigned int idx) { static void settings_submenu_selector(unsigned int idx) { switch (idx) { case MENU_SHOW_FULL_MSG: - ux_menulist_init_select(0, - binary_choice_getter, + ux_menulist_init_select(0, binary_choice_getter, show_full_message_selector, N_storage.settings.show_full_message); break; case MENU_ALLOW_BLIND_SIGNING: - ux_menulist_init_select(0, - binary_choice_getter, + ux_menulist_init_select(0, binary_choice_getter, allow_blind_signing_selector, N_storage.settings.allow_blind_signing); break; diff --git a/src/ui/common_display.c b/src/ui/common_display.c index 899f48b..e014f02 100644 --- a/src/ui/common_display.c +++ b/src/ui/common_display.c @@ -18,23 +18,22 @@ #include // bool #include // memset -#include "os.h" -#include "ux.h" -#include "glyphs.h" -#include "io.h" -#include "bip32.h" -#include "format.h" - -#include "display.h" -#include "settings.h" -#include "constants.h" +#include "../address.h" +#include "../common/user_format.h" #include "../globals.h" #include "../sw.h" -#include "../address.h" -#include "action/validate.h" #include "../transaction/types.h" #include "../transaction/utils.h" -#include "../common/user_format.h" +#include "action/validate.h" +#include "bip32.h" +#include "constants.h" +#include "display.h" +#include "format.h" +#include "glyphs.h" +#include "io.h" +#include "os.h" +#include "settings.h" +#include "ux.h" char g_bip32_path[60]; char g_tx_type[60]; @@ -46,187 +45,265 @@ char g_amount[30]; int g_is_token_listed; #define MAX_COIN_TYPE_LEN 110 -#define MAX_TOKEN_LEN 30 -#define MAX_TICKER_LENG 16 +#define MAX_TOKEN_LEN 30 +#define MAX_TICKER_LENG 16 -// Mapping to facilitate identification of Tickers and Token Names via the Coin Type id +// Mapping to facilitate identification of Tickers and Token Names via the Coin +// Type id typedef struct token_info { const char ticker[MAX_TICKER_LENG]; + uint8_t decimals; const char coin_type[MAX_COIN_TYPE_LEN]; const char token[MAX_TOKEN_LEN]; } token_info_t; +// decimals mirror each token's on-chain metadata (the coin/fungible-asset +// `decimals`); keep in sync with the registry when the token list changes. static const token_info_t TOKEN_MAPPING[] = { {.ticker = "amAPT", + .decimals = 8, .token = "Amnis Aptos Coin", - .coin_type = "0x111ae3e5bc816a5e63c2da97d0aa3886519e0cd5e4b046659fa35796bd11542a::amapt_token:" + .coin_type = "0x111ae3e5bc816a5e63c2da97d0aa3886519e0cd5e4b046659fa35796bd" + "11542a::amapt_token:" ":AmnisApt"}, {.ticker = "APARTMENT", + .decimals = 8, .token = "Apartment", - .coin_type = "0x7b7bab2131de3e4f318b4abaa952f7c817b2c3df16c951caca809ac9ca9b650e::APARTMENT::" + .coin_type = "0x7b7bab2131de3e4f318b4abaa952f7c817b2c3df16c951caca809ac9ca" + "9b650e::APARTMENT::" "APARTMENT"}, {.ticker = "APE", + .decimals = 8, .token = "APETOS", - .coin_type = "0xada35ada7e43e2ee1c39633ffccec38b76ce702b4efc2e60b50f63fbe4f710d8::apetos_" + .coin_type = "0xada35ada7e43e2ee1c39633ffccec38b76ce702b4efc2e60b50f63fbe4" + "f710d8::apetos_" "token::ApetosCoin"}, - {.ticker = "APT", .token = "Aptos Coin", .coin_type = "0x1::aptos_coin::AptosCoin"}, + {.ticker = "APT", + .decimals = 8, + .token = "Aptos Coin", + .coin_type = "0x1::aptos_coin::AptosCoin"}, {.ticker = "FOMO", + .decimals = 6, .token = "APTOS FOMO", - .coin_type = "0xf891d2e004973430cc2bbbee69f3d0f4adb9c7ae03137b4579f7bb9979283ee6::APTOS_FOMO::" + .coin_type = "0xf891d2e004973430cc2bbbee69f3d0f4adb9c7ae03137b4579f7bb9979" + "283ee6::APTOS_FOMO::" "APTOS_FOMO"}, {.ticker = "ALT", + .decimals = 8, .token = "Aptos Launch Token", - .coin_type = - "0xd0b4efb4be7c3508d9a26a9b5405cf9f860d0b9e5fe2f498b90e68b8d2cedd3e::aptos_launch_token::" - "AptosLaunchToken"}, + .coin_type = "0xd0b4efb4be7c3508d9a26a9b5405cf9f860d0b9e5fe2f498b90e68b8d2" + "cedd3e::aptos_launch_token::" + "AptosLaunchToken"}, {.ticker = "BLT", + .decimals = 8, .token = "Blocto Token", - .coin_type = "0xfbab9fb68bd2103925317b6a540baa20087b1e7a7a4eb90badee04abb6b5a16f::blt::Blt"}, + .coin_type = "0xfbab9fb68bd2103925317b6a540baa20087b1e7a7a4eb90badee04abb6" + "b5a16f::blt::Blt"}, {.ticker = "MOVE", + .decimals = 8, .token = "BlueMove", - .coin_type = - "0x27fafcc4e39daac97556af8a803dbb52bcb03f0821898dc845ac54225b9793eb::move_coin::MoveCoin"}, + .coin_type = "0x27fafcc4e39daac97556af8a803dbb52bcb03f0821898dc845ac54225b" + "9793eb::move_coin::MoveCoin"}, {.ticker = "BUBBLES", + .decimals = 8, .token = "BUBBLES", - .coin_type = "0xd6a49762f6e4f7401ee79be6f5d4111e70db1408966ba1aa204e6e10c9d437ca::bubbles::" + .coin_type = "0xd6a49762f6e4f7401ee79be6f5d4111e70db1408966ba1aa204e6e10c9" + "d437ca::bubbles::" "BubblesCoin"}, {.ticker = "doodoo", + .decimals = 8, .token = "DooDoo", - .coin_type = - "0x73eb84966be67e4697fc5ae75173ca6c35089e802650f75422ab49a8729704ec::coin::DooDoo"}, + .coin_type = "0x73eb84966be67e4697fc5ae75173ca6c35089e802650f75422ab49a872" + "9704ec::coin::DooDoo"}, {.ticker = "dstAPT", + .decimals = 8, .token = "dstAPT", - .coin_type = "0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e1713f61b5::staked_coin:" + .coin_type = "0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e171" + "3f61b5::staked_coin:" ":StakedAptos"}, {.ticker = "whGARI", + .decimals = 8, .token = "Gari (Wormhole)", - .coin_type = "0x4def3d3dee27308886f0a3611dd161ce34f977a9a5de4e80b237225923492a2a::coin::T"}, + .coin_type = "0x4def3d3dee27308886f0a3611dd161ce34f977a9a5de4e80b237225923" + "492a2a::coin::T"}, {.ticker = "GUI", + .decimals = 6, .token = "Gui Inu", - .coin_type = "0xe4ccb6d39136469f376242c31b34d10515c8eaaa38092f804db8e08a8f53c5b2::assets_v1::" + .coin_type = "0xe4ccb6d39136469f376242c31b34d10515c8eaaa38092f804db8e08a8f" + "53c5b2::assets_v1::" "EchoCoin002"}, {.ticker = "HEART", + .decimals = 8, .token = "HEART", - .coin_type = - "0x7de3fea83cd5ca0e1def27c3f3803af619882db51f34abf30dd04ad12ee6af31::tapos::Heart"}, + .coin_type = "0x7de3fea83cd5ca0e1def27c3f3803af619882db51f34abf30dd04ad12e" + "e6af31::tapos::Heart"}, {.ticker = "LSD", + .decimals = 8, .token = "Liquidswap", - .coin_type = "0x53a30a6e5936c0a4c5140daed34de39d17ca7fcae08f947c02e979cef98a3719::coin::LSD"}, + .coin_type = "0x53a30a6e5936c0a4c5140daed34de39d17ca7fcae08f947c02e979cef9" + "8a3719::coin::LSD"}, {.ticker = "MOJO", + .decimals = 8, .token = "Mojito", - .coin_type = "0x881ac202b1f1e6ad4efcff7a1d0579411533f2502417a19211cfc49751ddb5f4::coin::MOJO"}, + .coin_type = "0x881ac202b1f1e6ad4efcff7a1d0579411533f2502417a19211cfc49751" + "ddb5f4::coin::MOJO"}, {.ticker = "MOOMOO", + .decimals = 6, .token = "MOO MOO", - .coin_type = - "0xc5fbbcc4637aeebb4e732767abee8a21f2b0776f73b73e16ce13e7d31d6700da::MOOMOO::MOOMOO"}, + .coin_type = "0xc5fbbcc4637aeebb4e732767abee8a21f2b0776f73b73e16ce13e7d31d" + "6700da::MOOMOO::MOOMOO"}, {.ticker = "MOD", + .decimals = 8, .token = "Move Dollar", - .coin_type = - "0x6f986d146e4a90b828d8c12c14b6f4e003fdff11a8eecceceb63744363eaac01::mod_coin::MOD"}, + .coin_type = "0x6f986d146e4a90b828d8c12c14b6f4e003fdff11a8eecceceb63744363" + "eaac01::mod_coin::MOD"}, {.ticker = "Cake", + .decimals = 8, .token = "PancakeSwap Token", - .coin_type = - "0x159df6b7689437016108a019fd5bef736bac692b6d4a1f10c941f6fbb9a74ca6::oft::CakeOFT"}, + .coin_type = "0x159df6b7689437016108a019fd5bef736bac692b6d4a1f10c941f6fbb9" + "a74ca6::oft::CakeOFT"}, {.ticker = "RETuRD", + .decimals = 8, .token = "Returd", - .coin_type = - "0xdf3d5eb83df80dfde8ceb1edaa24d8dbc46da6a89ae134a858338e1b86a29e38::coin::Returd"}, + .coin_type = "0xdf3d5eb83df80dfde8ceb1edaa24d8dbc46da6a89ae134a858338e1b86" + "a29e38::coin::Returd"}, {.ticker = "SHRIMP", + .decimals = 2, .token = "SHRIMP", - .coin_type = - "0x55987edfab9a57f69bac759674f139ae473b5e09a9283848c1f87faf6fc1e789::shrimp::ShrimpCoin"}, + .coin_type = "0x55987edfab9a57f69bac759674f139ae473b5e09a9283848c1f87faf6f" + "c1e789::shrimp::ShrimpCoin"}, {.ticker = "whSOL", + .decimals = 8, .token = "Solana (Wormhole)", - .coin_type = "0xdd89c0e695df0692205912fb69fc290418bed0dbe6e4573d744a6d5e6bab6c13::coin::T"}, + .coin_type = "0xdd89c0e695df0692205912fb69fc290418bed0dbe6e4573d744a6d5e6b" + "ab6c13::coin::T"}, {.ticker = "stAPT", + .decimals = 8, .token = "Staked Aptos Coin", - .coin_type = "0x111ae3e5bc816a5e63c2da97d0aa3886519e0cd5e4b046659fa35796bd11542a::stapt_token:" + .coin_type = "0x111ae3e5bc816a5e63c2da97d0aa3886519e0cd5e4b046659fa35796bd" + "11542a::stapt_token:" ":StakedApt"}, {.ticker = "sthAPT", + .decimals = 8, .token = "Staked Thala APT", - .coin_type = "0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6::staking::" + .coin_type = "0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e90" + "0731f6::staking::" "StakedThalaAPT"}, {.ticker = "ceUSDT", + .decimals = 6, .token = "Tether USD (Celer)", - .coin_type = "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_" + .coin_type = "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b9029" + "42929d::celer_coin_" "manager::UsdtCoin"}, {.ticker = "lzUSDT", + .decimals = 6, .token = "Tether USD (LayerZero)", - .coin_type = - "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDT"}, + .coin_type = "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a0" + "1b17fa::asset::USDT"}, {.ticker = "whUSDT", + .decimals = 6, .token = "Tether USD (Wormhole)", - .coin_type = "0xa2eda21a58856fda86451436513b867c97eecb4ba099da5775520e0f7492e852::coin::T"}, + .coin_type = "0xa2eda21a58856fda86451436513b867c97eecb4ba099da5775520e0f74" + "92e852::coin::T"}, {.ticker = "thAPT", + .decimals = 8, .token = "Thala APT", - .coin_type = - "0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6::staking::ThalaAPT"}, + .coin_type = "0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e90" + "0731f6::staking::ThalaAPT"}, {.ticker = "THL", + .decimals = 8, .token = "Thala Token", - .coin_type = - "0x7fd500c11216f0fe3095d0c4b8aa4d64a4e2e04f83758462f2b127255643615::thl_coin::THL"}, + .coin_type = "0x7fd500c11216f0fe3095d0c4b8aa4d64a4e2e04f83758462f2b1272556" + "43615::thl_coin::THL"}, {.ticker = "LOON", + .decimals = 6, .token = "The Loonies", - .coin_type = "0x268d4a7a2ad93274edf6116f9f20ad8455223a7ab5fc73154f687e7dbc3e3ec6::LOON::LOON"}, + .coin_type = "0x268d4a7a2ad93274edf6116f9f20ad8455223a7ab5fc73154f687e7dbc" + "3e3ec6::LOON::LOON"}, {.ticker = "TIN", + .decimals = 8, .token = "Token \"IN\"", - .coin_type = - "0xc32ba5d293577cbb1df390f35b2bc6369a593b736d0865fedec1a2b08565de8e::in_coin::InCoin"}, + .coin_type = "0xc32ba5d293577cbb1df390f35b2bc6369a593b736d0865fedec1a2b085" + "65de8e::in_coin::InCoin"}, {.ticker = "TOMA", + .decimals = 6, .token = "Tomarket", - .coin_type = - "0x9d0595765a31f8d56e1d2aafc4d6c76f283c67a074ef8812d8c31bd8252ac2c3::asset::TOMA"}, + .coin_type = "0x9d0595765a31f8d56e1d2aafc4d6c76f283c67a074ef8812d8c31bd825" + "2ac2c3::asset::TOMA"}, {.ticker = "tAPT", + .decimals = 8, .token = "Tortuga Staked APT", - .coin_type = - "0x84d7aeef42d38a5ffc3ccef853e1b82e4958659d16a7de736a29c55fbbeb0114::staked_aptos_coin::" - "StakedAptosCoin"}, + .coin_type = "0x84d7aeef42d38a5ffc3ccef853e1b82e4958659d16a7de736a29c55fbb" + "eb0114::staked_aptos_coin::" + "StakedAptosCoin"}, {.ticker = "UPTOS", + .decimals = 8, .token = "UPTOS", - .coin_type = - "0x4fbed3f8a3fd8a11081c8b6392152a8b0cb14d70d0414586f0c9b858fcd2d6a7::UPTOS::UPTOS"}, + .coin_type = "0x4fbed3f8a3fd8a11081c8b6392152a8b0cb14d70d0414586f0c9b858fc" + "d2d6a7::UPTOS::UPTOS"}, {.ticker = "lzUSDC", + .decimals = 6, .token = "USD Coin (LayerZero)", - .coin_type = - "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC"}, + .coin_type = "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a0" + "1b17fa::asset::USDC"}, {.ticker = "whUSDC", + .decimals = 6, .token = "USD Coin (Wormhole)", - .coin_type = "0x5e156f1207d0ebfa19a9eeff00d62a282278fb8719f4fab3a586a0a2c0fffbea::coin::T"}, + .coin_type = "0x5e156f1207d0ebfa19a9eeff00d62a282278fb8719f4fab3a586a0a2c0" + "fffbea::coin::T"}, {.ticker = "ceWBNB", + .decimals = 8, .token = "Wrapped BNB (Celer)", - .coin_type = "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_" + .coin_type = "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b9029" + "42929d::celer_coin_" "manager::BnbCoin"}, {.ticker = "lzWETH", + .decimals = 6, .token = "Wrapped Ether (LayerZero)", - .coin_type = - "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::WETH"}, + .coin_type = "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a0" + "1b17fa::asset::WETH"}, {.ticker = "whWETH", + .decimals = 8, .token = "Wrapped Ether (Wormhole)", - .coin_type = "0xcc8a89c8dce9693d354449f1f73e60e14e347417854f029db5bc8e7454008abb::coin::T"}, + .coin_type = "0xcc8a89c8dce9693d354449f1f73e60e14e347417854f029db5bc8e7454" + "008abb::coin::T"}, {.ticker = "ANI", + .decimals = 8, .token = "AnimeSwap Coin", - .coin_type = - "0x16fe2df00ea7dde4a63409201f7f4e536bde7bb7335526a35d05111e68aa322c::AnimeCoin::ANI"}, + .coin_type = "0x16fe2df00ea7dde4a63409201f7f4e536bde7bb7335526a35d05111e68" + "aa322c::AnimeCoin::ANI"}, {.ticker = "AMA", + .decimals = 8, .token = "Amaterasu", - .coin_type = "0xd0ab8c2f76cd640455db56ca758a9766a966c88f77920347aac1719edab1df5e"}, + .coin_type = + "0xd0ab8c2f76cd640455db56ca758a9766a966c88f77920347aac1719edab1df5e"}, {.ticker = "CELL", + .decimals = 8, .token = "CELLANA", - .coin_type = "0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12"}, + .coin_type = + "0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12"}, {.ticker = "MKL", + .decimals = 6, .token = "MKL", - .coin_type = "0x878370592f9129e14b76558689a4b570ad22678111df775befbfcbc9fb3d90ab"}, + .coin_type = + "0x878370592f9129e14b76558689a4b570ad22678111df775befbfcbc9fb3d90ab"}, {.ticker = "USDT", + .decimals = 6, .token = "Tether USD", - .coin_type = "0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b"}, + .coin_type = + "0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b"}, {.ticker = "TruAPT", + .decimals = 8, .token = "TruAPT coin", - .coin_type = "0xaef6a8c3182e076db72d64324617114cacf9a52f28325edc10b483f7f05da0e7"}, + .coin_type = + "0xaef6a8c3182e076db72d64324617114cacf9a52f28325edc10b483f7f05da0e7"}, {.ticker = "USDC", + .decimals = 6, .token = "USDC", - .coin_type = "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"}}; + .coin_type = + "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"}}; -static size_t count_leading_zeros(const uint8_t *src, size_t len) { +static size_t count_leading_zeros(const uint8_t* src, size_t len) { for (size_t i = 0; i < len; i++) { if (src[i] != 0) { return i; @@ -241,19 +318,19 @@ int ui_prepare_address() { } memset(g_bip32_path, 0, sizeof(g_bip32_path)); - if (!bip32_path_format(G_context.bip32_path, - G_context.bip32_path_len, - g_bip32_path, - sizeof(g_bip32_path))) { + if (!bip32_path_format(G_context.bip32_path, G_context.bip32_path_len, + g_bip32_path, sizeof(g_bip32_path))) { return io_send_sw(SW_DISPLAY_BIP32_PATH_FAIL); } memset(g_address, 0, sizeof(g_address)); uint8_t address[ADDRESS_LEN] = {0}; - if (!address_from_pubkey(G_context.pk_info.raw_public_key, address, sizeof(address))) { + if (!address_from_pubkey(G_context.pk_info.raw_public_key, address, + sizeof(address))) { return io_send_sw(SW_DISPLAY_ADDRESS_FAIL); } - if (0 > format_prefixed_hex(address, sizeof(address), g_address, sizeof(g_address))) { + if (0 > format_prefixed_hex(address, sizeof(address), g_address, + sizeof(g_address))) { return io_send_sw(SW_DISPLAY_ADDRESS_FAIL); } @@ -261,25 +338,28 @@ int ui_prepare_address() { } int ui_prepare_transaction() { - if (G_context.req_type != CONFIRM_TRANSACTION || G_context.state != STATE_PARSED) { + if (G_context.req_type != CONFIRM_TRANSACTION || + G_context.state != STATE_PARSED) { G_context.state = STATE_NONE; return io_send_sw(SW_BAD_STATE); } - transaction_t *transaction = &G_context.tx_info.transaction; + transaction_t* transaction = &G_context.tx_info.transaction; if (transaction->tx_variant == TX_MESSAGE) { return ui_display_message(); } else if (transaction->tx_variant == TX_RAW_MESSAGE) { return ui_display_raw_message(); } else if (transaction->tx_variant != TX_UNDEFINED) { - uint64_t gas_fee_value = transaction->gas_unit_price * transaction->max_gas_amount; + uint64_t gas_fee_value = + transaction->gas_unit_price * transaction->max_gas_amount; memset(g_gas_fee, 0, sizeof(g_gas_fee)); char gas_fee[30] = {0}; if (!format_fpu64(gas_fee, sizeof(gas_fee), gas_fee_value, 8)) { return io_send_sw(SW_DISPLAY_GAS_FEE_FAIL); } - snprintf(g_gas_fee, sizeof(g_gas_fee), "APT %.*s", sizeof(gas_fee), gas_fee); + snprintf(g_gas_fee, sizeof(g_gas_fee), "APT %.*s", sizeof(gas_fee), + gas_fee); PRINTF("Gas Fee: %s\n", g_gas_fee); if (transaction->tx_variant == TX_RAW) { @@ -288,29 +368,24 @@ int ui_prepare_transaction() { return ui_display_entry_function(); case PAYLOAD_SCRIPT: memset(g_tx_type, 0, sizeof(g_tx_type)); - snprintf(g_tx_type, - sizeof(g_tx_type), - "%s [payload = SCRIPT]", - RAW_TRANSACTION_SALT); + snprintf(g_tx_type, sizeof(g_tx_type), + "%s [payload = SCRIPT]", RAW_TRANSACTION_SALT); break; case PAYLOAD_MULTISIG: memset(g_tx_type, 0, sizeof(g_tx_type)); - snprintf(g_tx_type, - sizeof(g_tx_type), - "%s [payload = MULTISIG]", - RAW_TRANSACTION_SALT); + snprintf(g_tx_type, sizeof(g_tx_type), + "%s [payload = MULTISIG]", RAW_TRANSACTION_SALT); break; default: memset(g_tx_type, 0, sizeof(g_tx_type)); - snprintf(g_tx_type, - sizeof(g_tx_type), - "%s [payload = UNKNOWN]", - RAW_TRANSACTION_SALT); + snprintf(g_tx_type, sizeof(g_tx_type), + "%s [payload = UNKNOWN]", RAW_TRANSACTION_SALT); break; } } else if (transaction->tx_variant == TX_RAW_WITH_DATA) { memset(g_tx_type, 0, sizeof(g_tx_type)); - snprintf(g_tx_type, sizeof(g_tx_type), RAW_TRANSACTION_WITH_DATA_SALT); + snprintf(g_tx_type, sizeof(g_tx_type), + RAW_TRANSACTION_WITH_DATA_SALT); } } else { memset(g_tx_type, 0, sizeof(g_tx_type)); @@ -320,17 +395,21 @@ int ui_prepare_transaction() { return UI_PREPARED; } -static int is_coin_type_aptos(type_tag_struct_t *coin_type) { - return (memcmp(coin_type->name.bytes, "AptosCoin", coin_type->name.len) == 0 && - memcmp(coin_type->module_name.bytes, "aptos_coin", coin_type->module_name.len) == 0); +static int is_coin_type_aptos(type_tag_struct_t* coin_type) { + return (memcmp(coin_type->name.bytes, "AptosCoin", coin_type->name.len) == + 0 && + memcmp(coin_type->module_name.bytes, "aptos_coin", + coin_type->module_name.len) == 0); } int ui_prepare_entry_function() { - entry_function_payload_t *function = &G_context.tx_info.transaction.payload.entry_function; + entry_function_payload_t* function = + &G_context.tx_info.transaction.payload.entry_function; char function_module_id_address_hex[67] = {0}; // Be sure to display at least 1 byte, even if it is zero - size_t leading_zeros = count_leading_zeros(function->module_id.address, ADDRESS_LEN - 1); + size_t leading_zeros = + count_leading_zeros(function->module_id.address, ADDRESS_LEN - 1); if (0 > format_prefixed_hex(function->module_id.address + leading_zeros, ADDRESS_LEN - leading_zeros, function_module_id_address_hex, @@ -338,13 +417,9 @@ int ui_prepare_entry_function() { return io_send_sw(SW_DISPLAY_ADDRESS_FAIL); } memset(g_function, 0, sizeof(g_function)); - snprintf(g_function, - sizeof(g_function), - "%s::%.*s::%.*s", - function_module_id_address_hex, - function->module_id.name.len, - function->module_id.name.bytes, - function->function_name.len, + snprintf(g_function, sizeof(g_function), "%s::%.*s::%.*s", + function_module_id_address_hex, function->module_id.name.len, + function->module_id.name.bytes, function->function_name.len, function->function_name.bytes); PRINTF("Function: %s\n", g_function); @@ -372,16 +447,18 @@ int ui_prepare_entry_function() { } int ui_prepare_tx_aptos_account_transfer() { - args_aptos_account_transfer_t *transfer = + args_aptos_account_transfer_t* transfer = &G_context.tx_info.transaction.payload.entry_function.args.transfer; - // For well-known functions, display the transaction type in human-readable format + // For well-known functions, display the transaction type in human-readable + // format memset(g_tx_type, 0, sizeof(g_tx_type)); snprintf(g_tx_type, sizeof(g_tx_type), "APT transfer"); PRINTF("Tx Type: %s\n", g_tx_type); memset(g_address, 0, sizeof(g_address)); - if (0 > format_prefixed_hex(transfer->receiver, ADDRESS_LEN, g_address, sizeof(g_address))) { + if (0 > format_prefixed_hex(transfer->receiver, ADDRESS_LEN, g_address, + sizeof(g_address))) { return io_send_sw(SW_DISPLAY_ADDRESS_FAIL); } PRINTF("Receiver: %s\n", g_address); @@ -398,14 +475,16 @@ int ui_prepare_tx_aptos_account_transfer() { } /** - * @brief Get token info by coin type, to display human-readable token info (ticker, token name) + * @brief Get token info by coin type, to display human-readable token info + * (ticker, token name) * * @param[in] coin_type Coin type * * @return Token info */ -static const token_info_t *get_token_info(const char *coin_type) { - for (size_t i = 0; i < sizeof(TOKEN_MAPPING) / sizeof(TOKEN_MAPPING[0]); i++) { +static const token_info_t* get_token_info(const char* coin_type) { + for (size_t i = 0; i < sizeof(TOKEN_MAPPING) / sizeof(TOKEN_MAPPING[0]); + i++) { if (_strcasecmp(coin_type, TOKEN_MAPPING[i].coin_type) == 0) { return &TOKEN_MAPPING[i]; } @@ -414,17 +493,19 @@ static const token_info_t *get_token_info(const char *coin_type) { } int ui_prepare_tx_coin_transfer() { - args_coin_transfer_t *transfer = - &G_context.tx_info.transaction.payload.entry_function.args.coin_transfer; + args_coin_transfer_t* transfer = &G_context.tx_info.transaction.payload + .entry_function.args.coin_transfer; char transfer_ty_coin_address_hex[67] = {0}; - // For well-known functions, display the transaction type in human-readable format + // For well-known functions, display the transaction type in human-readable + // format memset(g_tx_type, 0, sizeof(g_tx_type)); snprintf(g_tx_type, sizeof(g_tx_type), "Coin transfer"); PRINTF("Tx Type: %s\n", g_tx_type); // Be sure to display at least 1 byte, even if it is zero - size_t leading_zeros = count_leading_zeros(transfer->ty_coin.address, ADDRESS_LEN - 1); + size_t leading_zeros = + count_leading_zeros(transfer->ty_coin.address, ADDRESS_LEN - 1); if (0 > format_prefixed_hex(transfer->ty_coin.address + leading_zeros, ADDRESS_LEN - leading_zeros, transfer_ty_coin_address_hex, @@ -433,36 +514,36 @@ int ui_prepare_tx_coin_transfer() { } memset(g_struct, 0, sizeof(g_struct)); - // If the coin type is AptosCoin we ought specify snprintf, as the coin address - // can have an arbitrary number of leading zeros + // If the coin type is AptosCoin we ought specify snprintf, as the coin + // address can have an arbitrary number of leading zeros if (is_coin_type_aptos(&transfer->ty_coin)) { snprintf(g_struct, sizeof(g_struct), "0x1::aptos_coin::AptosCoin"); } else { - snprintf(g_struct, - sizeof(g_struct), - "%s::%.*s::%.*s", + snprintf(g_struct, sizeof(g_struct), "%s::%.*s::%.*s", transfer_ty_coin_address_hex, transfer->ty_coin.module_name.len, transfer->ty_coin.module_name.bytes, - transfer->ty_coin.name.len, - transfer->ty_coin.name.bytes); + transfer->ty_coin.name.len, transfer->ty_coin.name.bytes); } PRINTF("Coin Type: %s\n", g_struct); memset(g_address, 0, sizeof(g_address)); - if (0 > format_prefixed_hex(transfer->receiver, ADDRESS_LEN, g_address, sizeof(g_address))) { + if (0 > format_prefixed_hex(transfer->receiver, ADDRESS_LEN, g_address, + sizeof(g_address))) { return io_send_sw(SW_DISPLAY_ADDRESS_FAIL); } PRINTF("Receiver: %s\n", g_address); memset(g_amount, 0, sizeof(g_amount)); + const token_info_t* info = get_token_info(g_struct); char amount[30] = {0}; - if (!format_fpu64(amount, sizeof(amount), transfer->amount, 8)) { + if (!format_fpu64(amount, sizeof(amount), transfer->amount, + info ? info->decimals : 8)) { return io_send_sw(SW_DISPLAY_AMOUNT_FAIL); } - const token_info_t *info = get_token_info(g_struct); if (info) { - snprintf(g_amount, sizeof(g_amount), "%s %.*s", info->ticker, sizeof(amount), amount); + snprintf(g_amount, sizeof(g_amount), "%s %.*s", info->ticker, + sizeof(amount), amount); g_is_token_listed = 1; } else { snprintf(g_amount, sizeof(g_amount), "%.*s", sizeof(amount), amount); @@ -474,21 +555,23 @@ int ui_prepare_tx_coin_transfer() { } int ui_prepare_tx_fungible_asset_transfer() { - args_fungible_asset_transfer_t *transfer = + args_fungible_asset_transfer_t* transfer = &G_context.tx_info.transaction.payload.entry_function.args.fa_transfer; char transfer_fa_coin_address_hex[67] = {0}; - // For well-known functions, display the transaction type in human-readable format + // For well-known functions, display the transaction type in human-readable + // format memset(g_tx_type, 0, sizeof(g_tx_type)); snprintf(g_tx_type, sizeof(g_tx_type), "Fungible asset transfer"); PRINTF("Tx Type: %s\n", g_tx_type); // Be sure to display at least 1 byte, even if it is zero - size_t leading_zeros = count_leading_zeros(transfer->fungible_asset.address, ADDRESS_LEN - 1); - if (0 > format_prefixed_hex(transfer->fungible_asset.address + leading_zeros, - ADDRESS_LEN - leading_zeros, - transfer_fa_coin_address_hex, - sizeof(transfer_fa_coin_address_hex))) { + size_t leading_zeros = + count_leading_zeros(transfer->fungible_asset.address, ADDRESS_LEN - 1); + if (0 > format_prefixed_hex( + transfer->fungible_asset.address + leading_zeros, + ADDRESS_LEN - leading_zeros, transfer_fa_coin_address_hex, + sizeof(transfer_fa_coin_address_hex))) { return io_send_sw(SW_DISPLAY_ADDRESS_FAIL); } memset(g_struct, 0, sizeof(g_struct)); @@ -496,18 +579,21 @@ int ui_prepare_tx_fungible_asset_transfer() { PRINTF("Coin Type: %s\n", g_struct); memset(g_address, 0, sizeof(g_address)); - if (0 > format_prefixed_hex(transfer->receiver, ADDRESS_LEN, g_address, sizeof(g_address))) { + if (0 > format_prefixed_hex(transfer->receiver, ADDRESS_LEN, g_address, + sizeof(g_address))) { return io_send_sw(SW_DISPLAY_ADDRESS_FAIL); } PRINTF("Receiver: %s\n", g_address); + const token_info_t* info = get_token_info(g_struct); char amount[30] = {0}; - if (!format_fpu64(amount, sizeof(amount), transfer->amount, 8)) { + if (!format_fpu64(amount, sizeof(amount), transfer->amount, + info ? info->decimals : 8)) { return io_send_sw(SW_DISPLAY_AMOUNT_FAIL); } - const token_info_t *info = get_token_info(g_struct); if (info) { - snprintf(g_amount, sizeof(g_amount), "%s %.*s", info->ticker, sizeof(amount), amount); + snprintf(g_amount, sizeof(g_amount), "%s %.*s", info->ticker, + sizeof(amount), amount); g_is_token_listed = 1; } else { snprintf(g_amount, sizeof(g_amount), "%.*s", sizeof(amount), amount); @@ -519,16 +605,18 @@ int ui_prepare_tx_fungible_asset_transfer() { } int ui_prepare_delegation_pool_transfer() { - args_delegation_pool_transfer_t *delegation = + args_delegation_pool_transfer_t* delegation = &G_context.tx_info.transaction.payload.entry_function.args.delegation; - // For well-known functions, display the transaction type in human-readable format + // For well-known functions, display the transaction type in human-readable + // format memset(g_tx_type, 0, sizeof(g_tx_type)); snprintf(g_tx_type, sizeof(g_tx_type), "Delegation pool transfer"); PRINTF("Tx Type: %s\n", g_tx_type); memset(g_address, 0, sizeof(g_address)); - if (0 > format_prefixed_hex(delegation->pool, ADDRESS_LEN, g_address, sizeof(g_address))) { + if (0 > format_prefixed_hex(delegation->pool, ADDRESS_LEN, g_address, + sizeof(g_address))) { return io_send_sw(SW_DISPLAY_ADDRESS_FAIL); } PRINTF("Pool: %s\n", g_address); diff --git a/src/ui/common_settings.c b/src/ui/common_settings.c index 999b93a..44b4d8a 100644 --- a/src/ui/common_settings.c +++ b/src/ui/common_settings.c @@ -15,15 +15,16 @@ * limitations under the License. *****************************************************************************/ +#include "../globals.h" #include "os.h" - #include "settings.h" -#include "../globals.h" void settings_show_full_message_change(uint8_t value) { - nvm_write((void *) &N_storage.settings.show_full_message, &value, sizeof(value)); + nvm_write((void*)&N_storage.settings.show_full_message, &value, + sizeof(value)); } void settings_allow_blind_signing_change(uint8_t value) { - nvm_write((void *) &N_storage.settings.allow_blind_signing, &value, sizeof(value)); + nvm_write((void*)&N_storage.settings.allow_blind_signing, &value, + sizeof(value)); } diff --git a/src/ui/nbgl_display.c b/src/ui/nbgl_display.c index c5f87a6..4a94d51 100644 --- a/src/ui/nbgl_display.c +++ b/src/ui/nbgl_display.c @@ -17,19 +17,19 @@ #ifdef HAVE_NBGL +#include "nbgl_display.h" + #include // bool #include // memset -#include "os.h" +#include "../globals.h" +#include "constants.h" +#include "display.h" #include "glyphs.h" +#include "menu.h" #include "nbgl_use_case.h" - -#include "nbgl_display.h" -#include "display.h" +#include "os.h" #include "settings.h" -#include "menu.h" -#include "constants.h" -#include "../globals.h" static use_case_review_ctx_t blind_sign_ctx; @@ -37,14 +37,11 @@ nbgl_contentTagValue_t pairs[6]; nbgl_contentTagValueList_t pair_list; static void blind_sign_info() { - nbgl_useCaseReviewBlindSigning(blind_sign_ctx.operation_type, - blind_sign_ctx.tag_value_list, - blind_sign_ctx.icon, - blind_sign_ctx.review_title, - blind_sign_ctx.review_sub_title, - blind_sign_ctx.finish_title, - blind_sign_ctx.tip_box, - blind_sign_ctx.choice_callback); + nbgl_useCaseReviewBlindSigning( + blind_sign_ctx.operation_type, blind_sign_ctx.tag_value_list, + blind_sign_ctx.icon, blind_sign_ctx.review_title, + blind_sign_ctx.review_sub_title, blind_sign_ctx.finish_title, + blind_sign_ctx.tip_box, blind_sign_ctx.choice_callback); } static void blind_sign_choice(bool enable) { @@ -57,12 +54,12 @@ static void blind_sign_choice(bool enable) { } void nbgl_useCaseReviewVerify(nbgl_operationType_t operation_type, - const nbgl_contentTagValueList_t *tag_value_list, - const nbgl_icon_details_t *icon, - const char *review_title, - const char *review_sub_title, - const char *finish_title, - const nbgl_tipBox_t *tip_box, + const nbgl_contentTagValueList_t* tag_value_list, + const nbgl_icon_details_t* icon, + const char* review_title, + const char* review_sub_title, + const char* finish_title, + const nbgl_tipBox_t* tip_box, nbgl_choiceCallback_t choice_callback) { blind_sign_ctx.operation_type = operation_type; blind_sign_ctx.tag_value_list = tag_value_list; @@ -78,9 +75,7 @@ void nbgl_useCaseReviewVerify(nbgl_operationType_t operation_type, } else { nbgl_useCaseChoice(&LARGE_WARNING_ICON, "Enable blind signing to authorize this operation?", - NULL, - "Enable blind signing", - "Reject operation", + NULL, "Enable blind signing", "Reject operation", blind_sign_choice); } } diff --git a/src/ui/nbgl_display_address.c b/src/ui/nbgl_display_address.c index a365361..1f60c7c 100644 --- a/src/ui/nbgl_display_address.c +++ b/src/ui/nbgl_display_address.c @@ -20,23 +20,22 @@ #include // bool #include // memset -#include "os.h" -#include "glyphs.h" -#include "nbgl_use_case.h" - -#include "nbgl_display.h" -#include "display.h" -#include "menu.h" -#include "constants.h" -#include "../globals.h" #include "../address.h" +#include "../globals.h" #include "action/validate.h" +#include "constants.h" +#include "display.h" +#include "glyphs.h" +#include "menu.h" +#include "nbgl_display.h" +#include "nbgl_use_case.h" +#include "os.h" static void confirm_address(bool choice) { validate_pubkey(choice); - nbgl_useCaseStatus(choice ? "Address verified" : "Address verification canceled", - choice, - ui_menu_main); + nbgl_useCaseStatus( + choice ? "Address verified" : "Address verification canceled", choice, + ui_menu_main); } int ui_display_address() { @@ -49,11 +48,8 @@ int ui_display_address() { pair_list.nbPairs = 1; pair_list.pairs = pairs; - nbgl_useCaseAddressReview(g_address, - &pair_list, - &ICON_APP_HOME, - "Verify Aptos address", - NULL, + nbgl_useCaseAddressReview(g_address, &pair_list, &ICON_APP_HOME, + "Verify Aptos address", NULL, confirm_address); return 0; } diff --git a/src/ui/nbgl_display_message.c b/src/ui/nbgl_display_message.c old mode 100755 new mode 100644 index 9184d66..efc08ca --- a/src/ui/nbgl_display_message.c +++ b/src/ui/nbgl_display_message.c @@ -20,18 +20,17 @@ #include // bool #include // memset -#include "os.h" +#include "../common/user_format.h" +#include "../globals.h" +#include "action/validate.h" +#include "constants.h" +#include "display.h" #include "format.h" #include "glyphs.h" -#include "nbgl_use_case.h" - -#include "nbgl_display.h" -#include "display.h" #include "menu.h" -#include "constants.h" -#include "../globals.h" -#include "action/validate.h" -#include "../common/user_format.h" +#include "nbgl_display.h" +#include "nbgl_use_case.h" +#include "os.h" #define DOTS "[...]" @@ -46,28 +45,20 @@ static void review_choice(bool confirm) { int ui_display_message() { pairs[0].item = "Message"; - pairs[0].value = (const char *) G_context.tx_info.raw_tx; + pairs[0].value = (const char*)G_context.tx_info.raw_tx; pair_list.nbMaxLinesForValue = 0; pair_list.nbPairs = 1; pair_list.pairs = pairs; - if (is_str_interrupted((const char *) G_context.tx_info.raw_tx, G_context.tx_info.raw_tx_len)) { - nbgl_useCaseReviewVerify(TYPE_MESSAGE, - &pair_list, - &LARGE_REVIEW_ICON, - "Review message", - NULL, - "Sign message?", - NULL, + if (is_str_interrupted((const char*)G_context.tx_info.raw_tx, + G_context.tx_info.raw_tx_len)) { + nbgl_useCaseReviewVerify(TYPE_MESSAGE, &pair_list, &LARGE_REVIEW_ICON, + "Review message", NULL, "Sign message?", NULL, review_choice); } else { - nbgl_useCaseReview(TYPE_MESSAGE, - &pair_list, - &LARGE_REVIEW_ICON, - "Review message", - NULL, - "Sign message?", + nbgl_useCaseReview(TYPE_MESSAGE, &pair_list, &LARGE_REVIEW_ICON, + "Review message", NULL, "Sign message?", review_choice); } @@ -76,15 +67,15 @@ int ui_display_message() { int ui_display_raw_message() { memset(g_struct, 0, sizeof(g_struct)); - const bool short_enough = sizeof(g_struct) >= 2 * G_context.tx_info.raw_tx_len + 1; + const bool short_enough = + sizeof(g_struct) >= 2 * G_context.tx_info.raw_tx_len + 1; if (short_enough) { - format_hex(G_context.tx_info.raw_tx, - G_context.tx_info.raw_tx_len, - g_struct, - sizeof(g_struct)); + format_hex(G_context.tx_info.raw_tx, G_context.tx_info.raw_tx_len, + g_struct, sizeof(g_struct)); } else { const size_t cropped_bytes_len = (sizeof(g_struct) - sizeof(DOTS)) / 2; - format_hex(G_context.tx_info.raw_tx, cropped_bytes_len, g_struct, sizeof(g_struct)); + format_hex(G_context.tx_info.raw_tx, cropped_bytes_len, g_struct, + sizeof(g_struct)); strncpy(g_struct + cropped_bytes_len * 2, DOTS, sizeof(DOTS)); } @@ -96,21 +87,12 @@ int ui_display_raw_message() { pair_list.pairs = pairs; if (!short_enough) { - nbgl_useCaseReviewVerify(TYPE_MESSAGE, - &pair_list, - &LARGE_REVIEW_ICON, - "Review message", - NULL, - "Sign message?", - NULL, + nbgl_useCaseReviewVerify(TYPE_MESSAGE, &pair_list, &LARGE_REVIEW_ICON, + "Review message", NULL, "Sign message?", NULL, review_choice); } else { - nbgl_useCaseReview(TYPE_MESSAGE, - &pair_list, - &LARGE_REVIEW_ICON, - "Review message", - NULL, - "Sign message?", + nbgl_useCaseReview(TYPE_MESSAGE, &pair_list, &LARGE_REVIEW_ICON, + "Review message", NULL, "Sign message?", review_choice); } diff --git a/src/ui/nbgl_display_transaction.c b/src/ui/nbgl_display_transaction.c old mode 100755 new mode 100644 index 3cb2164..4812b37 --- a/src/ui/nbgl_display_transaction.c +++ b/src/ui/nbgl_display_transaction.c @@ -20,16 +20,15 @@ #include // bool #include // memset -#include "os.h" -#include "glyphs.h" -#include "nbgl_use_case.h" - -#include "nbgl_display.h" -#include "display.h" -#include "menu.h" -#include "constants.h" #include "../globals.h" #include "action/validate.h" +#include "constants.h" +#include "display.h" +#include "glyphs.h" +#include "menu.h" +#include "nbgl_display.h" +#include "nbgl_use_case.h" +#include "os.h" static void review_choice(bool confirm) { if (confirm) { @@ -53,14 +52,9 @@ int ui_display_transaction() { pair_list.nbPairs = 2; pair_list.pairs = pairs; - nbgl_useCaseReviewVerify(TYPE_TRANSACTION, - &pair_list, - &ICON_APP_HOME, - "Review transaction", - NULL, - "Sign transaction?", - NULL, - review_choice); + nbgl_useCaseReviewVerify(TYPE_TRANSACTION, &pair_list, &ICON_APP_HOME, + "Review transaction", NULL, + "Sign transaction?", NULL, review_choice); return 0; } @@ -81,14 +75,9 @@ int ui_display_entry_function() { pair_list.nbPairs = 3; pair_list.pairs = pairs; - nbgl_useCaseReviewVerify(TYPE_TRANSACTION, - &pair_list, - &ICON_APP_HOME, - "Review transaction", - NULL, - "Sign transaction?", - NULL, - review_choice); + nbgl_useCaseReviewVerify(TYPE_TRANSACTION, &pair_list, &ICON_APP_HOME, + "Review transaction", NULL, + "Sign transaction?", NULL, review_choice); return 0; } @@ -113,13 +102,9 @@ int ui_display_tx_aptos_account_transfer() { pair_list.nbPairs = 5; pair_list.pairs = pairs; - nbgl_useCaseReview(TYPE_TRANSACTION, - &pair_list, - &ICON_APP_HOME, - "Review transaction to send Aptos", - NULL, - "Sign transaction?", - review_choice); + nbgl_useCaseReview(TYPE_TRANSACTION, &pair_list, &ICON_APP_HOME, + "Review transaction to send Aptos", NULL, + "Sign transaction?", review_choice); return 0; } @@ -142,13 +127,9 @@ void ui_listed_coin_transfer_flow_display() { pair_list.nbPairs = 5; pair_list.pairs = pairs; - nbgl_useCaseReview(TYPE_TRANSACTION, - &pair_list, - &ICON_APP_HOME, - "Review transaction to transfer coins", - NULL, - "Sign transaction to transfer coins?", - review_choice); + nbgl_useCaseReview(TYPE_TRANSACTION, &pair_list, &ICON_APP_HOME, + "Review transaction to transfer coins", NULL, + "Sign transaction to transfer coins?", review_choice); } void ui_unlisted_coin_transfer_flow_display() { @@ -169,13 +150,9 @@ void ui_unlisted_coin_transfer_flow_display() { pair_list.nbPairs = 6; pair_list.pairs = pairs; - nbgl_useCaseReview(TYPE_TRANSACTION, - &pair_list, - &ICON_APP_HOME, - "Review transaction to transfer coins", - NULL, - "Sign transaction to transfer coins?", - review_choice); + nbgl_useCaseReview(TYPE_TRANSACTION, &pair_list, &ICON_APP_HOME, + "Review transaction to transfer coins", NULL, + "Sign transaction to transfer coins?", review_choice); } int ui_display_tx_coin_transfer() { @@ -206,7 +183,8 @@ int ui_display_tx_fungible_asset_transfer() { return ret; } -static const char* get_delegation_title(entry_function_known_type_t function_type) { +static const char* get_delegation_title( + entry_function_known_type_t function_type) { switch (function_type) { case FUNC_ADD_STAKE: return "Review transaction to delegate APT"; @@ -221,7 +199,8 @@ static const char* get_delegation_title(entry_function_known_type_t function_typ } } -static const char* get_delegation_sign_review(entry_function_known_type_t function_type) { +static const char* get_delegation_sign_review( + entry_function_known_type_t function_type) { switch (function_type) { case FUNC_ADD_STAKE: return "Sign transaction to delegate APT?"; @@ -236,7 +215,8 @@ static const char* get_delegation_sign_review(entry_function_known_type_t functi } } -void ui_delegation_pool_flow_display(entry_function_known_type_t function_type) { +void ui_delegation_pool_flow_display( + entry_function_known_type_t function_type) { PRINTF("ui_delegation_pool_flow_display"); switch (function_type) { case FUNC_ADD_STAKE: @@ -265,16 +245,14 @@ void ui_delegation_pool_flow_display(entry_function_known_type_t function_type) pair_list.nbPairs = 3; pair_list.pairs = pairs; - nbgl_useCaseReview(TYPE_TRANSACTION, - &pair_list, - &ICON_APP_HOME, - get_delegation_title(function_type), - NULL, + nbgl_useCaseReview(TYPE_TRANSACTION, &pair_list, &ICON_APP_HOME, + get_delegation_title(function_type), NULL, get_delegation_sign_review(function_type), review_choice); } -int ui_display_delegation_pool_transfer(entry_function_known_type_t function_type) { +int ui_display_delegation_pool_transfer( + entry_function_known_type_t function_type) { const int ret = ui_prepare_delegation_pool_transfer(); if (ret == UI_PREPARED) { ui_delegation_pool_flow_display(function_type); diff --git a/src/ui/nbgl_menu.c b/src/ui/nbgl_menu.c index 5222bf4..ee504e3 100644 --- a/src/ui/nbgl_menu.c +++ b/src/ui/nbgl_menu.c @@ -18,15 +18,14 @@ #ifdef HAVE_NBGL -#include "os.h" -#include "io.h" -#include "glyphs.h" -#include "nbgl_use_case.h" - #include "../globals.h" +#include "display.h" +#include "glyphs.h" +#include "io.h" #include "menu.h" +#include "nbgl_use_case.h" +#include "os.h" #include "settings.h" -#include "display.h" #define SETTINGS_PAGE_NUMBER 2 @@ -40,7 +39,8 @@ enum { }; static const char* const INFO_TYPES[] = {"Version", "Developer", "Copyright"}; -static const char* const INFO_CONTENTS[] = {APPVERSION, "Ledger", "(c) 2024 Ledger"}; +static const char* const INFO_CONTENTS[] = {APPVERSION, "Ledger", + "(c) 2024 Ledger"}; static nbgl_contentSwitch_t g_switches[SWITCHES_COUNT]; @@ -71,7 +71,8 @@ static const nbgl_genericContents_t g_setting_contents = { .nbContents = 1, }; -static void settings_controls_callback(int token, uint8_t index, __attribute__((unused)) int page) { +static void settings_controls_callback(int token, uint8_t index, + __attribute__((unused)) int page) { switch (token) { case TOKEN_BLIND_SIGNING: if (index == 0 || index == 1) { @@ -83,9 +84,7 @@ static void settings_controls_callback(int token, uint8_t index, __attribute__(( } } -void app_quit(void) { - os_sched_exit(-1); -} +void app_quit(void) { os_sched_exit(-1); } void ui_menu_main(void) { g_switches[SWITCH_BLIND_SIGNING].text = "Blind signing"; @@ -94,13 +93,8 @@ void ui_menu_main(void) { g_switches[SWITCH_BLIND_SIGNING].initState = N_storage.settings.allow_blind_signing == 0 ? OFF_STATE : ON_STATE; - nbgl_useCaseHomeAndSettings(APPNAME, - &ICON_APP_HOME, - NULL, - INIT_HOME_PAGE, - &g_setting_contents, - &g_infos_list, - NULL, + nbgl_useCaseHomeAndSettings(APPNAME, &ICON_APP_HOME, NULL, INIT_HOME_PAGE, + &g_setting_contents, &g_infos_list, NULL, app_quit); } diff --git a/tests/snapshots/apex_p/test_app_mainmenu/00004.png b/tests/snapshots/apex_p/test_app_mainmenu/00004.png index df76188..725f356 100644 Binary files a/tests/snapshots/apex_p/test_app_mainmenu/00004.png and b/tests/snapshots/apex_p/test_app_mainmenu/00004.png differ diff --git a/tests/snapshots/apex_p/test_get_public_key_confirm_accepted/00002.png b/tests/snapshots/apex_p/test_get_public_key_confirm_accepted/00002.png index 26bcdc8..833ed20 100644 Binary files a/tests/snapshots/apex_p/test_get_public_key_confirm_accepted/00002.png and b/tests/snapshots/apex_p/test_get_public_key_confirm_accepted/00002.png differ diff --git a/tests/snapshots/apex_p/test_get_public_key_confirm_refused/part1/00002.png b/tests/snapshots/apex_p/test_get_public_key_confirm_refused/part1/00002.png index 2722e1a..8301892 100644 Binary files a/tests/snapshots/apex_p/test_get_public_key_confirm_refused/part1/00002.png and b/tests/snapshots/apex_p/test_get_public_key_confirm_refused/part1/00002.png differ diff --git a/tests/snapshots/apex_p/test_get_public_key_confirm_refused/part1/00003.png b/tests/snapshots/apex_p/test_get_public_key_confirm_refused/part1/00003.png index 329f133..2722e1a 100644 Binary files a/tests/snapshots/apex_p/test_get_public_key_confirm_refused/part1/00003.png and b/tests/snapshots/apex_p/test_get_public_key_confirm_refused/part1/00003.png differ diff --git a/tests/snapshots/apex_p/test_sign_fa_tx/00001.png b/tests/snapshots/apex_p/test_sign_fa_tx/00001.png index a94b7be..39db380 100644 Binary files a/tests/snapshots/apex_p/test_sign_fa_tx/00001.png and b/tests/snapshots/apex_p/test_sign_fa_tx/00001.png differ diff --git a/tests/snapshots/flex/test_app_mainmenu/00000.png b/tests/snapshots/flex/test_app_mainmenu/00000.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_app_mainmenu/00000.png and b/tests/snapshots/flex/test_app_mainmenu/00000.png differ diff --git a/tests/snapshots/flex/test_app_mainmenu/00001.png b/tests/snapshots/flex/test_app_mainmenu/00001.png index 1badbdf..5676154 100644 Binary files a/tests/snapshots/flex/test_app_mainmenu/00001.png and b/tests/snapshots/flex/test_app_mainmenu/00001.png differ diff --git a/tests/snapshots/flex/test_app_mainmenu/00002.png b/tests/snapshots/flex/test_app_mainmenu/00002.png index c139a5d..3800de9 100644 Binary files a/tests/snapshots/flex/test_app_mainmenu/00002.png and b/tests/snapshots/flex/test_app_mainmenu/00002.png differ diff --git a/tests/snapshots/flex/test_app_mainmenu/00003.png b/tests/snapshots/flex/test_app_mainmenu/00003.png index 1badbdf..5676154 100644 Binary files a/tests/snapshots/flex/test_app_mainmenu/00003.png and b/tests/snapshots/flex/test_app_mainmenu/00003.png differ diff --git a/tests/snapshots/flex/test_app_mainmenu/00004.png b/tests/snapshots/flex/test_app_mainmenu/00004.png index f78dffd..618957d 100644 Binary files a/tests/snapshots/flex/test_app_mainmenu/00004.png and b/tests/snapshots/flex/test_app_mainmenu/00004.png differ diff --git a/tests/snapshots/flex/test_app_mainmenu/00005.png b/tests/snapshots/flex/test_app_mainmenu/00005.png index 879082f..88db9a3 100644 Binary files a/tests/snapshots/flex/test_app_mainmenu/00005.png and b/tests/snapshots/flex/test_app_mainmenu/00005.png differ diff --git a/tests/snapshots/flex/test_app_mainmenu/00006.png b/tests/snapshots/flex/test_app_mainmenu/00006.png index f78dffd..618957d 100644 Binary files a/tests/snapshots/flex/test_app_mainmenu/00006.png and b/tests/snapshots/flex/test_app_mainmenu/00006.png differ diff --git a/tests/snapshots/flex/test_app_mainmenu/00007.png b/tests/snapshots/flex/test_app_mainmenu/00007.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_app_mainmenu/00007.png and b/tests/snapshots/flex/test_app_mainmenu/00007.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00000.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00000.png index 9b88fab..cde018d 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00000.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00000.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00001.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00001.png index 2aff16b..b1ac424 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00001.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00001.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00002.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00002.png index d17942d..a0f791b 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00002.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00002.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00003.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00003.png index 2bd18bd..455e9c8 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00003.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00003.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00004.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00004.png index 057edd8..fee3183 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00004.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part0/00004.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00000.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00000.png index 2bd18bd..455e9c8 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00000.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00000.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00001.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00001.png index d4d6be7..fb9a134 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00001.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00001.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00002.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00002.png index 85dee5c..fb27bd3 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00002.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00002.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00003.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00003.png index 057edd8..fee3183 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00003.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00003.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00004.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00004.png index 85dee5c..fb27bd3 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00004.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00004.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00005.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00005.png index be51a9d..435aa78 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00005.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00005.png differ diff --git a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00006.png b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00006.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00006.png and b/tests/snapshots/flex/test_blind_sign_tx_long_tx/part1/00006.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00000.png b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00000.png index fc46abd..b91ee1a 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00000.png and b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00000.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00001.png b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00001.png index ce09630..ab17110 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00001.png and b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00001.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00002.png b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00002.png index 8522b59..7fcfb37 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00002.png and b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00002.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00003.png b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00003.png index ce09630..ab17110 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00003.png and b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00003.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00004.png b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00004.png index 4321e60..8d07f2f 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00004.png and b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00004.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00005.png b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00005.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_accepted/00005.png and b/tests/snapshots/flex/test_get_public_key_confirm_accepted/00005.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_refused/part0/00000.png b/tests/snapshots/flex/test_get_public_key_confirm_refused/part0/00000.png index fc46abd..b91ee1a 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_refused/part0/00000.png and b/tests/snapshots/flex/test_get_public_key_confirm_refused/part0/00000.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00000.png b/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00000.png index fc46abd..b91ee1a 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00000.png and b/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00000.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00001.png b/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00001.png index ce09630..ab17110 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00001.png and b/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00001.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00002.png b/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00002.png index dbbb5fc..34c3465 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00002.png and b/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00002.png differ diff --git a/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00003.png b/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00003.png index 71c1b97..34c3465 100644 Binary files a/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00003.png and b/tests/snapshots/flex/test_get_public_key_confirm_refused/part1/00003.png differ diff --git a/tests/snapshots/flex/test_sign_fa_tx/00000.png b/tests/snapshots/flex/test_sign_fa_tx/00000.png index b4a48b7..be25d49 100644 Binary files a/tests/snapshots/flex/test_sign_fa_tx/00000.png and b/tests/snapshots/flex/test_sign_fa_tx/00000.png differ diff --git a/tests/snapshots/flex/test_sign_fa_tx/00001.png b/tests/snapshots/flex/test_sign_fa_tx/00001.png index 84bb1a3..feef4cd 100644 Binary files a/tests/snapshots/flex/test_sign_fa_tx/00001.png and b/tests/snapshots/flex/test_sign_fa_tx/00001.png differ diff --git a/tests/snapshots/flex/test_sign_fa_tx/00002.png b/tests/snapshots/flex/test_sign_fa_tx/00002.png index 1172b1a..85b1331 100644 Binary files a/tests/snapshots/flex/test_sign_fa_tx/00002.png and b/tests/snapshots/flex/test_sign_fa_tx/00002.png differ diff --git a/tests/snapshots/flex/test_sign_fa_tx/00003.png b/tests/snapshots/flex/test_sign_fa_tx/00003.png index 69449e4..d81ed0d 100644 Binary files a/tests/snapshots/flex/test_sign_fa_tx/00003.png and b/tests/snapshots/flex/test_sign_fa_tx/00003.png differ diff --git a/tests/snapshots/flex/test_sign_fa_tx/00004.png b/tests/snapshots/flex/test_sign_fa_tx/00004.png index be51a9d..435aa78 100644 Binary files a/tests/snapshots/flex/test_sign_fa_tx/00004.png and b/tests/snapshots/flex/test_sign_fa_tx/00004.png differ diff --git a/tests/snapshots/flex/test_sign_fa_tx/00005.png b/tests/snapshots/flex/test_sign_fa_tx/00005.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_fa_tx/00005.png and b/tests/snapshots/flex/test_sign_fa_tx/00005.png differ diff --git a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00000.png b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00000.png index b4a48b7..be25d49 100644 Binary files a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00000.png and b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00000.png differ diff --git a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00001.png b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00001.png index 303b71d..006a7df 100644 Binary files a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00001.png and b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00001.png differ diff --git a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00002.png b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00002.png index 489d57d..ca5c6eb 100644 Binary files a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00002.png and b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00002.png differ diff --git a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00003.png b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00003.png index 69449e4..d81ed0d 100644 Binary files a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00003.png and b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00003.png differ diff --git a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00004.png b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00004.png index be51a9d..435aa78 100644 Binary files a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00004.png and b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00004.png differ diff --git a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00005.png b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00005.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_listed_legacy_tokens/00005.png and b/tests/snapshots/flex/test_sign_listed_legacy_tokens/00005.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part0/00000.png b/tests/snapshots/flex/test_sign_long_raw_msg/part0/00000.png index 9b88fab..cde018d 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part0/00000.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part0/00000.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part0/00001.png b/tests/snapshots/flex/test_sign_long_raw_msg/part0/00001.png index 2aff16b..b1ac424 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part0/00001.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part0/00001.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part0/00002.png b/tests/snapshots/flex/test_sign_long_raw_msg/part0/00002.png index d17942d..a0f791b 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part0/00002.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part0/00002.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part0/00003.png b/tests/snapshots/flex/test_sign_long_raw_msg/part0/00003.png index 8a1beb2..88df0ee 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part0/00003.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part0/00003.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part0/00004.png b/tests/snapshots/flex/test_sign_long_raw_msg/part0/00004.png index 057edd8..fee3183 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part0/00004.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part0/00004.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00000.png b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00000.png index 8a1beb2..88df0ee 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00000.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00000.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00001.png b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00001.png index 247d8ad..f3d2897 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00001.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00001.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00002.png b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00002.png index dceb9b5..8206fbf 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00002.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00002.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00003.png b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00003.png index 057edd8..fee3183 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00003.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00003.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00004.png b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00004.png index dceb9b5..8206fbf 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00004.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00004.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00005.png b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00005.png index 8b981d4..f8e68c8 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00005.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00005.png differ diff --git a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00006.png b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00006.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_long_raw_msg/part1/00006.png and b/tests/snapshots/flex/test_sign_long_raw_msg/part1/00006.png differ diff --git a/tests/snapshots/flex/test_sign_reactivate_aptos/00000.png b/tests/snapshots/flex/test_sign_reactivate_aptos/00000.png index 041f7c3..98ce22f 100644 Binary files a/tests/snapshots/flex/test_sign_reactivate_aptos/00000.png and b/tests/snapshots/flex/test_sign_reactivate_aptos/00000.png differ diff --git a/tests/snapshots/flex/test_sign_reactivate_aptos/00001.png b/tests/snapshots/flex/test_sign_reactivate_aptos/00001.png index 15d8eb5..0411dbf 100644 Binary files a/tests/snapshots/flex/test_sign_reactivate_aptos/00001.png and b/tests/snapshots/flex/test_sign_reactivate_aptos/00001.png differ diff --git a/tests/snapshots/flex/test_sign_reactivate_aptos/00002.png b/tests/snapshots/flex/test_sign_reactivate_aptos/00002.png index 9d2bb65..0ff9d5b 100644 Binary files a/tests/snapshots/flex/test_sign_reactivate_aptos/00002.png and b/tests/snapshots/flex/test_sign_reactivate_aptos/00002.png differ diff --git a/tests/snapshots/flex/test_sign_reactivate_aptos/00003.png b/tests/snapshots/flex/test_sign_reactivate_aptos/00003.png index be51a9d..435aa78 100644 Binary files a/tests/snapshots/flex/test_sign_reactivate_aptos/00003.png and b/tests/snapshots/flex/test_sign_reactivate_aptos/00003.png differ diff --git a/tests/snapshots/flex/test_sign_reactivate_aptos/00004.png b/tests/snapshots/flex/test_sign_reactivate_aptos/00004.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_reactivate_aptos/00004.png and b/tests/snapshots/flex/test_sign_reactivate_aptos/00004.png differ diff --git a/tests/snapshots/flex/test_sign_short_raw_msg/00000.png b/tests/snapshots/flex/test_sign_short_raw_msg/00000.png index d940532..f15e0e5 100644 Binary files a/tests/snapshots/flex/test_sign_short_raw_msg/00000.png and b/tests/snapshots/flex/test_sign_short_raw_msg/00000.png differ diff --git a/tests/snapshots/flex/test_sign_short_raw_msg/00001.png b/tests/snapshots/flex/test_sign_short_raw_msg/00001.png index ced4b57..f1b2419 100644 Binary files a/tests/snapshots/flex/test_sign_short_raw_msg/00001.png and b/tests/snapshots/flex/test_sign_short_raw_msg/00001.png differ diff --git a/tests/snapshots/flex/test_sign_short_raw_msg/00002.png b/tests/snapshots/flex/test_sign_short_raw_msg/00002.png index 4c73534..598dc99 100644 Binary files a/tests/snapshots/flex/test_sign_short_raw_msg/00002.png and b/tests/snapshots/flex/test_sign_short_raw_msg/00002.png differ diff --git a/tests/snapshots/flex/test_sign_short_raw_msg/00003.png b/tests/snapshots/flex/test_sign_short_raw_msg/00003.png index 8b981d4..f8e68c8 100644 Binary files a/tests/snapshots/flex/test_sign_short_raw_msg/00003.png and b/tests/snapshots/flex/test_sign_short_raw_msg/00003.png differ diff --git a/tests/snapshots/flex/test_sign_short_raw_msg/00004.png b/tests/snapshots/flex/test_sign_short_raw_msg/00004.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_short_raw_msg/00004.png and b/tests/snapshots/flex/test_sign_short_raw_msg/00004.png differ diff --git a/tests/snapshots/flex/test_sign_staking_aptos/00000.png b/tests/snapshots/flex/test_sign_staking_aptos/00000.png index c3775ef..038b3ab 100644 Binary files a/tests/snapshots/flex/test_sign_staking_aptos/00000.png and b/tests/snapshots/flex/test_sign_staking_aptos/00000.png differ diff --git a/tests/snapshots/flex/test_sign_staking_aptos/00001.png b/tests/snapshots/flex/test_sign_staking_aptos/00001.png index 3ad869c..9c299a8 100644 Binary files a/tests/snapshots/flex/test_sign_staking_aptos/00001.png and b/tests/snapshots/flex/test_sign_staking_aptos/00001.png differ diff --git a/tests/snapshots/flex/test_sign_staking_aptos/00002.png b/tests/snapshots/flex/test_sign_staking_aptos/00002.png index 50cafde..c758142 100644 Binary files a/tests/snapshots/flex/test_sign_staking_aptos/00002.png and b/tests/snapshots/flex/test_sign_staking_aptos/00002.png differ diff --git a/tests/snapshots/flex/test_sign_staking_aptos/00003.png b/tests/snapshots/flex/test_sign_staking_aptos/00003.png index be51a9d..435aa78 100644 Binary files a/tests/snapshots/flex/test_sign_staking_aptos/00003.png and b/tests/snapshots/flex/test_sign_staking_aptos/00003.png differ diff --git a/tests/snapshots/flex/test_sign_staking_aptos/00004.png b/tests/snapshots/flex/test_sign_staking_aptos/00004.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_staking_aptos/00004.png and b/tests/snapshots/flex/test_sign_staking_aptos/00004.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part0/00000.png b/tests/snapshots/flex/test_sign_tx_refused/part0/00000.png index fcf5fba..ba7447b 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part0/00000.png and b/tests/snapshots/flex/test_sign_tx_refused/part0/00000.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part0/00001.png b/tests/snapshots/flex/test_sign_tx_refused/part0/00001.png index 6a11e11..315d354 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part0/00001.png and b/tests/snapshots/flex/test_sign_tx_refused/part0/00001.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part1/00000.png b/tests/snapshots/flex/test_sign_tx_refused/part1/00000.png index fcf5fba..ba7447b 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part1/00000.png and b/tests/snapshots/flex/test_sign_tx_refused/part1/00000.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part1/00001.png b/tests/snapshots/flex/test_sign_tx_refused/part1/00001.png index 18d7cda..857dc89 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part1/00001.png and b/tests/snapshots/flex/test_sign_tx_refused/part1/00001.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part1/00002.png b/tests/snapshots/flex/test_sign_tx_refused/part1/00002.png index 6a11e11..315d354 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part1/00002.png and b/tests/snapshots/flex/test_sign_tx_refused/part1/00002.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part2/00000.png b/tests/snapshots/flex/test_sign_tx_refused/part2/00000.png index fcf5fba..ba7447b 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part2/00000.png and b/tests/snapshots/flex/test_sign_tx_refused/part2/00000.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part2/00001.png b/tests/snapshots/flex/test_sign_tx_refused/part2/00001.png index 18d7cda..857dc89 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part2/00001.png and b/tests/snapshots/flex/test_sign_tx_refused/part2/00001.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part2/00002.png b/tests/snapshots/flex/test_sign_tx_refused/part2/00002.png index 5f7940d..bb697ab 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part2/00002.png and b/tests/snapshots/flex/test_sign_tx_refused/part2/00002.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part2/00003.png b/tests/snapshots/flex/test_sign_tx_refused/part2/00003.png index 6a11e11..315d354 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part2/00003.png and b/tests/snapshots/flex/test_sign_tx_refused/part2/00003.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part3/00000.png b/tests/snapshots/flex/test_sign_tx_refused/part3/00000.png index fcf5fba..ba7447b 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part3/00000.png and b/tests/snapshots/flex/test_sign_tx_refused/part3/00000.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part3/00001.png b/tests/snapshots/flex/test_sign_tx_refused/part3/00001.png index 18d7cda..857dc89 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part3/00001.png and b/tests/snapshots/flex/test_sign_tx_refused/part3/00001.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part3/00002.png b/tests/snapshots/flex/test_sign_tx_refused/part3/00002.png index 5f7940d..bb697ab 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part3/00002.png and b/tests/snapshots/flex/test_sign_tx_refused/part3/00002.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part3/00003.png b/tests/snapshots/flex/test_sign_tx_refused/part3/00003.png index f4b144d..75c1c1b 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part3/00003.png and b/tests/snapshots/flex/test_sign_tx_refused/part3/00003.png differ diff --git a/tests/snapshots/flex/test_sign_tx_refused/part3/00004.png b/tests/snapshots/flex/test_sign_tx_refused/part3/00004.png index 6a11e11..315d354 100644 Binary files a/tests/snapshots/flex/test_sign_tx_refused/part3/00004.png and b/tests/snapshots/flex/test_sign_tx_refused/part3/00004.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_msg/00000.png b/tests/snapshots/flex/test_sign_tx_short_msg/00000.png index d940532..f15e0e5 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_msg/00000.png and b/tests/snapshots/flex/test_sign_tx_short_msg/00000.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_msg/00001.png b/tests/snapshots/flex/test_sign_tx_short_msg/00001.png index 5b5ac42..9852a38 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_msg/00001.png and b/tests/snapshots/flex/test_sign_tx_short_msg/00001.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_msg/00002.png b/tests/snapshots/flex/test_sign_tx_short_msg/00002.png index 4c73534..598dc99 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_msg/00002.png and b/tests/snapshots/flex/test_sign_tx_short_msg/00002.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_msg/00003.png b/tests/snapshots/flex/test_sign_tx_short_msg/00003.png index 8b981d4..f8e68c8 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_msg/00003.png and b/tests/snapshots/flex/test_sign_tx_short_msg/00003.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_msg/00004.png b/tests/snapshots/flex/test_sign_tx_short_msg/00004.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_msg/00004.png and b/tests/snapshots/flex/test_sign_tx_short_msg/00004.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_tx/00000.png b/tests/snapshots/flex/test_sign_tx_short_tx/00000.png index b4a48b7..be25d49 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_tx/00000.png and b/tests/snapshots/flex/test_sign_tx_short_tx/00000.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_tx/00001.png b/tests/snapshots/flex/test_sign_tx_short_tx/00001.png index 59c9a4c..15b0fa9 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_tx/00001.png and b/tests/snapshots/flex/test_sign_tx_short_tx/00001.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_tx/00002.png b/tests/snapshots/flex/test_sign_tx_short_tx/00002.png index 5a61326..89badef 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_tx/00002.png and b/tests/snapshots/flex/test_sign_tx_short_tx/00002.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_tx/00003.png b/tests/snapshots/flex/test_sign_tx_short_tx/00003.png index 69449e4..d81ed0d 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_tx/00003.png and b/tests/snapshots/flex/test_sign_tx_short_tx/00003.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_tx/00004.png b/tests/snapshots/flex/test_sign_tx_short_tx/00004.png index be51a9d..435aa78 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_tx/00004.png and b/tests/snapshots/flex/test_sign_tx_short_tx/00004.png differ diff --git a/tests/snapshots/flex/test_sign_tx_short_tx/00005.png b/tests/snapshots/flex/test_sign_tx_short_tx/00005.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_tx_short_tx/00005.png and b/tests/snapshots/flex/test_sign_tx_short_tx/00005.png differ diff --git a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00000.png b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00000.png index 555b6f3..831017b 100644 Binary files a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00000.png and b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00000.png differ diff --git a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00001.png b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00001.png index 6b9c9f8..5d32d70 100644 Binary files a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00001.png and b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00001.png differ diff --git a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00002.png b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00002.png index fde97b0..68e1816 100644 Binary files a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00002.png and b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00002.png differ diff --git a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00003.png b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00003.png index 6af111d..726e67b 100644 Binary files a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00003.png and b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00003.png differ diff --git a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00004.png b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00004.png index a4acbed..c104989 100644 Binary files a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00004.png and b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00004.png differ diff --git a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00005.png b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00005.png index be51a9d..435aa78 100644 Binary files a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00005.png and b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00005.png differ diff --git a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00006.png b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00006.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00006.png and b/tests/snapshots/flex/test_sign_unlisted_legacy_tokens/00006.png differ diff --git a/tests/snapshots/flex/test_sign_unlocking_aptos/00000.png b/tests/snapshots/flex/test_sign_unlocking_aptos/00000.png index ddd16ad..255e582 100644 Binary files a/tests/snapshots/flex/test_sign_unlocking_aptos/00000.png and b/tests/snapshots/flex/test_sign_unlocking_aptos/00000.png differ diff --git a/tests/snapshots/flex/test_sign_unlocking_aptos/00001.png b/tests/snapshots/flex/test_sign_unlocking_aptos/00001.png index fc5bad3..519eee5 100644 Binary files a/tests/snapshots/flex/test_sign_unlocking_aptos/00001.png and b/tests/snapshots/flex/test_sign_unlocking_aptos/00001.png differ diff --git a/tests/snapshots/flex/test_sign_unlocking_aptos/00002.png b/tests/snapshots/flex/test_sign_unlocking_aptos/00002.png index 50477d7..bab6a1b 100644 Binary files a/tests/snapshots/flex/test_sign_unlocking_aptos/00002.png and b/tests/snapshots/flex/test_sign_unlocking_aptos/00002.png differ diff --git a/tests/snapshots/flex/test_sign_unlocking_aptos/00003.png b/tests/snapshots/flex/test_sign_unlocking_aptos/00003.png index be51a9d..435aa78 100644 Binary files a/tests/snapshots/flex/test_sign_unlocking_aptos/00003.png and b/tests/snapshots/flex/test_sign_unlocking_aptos/00003.png differ diff --git a/tests/snapshots/flex/test_sign_unlocking_aptos/00004.png b/tests/snapshots/flex/test_sign_unlocking_aptos/00004.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_unlocking_aptos/00004.png and b/tests/snapshots/flex/test_sign_unlocking_aptos/00004.png differ diff --git a/tests/snapshots/flex/test_sign_withdraw_aptos/00000.png b/tests/snapshots/flex/test_sign_withdraw_aptos/00000.png index 6010af0..a37f943 100644 Binary files a/tests/snapshots/flex/test_sign_withdraw_aptos/00000.png and b/tests/snapshots/flex/test_sign_withdraw_aptos/00000.png differ diff --git a/tests/snapshots/flex/test_sign_withdraw_aptos/00001.png b/tests/snapshots/flex/test_sign_withdraw_aptos/00001.png index 8109cc9..2da2a3c 100644 Binary files a/tests/snapshots/flex/test_sign_withdraw_aptos/00001.png and b/tests/snapshots/flex/test_sign_withdraw_aptos/00001.png differ diff --git a/tests/snapshots/flex/test_sign_withdraw_aptos/00002.png b/tests/snapshots/flex/test_sign_withdraw_aptos/00002.png index 36aa955..db9b040 100644 Binary files a/tests/snapshots/flex/test_sign_withdraw_aptos/00002.png and b/tests/snapshots/flex/test_sign_withdraw_aptos/00002.png differ diff --git a/tests/snapshots/flex/test_sign_withdraw_aptos/00003.png b/tests/snapshots/flex/test_sign_withdraw_aptos/00003.png index be51a9d..435aa78 100644 Binary files a/tests/snapshots/flex/test_sign_withdraw_aptos/00003.png and b/tests/snapshots/flex/test_sign_withdraw_aptos/00003.png differ diff --git a/tests/snapshots/flex/test_sign_withdraw_aptos/00004.png b/tests/snapshots/flex/test_sign_withdraw_aptos/00004.png index 71c1b97..4dc499a 100644 Binary files a/tests/snapshots/flex/test_sign_withdraw_aptos/00004.png and b/tests/snapshots/flex/test_sign_withdraw_aptos/00004.png differ diff --git a/tests/snapshots/nanosp/test_sign_fa_tx/00003.png b/tests/snapshots/nanosp/test_sign_fa_tx/00003.png index 355583b..35ebb6d 100644 Binary files a/tests/snapshots/nanosp/test_sign_fa_tx/00003.png and b/tests/snapshots/nanosp/test_sign_fa_tx/00003.png differ diff --git a/tests/snapshots/nanox/test_sign_fa_tx/00003.png b/tests/snapshots/nanox/test_sign_fa_tx/00003.png index 355583b..35ebb6d 100644 Binary files a/tests/snapshots/nanox/test_sign_fa_tx/00003.png and b/tests/snapshots/nanox/test_sign_fa_tx/00003.png differ diff --git a/tests/snapshots/stax/test_app_mainmenu/00004.png b/tests/snapshots/stax/test_app_mainmenu/00004.png index 51c1586..955942d 100644 Binary files a/tests/snapshots/stax/test_app_mainmenu/00004.png and b/tests/snapshots/stax/test_app_mainmenu/00004.png differ diff --git a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part0/00001.png b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part0/00001.png index 956ffca..f89b7a7 100644 Binary files a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part0/00001.png and b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part0/00001.png differ diff --git a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part0/00003.png b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part0/00003.png index 5d673ed..5efc200 100644 Binary files a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part0/00003.png and b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part0/00003.png differ diff --git a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00000.png b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00000.png index 5d673ed..5efc200 100644 Binary files a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00000.png and b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00000.png differ diff --git a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00002.png b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00002.png index 551846c..a95c277 100644 Binary files a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00002.png and b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00002.png differ diff --git a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00004.png b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00004.png index 551846c..a95c277 100644 Binary files a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00004.png and b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00004.png differ diff --git a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00005.png b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00005.png index 392165d..ceda6a8 100644 Binary files a/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00005.png and b/tests/snapshots/stax/test_blind_sign_tx_long_tx/part1/00005.png differ diff --git a/tests/snapshots/stax/test_get_public_key_confirm_accepted/00002.png b/tests/snapshots/stax/test_get_public_key_confirm_accepted/00002.png index fecca46..0042c63 100644 Binary files a/tests/snapshots/stax/test_get_public_key_confirm_accepted/00002.png and b/tests/snapshots/stax/test_get_public_key_confirm_accepted/00002.png differ diff --git a/tests/snapshots/stax/test_get_public_key_confirm_accepted/00004.png b/tests/snapshots/stax/test_get_public_key_confirm_accepted/00004.png index 7a49478..ef04425 100644 Binary files a/tests/snapshots/stax/test_get_public_key_confirm_accepted/00004.png and b/tests/snapshots/stax/test_get_public_key_confirm_accepted/00004.png differ diff --git a/tests/snapshots/stax/test_get_public_key_confirm_refused/part1/00003.png b/tests/snapshots/stax/test_get_public_key_confirm_refused/part1/00003.png index aa419bd..7c30edc 100644 Binary files a/tests/snapshots/stax/test_get_public_key_confirm_refused/part1/00003.png and b/tests/snapshots/stax/test_get_public_key_confirm_refused/part1/00003.png differ diff --git a/tests/snapshots/stax/test_sign_fa_tx/00001.png b/tests/snapshots/stax/test_sign_fa_tx/00001.png index 498c8a8..1f9bfc9 100644 Binary files a/tests/snapshots/stax/test_sign_fa_tx/00001.png and b/tests/snapshots/stax/test_sign_fa_tx/00001.png differ diff --git a/tests/snapshots/stax/test_sign_fa_tx/00003.png b/tests/snapshots/stax/test_sign_fa_tx/00003.png index a39ed93..b879aaa 100644 Binary files a/tests/snapshots/stax/test_sign_fa_tx/00003.png and b/tests/snapshots/stax/test_sign_fa_tx/00003.png differ diff --git a/tests/snapshots/stax/test_sign_fa_tx/00004.png b/tests/snapshots/stax/test_sign_fa_tx/00004.png index 392165d..ceda6a8 100644 Binary files a/tests/snapshots/stax/test_sign_fa_tx/00004.png and b/tests/snapshots/stax/test_sign_fa_tx/00004.png differ diff --git a/tests/snapshots/stax/test_sign_listed_legacy_tokens/00003.png b/tests/snapshots/stax/test_sign_listed_legacy_tokens/00003.png index a39ed93..b879aaa 100644 Binary files a/tests/snapshots/stax/test_sign_listed_legacy_tokens/00003.png and b/tests/snapshots/stax/test_sign_listed_legacy_tokens/00003.png differ diff --git a/tests/snapshots/stax/test_sign_listed_legacy_tokens/00004.png b/tests/snapshots/stax/test_sign_listed_legacy_tokens/00004.png index 392165d..ceda6a8 100644 Binary files a/tests/snapshots/stax/test_sign_listed_legacy_tokens/00004.png and b/tests/snapshots/stax/test_sign_listed_legacy_tokens/00004.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part0/00001.png b/tests/snapshots/stax/test_sign_long_raw_msg/part0/00001.png index 956ffca..f89b7a7 100644 Binary files a/tests/snapshots/stax/test_sign_long_raw_msg/part0/00001.png and b/tests/snapshots/stax/test_sign_long_raw_msg/part0/00001.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part0/00003.png b/tests/snapshots/stax/test_sign_long_raw_msg/part0/00003.png index f978099..20b526b 100644 Binary files a/tests/snapshots/stax/test_sign_long_raw_msg/part0/00003.png and b/tests/snapshots/stax/test_sign_long_raw_msg/part0/00003.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00000.png b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00000.png index f978099..20b526b 100644 Binary files a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00000.png and b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00000.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00002.png b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00002.png index 939f9ca..65b81a2 100644 Binary files a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00002.png and b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00002.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00004.png b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00004.png index 939f9ca..65b81a2 100644 Binary files a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00004.png and b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00004.png differ diff --git a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00005.png b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00005.png index cfee3ae..650a6f3 100644 Binary files a/tests/snapshots/stax/test_sign_long_raw_msg/part1/00005.png and b/tests/snapshots/stax/test_sign_long_raw_msg/part1/00005.png differ diff --git a/tests/snapshots/stax/test_sign_reactivate_aptos/00002.png b/tests/snapshots/stax/test_sign_reactivate_aptos/00002.png index 156bdd0..b295837 100644 Binary files a/tests/snapshots/stax/test_sign_reactivate_aptos/00002.png and b/tests/snapshots/stax/test_sign_reactivate_aptos/00002.png differ diff --git a/tests/snapshots/stax/test_sign_reactivate_aptos/00003.png b/tests/snapshots/stax/test_sign_reactivate_aptos/00003.png index 392165d..ceda6a8 100644 Binary files a/tests/snapshots/stax/test_sign_reactivate_aptos/00003.png and b/tests/snapshots/stax/test_sign_reactivate_aptos/00003.png differ diff --git a/tests/snapshots/stax/test_sign_short_raw_msg/00002.png b/tests/snapshots/stax/test_sign_short_raw_msg/00002.png index dc876b3..7a4e0e0 100644 Binary files a/tests/snapshots/stax/test_sign_short_raw_msg/00002.png and b/tests/snapshots/stax/test_sign_short_raw_msg/00002.png differ diff --git a/tests/snapshots/stax/test_sign_short_raw_msg/00003.png b/tests/snapshots/stax/test_sign_short_raw_msg/00003.png index cfee3ae..650a6f3 100644 Binary files a/tests/snapshots/stax/test_sign_short_raw_msg/00003.png and b/tests/snapshots/stax/test_sign_short_raw_msg/00003.png differ diff --git a/tests/snapshots/stax/test_sign_staking_aptos/00002.png b/tests/snapshots/stax/test_sign_staking_aptos/00002.png index 7534879..7b4c152 100644 Binary files a/tests/snapshots/stax/test_sign_staking_aptos/00002.png and b/tests/snapshots/stax/test_sign_staking_aptos/00002.png differ diff --git a/tests/snapshots/stax/test_sign_staking_aptos/00003.png b/tests/snapshots/stax/test_sign_staking_aptos/00003.png index 392165d..ceda6a8 100644 Binary files a/tests/snapshots/stax/test_sign_staking_aptos/00003.png and b/tests/snapshots/stax/test_sign_staking_aptos/00003.png differ diff --git a/tests/snapshots/stax/test_sign_tx_refused/part3/00003.png b/tests/snapshots/stax/test_sign_tx_refused/part3/00003.png index 5a97ee0..2c0aa9b 100644 Binary files a/tests/snapshots/stax/test_sign_tx_refused/part3/00003.png and b/tests/snapshots/stax/test_sign_tx_refused/part3/00003.png differ diff --git a/tests/snapshots/stax/test_sign_tx_short_msg/00002.png b/tests/snapshots/stax/test_sign_tx_short_msg/00002.png index dc876b3..7a4e0e0 100644 Binary files a/tests/snapshots/stax/test_sign_tx_short_msg/00002.png and b/tests/snapshots/stax/test_sign_tx_short_msg/00002.png differ diff --git a/tests/snapshots/stax/test_sign_tx_short_msg/00003.png b/tests/snapshots/stax/test_sign_tx_short_msg/00003.png index cfee3ae..650a6f3 100644 Binary files a/tests/snapshots/stax/test_sign_tx_short_msg/00003.png and b/tests/snapshots/stax/test_sign_tx_short_msg/00003.png differ diff --git a/tests/snapshots/stax/test_sign_tx_short_tx/00003.png b/tests/snapshots/stax/test_sign_tx_short_tx/00003.png index a39ed93..b879aaa 100644 Binary files a/tests/snapshots/stax/test_sign_tx_short_tx/00003.png and b/tests/snapshots/stax/test_sign_tx_short_tx/00003.png differ diff --git a/tests/snapshots/stax/test_sign_tx_short_tx/00004.png b/tests/snapshots/stax/test_sign_tx_short_tx/00004.png index 392165d..ceda6a8 100644 Binary files a/tests/snapshots/stax/test_sign_tx_short_tx/00004.png and b/tests/snapshots/stax/test_sign_tx_short_tx/00004.png differ diff --git a/tests/snapshots/stax/test_sign_unlisted_legacy_tokens/00003.png b/tests/snapshots/stax/test_sign_unlisted_legacy_tokens/00003.png index a39ed93..b879aaa 100644 Binary files a/tests/snapshots/stax/test_sign_unlisted_legacy_tokens/00003.png and b/tests/snapshots/stax/test_sign_unlisted_legacy_tokens/00003.png differ diff --git a/tests/snapshots/stax/test_sign_unlisted_legacy_tokens/00004.png b/tests/snapshots/stax/test_sign_unlisted_legacy_tokens/00004.png index 392165d..ceda6a8 100644 Binary files a/tests/snapshots/stax/test_sign_unlisted_legacy_tokens/00004.png and b/tests/snapshots/stax/test_sign_unlisted_legacy_tokens/00004.png differ diff --git a/tests/snapshots/stax/test_sign_unlocking_aptos/00002.png b/tests/snapshots/stax/test_sign_unlocking_aptos/00002.png index 64fdaa3..df6a261 100644 Binary files a/tests/snapshots/stax/test_sign_unlocking_aptos/00002.png and b/tests/snapshots/stax/test_sign_unlocking_aptos/00002.png differ diff --git a/tests/snapshots/stax/test_sign_unlocking_aptos/00003.png b/tests/snapshots/stax/test_sign_unlocking_aptos/00003.png index 392165d..ceda6a8 100644 Binary files a/tests/snapshots/stax/test_sign_unlocking_aptos/00003.png and b/tests/snapshots/stax/test_sign_unlocking_aptos/00003.png differ diff --git a/tests/snapshots/stax/test_sign_withdraw_aptos/00002.png b/tests/snapshots/stax/test_sign_withdraw_aptos/00002.png index c77d7b0..8be09c8 100644 Binary files a/tests/snapshots/stax/test_sign_withdraw_aptos/00002.png and b/tests/snapshots/stax/test_sign_withdraw_aptos/00002.png differ diff --git a/tests/snapshots/stax/test_sign_withdraw_aptos/00003.png b/tests/snapshots/stax/test_sign_withdraw_aptos/00003.png index 392165d..ceda6a8 100644 Binary files a/tests/snapshots/stax/test_sign_withdraw_aptos/00003.png and b/tests/snapshots/stax/test_sign_withdraw_aptos/00003.png differ diff --git a/tests/test_pubkey_cmd.py b/tests/test_pubkey_cmd.py index 3cece9f..02cd147 100644 --- a/tests/test_pubkey_cmd.py +++ b/tests/test_pubkey_cmd.py @@ -90,7 +90,7 @@ def test_get_public_key_confirm_refused(firmware, backend, navigator, test_name) NavInsID.USE_CASE_STATUS_DISMISS ], [ - NavInsID.USE_CASE_VIEW_DETAILS_NEXT, + NavInsID.USE_CASE_REVIEW_NEXT, NavInsID.USE_CASE_ADDRESS_CONFIRMATION_CANCEL, NavInsID.USE_CASE_STATUS_DISMISS ] @@ -104,3 +104,8 @@ def test_get_public_key_confirm_refused(firmware, backend, navigator, test_name) # Assert that we have received a refusal assert e.value.status == Errors.SW_DENY assert len(e.value.data) == 0 + # Wait for the "canceled" status screen to fully dismiss back to the + # home screen before starting the next iteration. Otherwise its + # residual frame can bleed into the next navigation's first + # screenshot, producing flaky snapshot comparisons. + navigator.navigate([NavInsID.WAIT_FOR_HOME_SCREEN]) diff --git a/unit-tests/test_tx_utils.c b/unit-tests/test_tx_utils.c index f9d1ead..f3fd15a 100644 --- a/unit-tests/test_tx_utils.c +++ b/unit-tests/test_tx_utils.c @@ -24,7 +24,7 @@ static void test_transaction_utils_bcs_cmp_bytes(void **state) { (void) state; const uint8_t good_bytes[] = {0x48, 0x65, 0x6c, 0x6c, 0x6f}; // Hello - const fixed_bytes_t bcs_bytes = {.len = 5, .bytes = &good_bytes}; + const fixed_bytes_t bcs_bytes = {.len = 5, .bytes = (uint8_t *) good_bytes}; const char good_str[] = "Hello"; const char bad_str[] = "Hello!"; assert_true(bcs_cmp_bytes(&bcs_bytes, good_str, strlen(good_str)));