From d4c59ed98e885de554d2d8919cd6e7988a861f24 Mon Sep 17 00:00:00 2001 From: Sarah GLINER Date: Tue, 22 Aug 2023 11:42:56 +0200 Subject: [PATCH 1/4] sign_psbt: do not display in swap mode --- src/handler/sign_psbt.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/handler/sign_psbt.c b/src/handler/sign_psbt.c index ce793bc70..e7b79ed0a 100644 --- a/src/handler/sign_psbt.c +++ b/src/handler/sign_psbt.c @@ -1274,7 +1274,7 @@ process_outputs(dispatcher_context_t *dc, sign_psbt_state_t *st) { if (!read_outputs(dc, st, &placeholder_info, true)) return false; - if (!ui_transaction_prompt(dc, st->outputs.n_external)) { + if (!G_swap_state.called_from_swap && !ui_transaction_prompt(dc, st->outputs.n_external)) { SEND_SW(dc, SW_DENY); return false; } @@ -2381,7 +2381,9 @@ sign_transaction(dispatcher_context_t *dc, if (n_key_placeholders < 0) { SEND_SW(dc, SW_BAD_STATE); // should never happen - ui_post_processing_confirm_transaction(dc, false); + if (!G_swap_state.called_from_swap) { + ui_post_processing_confirm_transaction(dc, false); + } return false; } @@ -2415,7 +2417,9 @@ sign_transaction(dispatcher_context_t *dc, &input.in_out.map); if (res < 0) { SEND_SW(dc, SW_INCORRECT_DATA); - ui_post_processing_confirm_transaction(dc, false); + if (!G_swap_state.called_from_swap) { + ui_post_processing_confirm_transaction(dc, false); + } return false; } @@ -2428,7 +2432,9 @@ sign_transaction(dispatcher_context_t *dc, if (!sign_transaction_input(dc, st, &hashes, &placeholder_info, &input, i)) { SEND_SW(dc, SW_BAD_STATE); // should never happen - ui_post_processing_confirm_transaction(dc, false); + if (!G_swap_state.called_from_swap) { + ui_post_processing_confirm_transaction(dc, false); + } return false; } } @@ -2437,7 +2443,9 @@ sign_transaction(dispatcher_context_t *dc, ++placeholder_index; } - ui_post_processing_confirm_transaction(dc, true); + if (!G_swap_state.called_from_swap) { + ui_post_processing_confirm_transaction(dc, true); + } return true; } From 3c9779e658482ab5400ed65763c22b245e83f1ff Mon Sep 17 00:00:00 2001 From: Sarah GLINER Date: Wed, 23 Aug 2023 15:29:32 +0200 Subject: [PATCH 2/4] Tests: temporary fix for broken LNX OCR --- .../sign_with_wallet_external_inputs_accept.json | 2 +- tests/test_get_extended_pubkey.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/automations/sign_with_wallet_external_inputs_accept.json b/tests/automations/sign_with_wallet_external_inputs_accept.json index ec97ec579..8111c7984 100644 --- a/tests/automations/sign_with_wallet_external_inputs_accept.json +++ b/tests/automations/sign_with_wallet_external_inputs_accept.json @@ -8,7 +8,7 @@ ] }, { - "regexp": "[S]?pend from|Wallet name|There are|Reject if you're|Review|Amount|Address|Confirm|Fees", + "regexp": "[S]?pend from|Wallet name|There are|Reject if you['-]re|Review|Amount|Address|Confirm|Fees", "actions": [ ["button", 2, true], ["button", 2, false] diff --git a/tests/test_get_extended_pubkey.py b/tests/test_get_extended_pubkey.py index 7abc12b8b..726a9a64f 100644 --- a/tests/test_get_extended_pubkey.py +++ b/tests/test_get_extended_pubkey.py @@ -165,7 +165,12 @@ def ux_thread(): comm.press_and_release("right") comm.wait_for_text_event("Confirm public key") comm.press_and_release("right") - comm.wait_for_text_event("111'/222'/333'") + # Temporary fix for broken OCR + if (model == "nanox"): + comm.wait_for_text_event("111-/222-/333-") + else: + comm.wait_for_text_event("111'/222'/333'") + comm.press_and_release("right") comm.wait_for_text_event("not sure") # second line of "Reject if you're not sure" comm.press_and_release("both") From 16eb6cb88211312491b8f7fc8ae6fd134217d1b6 Mon Sep 17 00:00:00 2001 From: Sarah GLINER Date: Wed, 23 Aug 2023 16:31:45 +0200 Subject: [PATCH 3/4] tests: fixes for stax --- tests/automations/register_wallet_accept.json | 2 +- tests/test_get_extended_pubkey.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/automations/register_wallet_accept.json b/tests/automations/register_wallet_accept.json index da6346d9a..d96348a90 100644 --- a/tests/automations/register_wallet_accept.json +++ b/tests/automations/register_wallet_accept.json @@ -28,7 +28,7 @@ ] }, { - "regexp": "Processing", + "regexp": "Processing|REGISTERED", "actions": [ ["finger", 55, 550, false] ] diff --git a/tests/test_get_extended_pubkey.py b/tests/test_get_extended_pubkey.py index 726a9a64f..48b2ba9be 100644 --- a/tests/test_get_extended_pubkey.py +++ b/tests/test_get_extended_pubkey.py @@ -38,7 +38,7 @@ def ux_thread(): def ux_thread_stax(): event = comm.get_next_event() - while "Approve" not in event["text"]: + while "Approve public key" not in event["text"]: if "Tap to continue" in event["text"]: comm.finger_touch(55, 550) From 56f39db8eb9a882cadeafdc2427f9eb028fc762d Mon Sep 17 00:00:00 2001 From: Sarah GLINER Date: Mon, 28 Aug 2023 10:08:50 +0200 Subject: [PATCH 4/4] ci-workflows: increase timeout --- .github/workflows/ci-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index cf9b663eb..206aa354c 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -138,7 +138,7 @@ jobs: run: | cd tests pip install -r requirements.txt - PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=300 + PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=500 job_test_mainnet: name: Tests on mainnet