diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 96ca1265..5bb48b8f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -87,7 +87,7 @@ jobs: run: "cd tests_zemu; yarn test" - name: Upload Snapshots (only failure) if: ${{ failure() }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: snapshots-tmp path: tests_zemu/snapshots-tmp/ diff --git a/app/Makefile.version b/app/Makefile.version index acb4aae2..865f1530 100644 --- a/app/Makefile.version +++ b/app/Makefile.version @@ -3,4 +3,4 @@ APPVERSION_M=2 # This is the `spec_version` field of `Runtime` APPVERSION_N=36 # This is the patch version of this release -APPVERSION_P=5 +APPVERSION_P=6 diff --git a/app/src/common/parser_common.h b/app/src/common/parser_common.h index 20b654d3..1acf9cb9 100644 --- a/app/src/common/parser_common.h +++ b/app/src/common/parser_common.h @@ -91,6 +91,7 @@ typedef enum { parser_swap_wrong_fee, parser_swap_unexpected_number_of_items, parser_swap_unexpected_field, + parser_swap_memo_not_present, parser_swap_wrap_amount_computation_error, parser_swap_wrong_type, } parser_error_t; diff --git a/app/src/parser_impl.c b/app/src/parser_impl.c index 73f20a5e..15e71b69 100644 --- a/app/src/parser_impl.c +++ b/app/src/parser_impl.c @@ -115,6 +115,8 @@ const char *parser_getErrorDescription(parser_error_t err) { return "Swap wrap amount computation error"; case parser_swap_wrong_type: return "Swap wrong type"; + case parser_swap_memo_not_present: + return "Swap memo not present"; default: return "Unrecognized error code"; diff --git a/app/src/swap/handle_sign_transaction.c b/app/src/swap/handle_sign_transaction.c index c219f961..3bb2db5c 100644 --- a/app/src/swap/handle_sign_transaction.c +++ b/app/src/swap/handle_sign_transaction.c @@ -179,17 +179,20 @@ parser_error_t parser_msg_send(parser_context_t *ctx_parsed_tx, uint8_t displayI return parser_swap_wrong_dest_address; } - // Check if memo is present + // Check if memo is present. If size of G_swap_state.memo is bigger than 0, then a memo should be present displayIdx += 1; uint8_t has_memo = 0; CHECK_PARSER_ERR(parser_getItem(ctx_parsed_tx, displayIdx, tmpKey, sizeof(tmpKey), tmpValue, sizeof(tmpValue), pageIdx, &pageCount)) - if (strcmp(tmpKey, "Memo") == 0) { - has_memo = 1; - if(strcmp(tmpValue, G_swap_state.memo) != 0) { - ZEMU_LOGF(200, "Wrong swap tx memo ('%s', should be : '%s').\n", tmpValue, G_swap_state.memo); - return parser_swap_wrong_memo; + if (strlen(G_swap_state.memo) > 0) { + if (strcmp(tmpKey, "Memo") == 0) { + has_memo = 1; + if(strcmp(tmpValue, G_swap_state.memo) != 0) { + ZEMU_LOGF(200, "Wrong swap tx memo ('%s', should be : '%s').\n", tmpValue, G_swap_state.memo); + return parser_swap_wrong_memo; + } + } else { + return parser_swap_memo_not_present; } - // Prepare for fees displayIdx += 1; CHECK_PARSER_ERR(parser_getItem(ctx_parsed_tx, displayIdx, tmpKey, sizeof(tmpKey), tmpValue, sizeof(tmpValue), pageIdx, &pageCount)) @@ -309,17 +312,20 @@ parser_error_t parser_simple_transfer(parser_context_t *ctx_parsed_tx, uint8_t d return parser_swap_wrong_dest_coins; } - // Check if memo is present + // Check if memo is present. If size of G_swap_state.memo is bigger than 0, then a memo should be present displayIdx += 1; uint8_t has_memo = 0; CHECK_PARSER_ERR(parser_getItem(ctx_parsed_tx, displayIdx, tmpKey, sizeof(tmpKey), tmpValue, sizeof(tmpValue), pageIdx, &pageCount)) - if (strcmp(tmpKey, "Memo") == 0) { - has_memo = 1; - if(strcmp(tmpValue, G_swap_state.memo) != 0) { - ZEMU_LOGF(200, "Wrong swap tx memo ('%s', should be : '%s').\n", tmpValue, G_swap_state.memo); - return parser_swap_wrong_memo; + if (strlen(G_swap_state.memo) > 0) { + if (strcmp(tmpKey, "Memo") == 0) { + has_memo = 1; + if(strcmp(tmpValue, G_swap_state.memo) != 0) { + ZEMU_LOGF(200, "Wrong swap tx memo ('%s', should be : '%s').\n", tmpValue, G_swap_state.memo); + return parser_swap_wrong_memo; + } + } else { + return parser_swap_memo_not_present; } - // Prepare for fees displayIdx += 1; CHECK_PARSER_ERR(parser_getItem(ctx_parsed_tx, displayIdx, tmpKey, sizeof(tmpKey), tmpValue, sizeof(tmpValue), pageIdx, &pageCount)) diff --git a/tests_zemu/snapshots/fl-mainmenu/00004.png b/tests_zemu/snapshots/fl-mainmenu/00004.png index e99ed851..50f87a8a 100644 Binary files a/tests_zemu/snapshots/fl-mainmenu/00004.png and b/tests_zemu/snapshots/fl-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/s-mainmenu/00004.png b/tests_zemu/snapshots/s-mainmenu/00004.png index 10cd4741..e6299428 100644 Binary files a/tests_zemu/snapshots/s-mainmenu/00004.png and b/tests_zemu/snapshots/s-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/s-mainmenu/00010.png b/tests_zemu/snapshots/s-mainmenu/00010.png index 10cd4741..e6299428 100644 Binary files a/tests_zemu/snapshots/s-mainmenu/00010.png and b/tests_zemu/snapshots/s-mainmenu/00010.png differ diff --git a/tests_zemu/snapshots/sp-mainmenu/00004.png b/tests_zemu/snapshots/sp-mainmenu/00004.png index 44fa345b..b90112c1 100644 Binary files a/tests_zemu/snapshots/sp-mainmenu/00004.png and b/tests_zemu/snapshots/sp-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/sp-mainmenu/00010.png b/tests_zemu/snapshots/sp-mainmenu/00010.png index 44fa345b..b90112c1 100644 Binary files a/tests_zemu/snapshots/sp-mainmenu/00010.png and b/tests_zemu/snapshots/sp-mainmenu/00010.png differ diff --git a/tests_zemu/snapshots/st-mainmenu/00004.png b/tests_zemu/snapshots/st-mainmenu/00004.png index 136bed48..853d40c7 100644 Binary files a/tests_zemu/snapshots/st-mainmenu/00004.png and b/tests_zemu/snapshots/st-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/x-mainmenu/00004.png b/tests_zemu/snapshots/x-mainmenu/00004.png index 44fa345b..b90112c1 100644 Binary files a/tests_zemu/snapshots/x-mainmenu/00004.png and b/tests_zemu/snapshots/x-mainmenu/00004.png differ diff --git a/tests_zemu/snapshots/x-mainmenu/00010.png b/tests_zemu/snapshots/x-mainmenu/00010.png index 44fa345b..b90112c1 100644 Binary files a/tests_zemu/snapshots/x-mainmenu/00010.png and b/tests_zemu/snapshots/x-mainmenu/00010.png differ