From 7f91bc571ca59d30fe8b7a8fd80a67b37a8e5c18 Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 28 Feb 2020 15:55:17 +0100 Subject: [PATCH] core: ensure default task restarts after a passphrase workflow (fixes #883) --- core/src/apps/common/passphrase.py | 3 ++- core/src/trezor/ui/__init__.py | 9 +++++++++ .../test_msg_cardano_get_address_slip39_basic.py | 1 + .../test_msg_cardano_get_public_key_slip39_basic.py | 1 + tests/ui_tests/fixtures.json | 6 ------ 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/core/src/apps/common/passphrase.py b/core/src/apps/common/passphrase.py index a3f7bf91d2..50eec959d8 100644 --- a/core/src/apps/common/passphrase.py +++ b/core/src/apps/common/passphrase.py @@ -1,7 +1,7 @@ from micropython import const import storage.device -from trezor import wire +from trezor import wire, workflow from trezor.messages import ButtonRequestType from trezor.messages.ButtonAck import ButtonAck from trezor.messages.ButtonRequest import ButtonRequest @@ -75,6 +75,7 @@ async def _request_on_device(ctx: wire.Context) -> str: def _entry_dialog() -> None: + workflow.kill_default() text = Text("Passphrase entry", ICON_CONFIG) text.normal("Please type your", "passphrase on the", "connected host.") draw_simple(text) diff --git a/core/src/trezor/ui/__init__.py b/core/src/trezor/ui/__init__.py index 256e7a5347..4d8a672e69 100644 --- a/core/src/trezor/ui/__init__.py +++ b/core/src/trezor/ui/__init__.py @@ -161,6 +161,15 @@ def header_error(message: str, clear: bool = True) -> None: def draw_simple(t: Component) -> None: # noqa: F405 + """Render a component synchronously. + + Useful when you need to put something on screen and go on to do other things. + + This function bypasses the UI workflow engine, so other layouts will not know + that something was drawn over them. In particular, if no other Layout is shown + in a workflow, the homescreen will not redraw when the workflow is finished. + Use `workflow.kill_default()` if you need to avoid this situation. + """ backlight_fade(style.BACKLIGHT_DIM) display.clear() t.on_render() diff --git a/tests/device_tests/test_msg_cardano_get_address_slip39_basic.py b/tests/device_tests/test_msg_cardano_get_address_slip39_basic.py index 765419912e..159a8a0ac2 100644 --- a/tests/device_tests/test_msg_cardano_get_address_slip39_basic.py +++ b/tests/device_tests/test_msg_cardano_get_address_slip39_basic.py @@ -25,6 +25,7 @@ from ..common import MNEMONIC_SLIP39_BASIC_20_3of6 @pytest.mark.altcoin @pytest.mark.cardano @pytest.mark.skip_t1 # T1 support is not planned +@pytest.mark.skip_ui @pytest.mark.parametrize( "path,expected_address", [ diff --git a/tests/device_tests/test_msg_cardano_get_public_key_slip39_basic.py b/tests/device_tests/test_msg_cardano_get_public_key_slip39_basic.py index 48997326ae..1d28c5f5d2 100644 --- a/tests/device_tests/test_msg_cardano_get_public_key_slip39_basic.py +++ b/tests/device_tests/test_msg_cardano_get_public_key_slip39_basic.py @@ -25,6 +25,7 @@ from ..common import MNEMONIC_SLIP39_BASIC_20_3of6 @pytest.mark.altcoin @pytest.mark.cardano @pytest.mark.skip_t1 # T1 support is not planned +@pytest.mark.skip_ui @pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_BASIC_20_3of6, passphrase=True) @pytest.mark.parametrize( "path,public_key,chain_code", diff --git a/tests/ui_tests/fixtures.json b/tests/ui_tests/fixtures.json index bb2aa839b1..2950723761 100644 --- a/tests/ui_tests/fixtures.json +++ b/tests/ui_tests/fixtures.json @@ -24,16 +24,10 @@ "test_msg_cardano_get_address.py::test_cardano_get_address[m-44'-1815'-0'-0-0-Ae2tdPwUPEZLCq3sFv4wVYx": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586", "test_msg_cardano_get_address.py::test_cardano_get_address[m-44'-1815'-0'-0-1-Ae2tdPwUPEZEY6pVJoyuNNd": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586", "test_msg_cardano_get_address.py::test_cardano_get_address[m-44'-1815'-0'-0-2-Ae2tdPwUPEZ3gZD1QeUHvAq": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586", -"test_msg_cardano_get_address_slip39_basic.py::test_cardano_get_address[m-44'-1815'-0'-0-0-Ae2tdPwUPE": "d2d6aac0a4605f1a961580f0fc156e7b69b993f908906281313429fa3222f349", -"test_msg_cardano_get_address_slip39_basic.py::test_cardano_get_address[m-44'-1815'-0'-0-1-Ae2tdPwUPE": "d2d6aac0a4605f1a961580f0fc156e7b69b993f908906281313429fa3222f349", -"test_msg_cardano_get_address_slip39_basic.py::test_cardano_get_address[m-44'-1815'-0'-0-2-Ae2tdPwUPE": "d2d6aac0a4605f1a961580f0fc156e7b69b993f908906281313429fa3222f349", "test_msg_cardano_get_public_key.py::test_cardano_get_public_key[m-44'-1815'-0'-c0fce1839f1a84c4e7702": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586", "test_msg_cardano_get_public_key.py::test_cardano_get_public_key[m-44'-1815'-1'-ea5dde31b9f551e08a5b6": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586", "test_msg_cardano_get_public_key.py::test_cardano_get_public_key[m-44'-1815'-2'-076338cee5ab3dae19f06": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586", "test_msg_cardano_get_public_key.py::test_cardano_get_public_key[m-44'-1815'-3'-5f769380dc6fd17a4e0f2": "5a80508a71a9ef64f94762b07636f90e464832f0f4a3102af8fa1a8c69e94586", -"test_msg_cardano_get_public_key_slip39_basic.py::test_cardano_get_public_key[m-44'-1815'-0'-0-0-bc04": "d2d6aac0a4605f1a961580f0fc156e7b69b993f908906281313429fa3222f349", -"test_msg_cardano_get_public_key_slip39_basic.py::test_cardano_get_public_key[m-44'-1815'-0'-0-1-24c4": "d2d6aac0a4605f1a961580f0fc156e7b69b993f908906281313429fa3222f349", -"test_msg_cardano_get_public_key_slip39_basic.py::test_cardano_get_public_key[m-44'-1815'-0'-0-2-831a": "d2d6aac0a4605f1a961580f0fc156e7b69b993f908906281313429fa3222f349", "test_msg_cardano_sign_transaction.py::test_cardano_sign_tx[1097911063-inputs2-outputs2-transactions2": "1a8eade03d9c0ecbbb01567e5e9d46187a2ffe7fa42d59eb711347a7fe3b5bb7", "test_msg_cardano_sign_transaction.py::test_cardano_sign_tx[764824073-inputs0-outputs0-transactions0-": "07eceef966cb8069381dc5105b732bce6de8d207a1d27e56e8abddd57c307b22", "test_msg_cardano_sign_transaction.py::test_cardano_sign_tx[764824073-inputs1-outputs1-transactions1-": "4c74546cacb2b99b9aeb6e134d99c0d1d6f0ba1818d1182364cfdb94b938ccc5",