From d26aa6d7d489e9e67daf323de0406034437498e6 Mon Sep 17 00:00:00 2001 From: grdddj Date: Thu, 30 Mar 2023 17:42:52 +0200 Subject: [PATCH] core/src: random small improvements --- core/src/apps/cardano/layout.py | 4 +-- core/src/apps/common/passphrase.py | 1 + core/src/apps/debug/__init__.py | 3 ++ core/src/apps/homescreen/res/bg.toif | Bin 9522 -> 0 bytes core/src/boot.py | 4 +-- core/src/trezor/ui/layouts/common.py | 1 + core/src/trezor/ui/layouts/tt_v2/__init__.py | 35 +++++++++---------- core/src/trezor/ui/layouts/tt_v2/reset.py | 6 ++-- core/src/trezor/wire/__init__.py | 8 ++++- 9 files changed, 34 insertions(+), 28 deletions(-) delete mode 100644 core/src/apps/homescreen/res/bg.toif diff --git a/core/src/apps/cardano/layout.py b/core/src/apps/cardano/layout.py index 39da0f3710..450eefb676 100644 --- a/core/src/apps/cardano/layout.py +++ b/core/src/apps/cardano/layout.py @@ -9,6 +9,7 @@ from trezor.enums import ( ) from trezor.strings import format_amount from trezor.ui import layouts +from trezor.ui.layouts import confirm_metadata, confirm_properties from apps.common.paths import address_n_to_str @@ -21,9 +22,6 @@ from .helpers.utils import ( format_stake_pool_id, ) -confirm_metadata = layouts.confirm_metadata # global_import_cache -confirm_properties = layouts.confirm_properties # global_import_cache - if TYPE_CHECKING: from typing import Literal diff --git a/core/src/apps/common/passphrase.py b/core/src/apps/common/passphrase.py index 8ebeed5b04..44ba512b1c 100644 --- a/core/src/apps/common/passphrase.py +++ b/core/src/apps/common/passphrase.py @@ -7,6 +7,7 @@ from trezor.wire import DataError if TYPE_CHECKING: from trezor.wire import Context + _MAX_PASSPHRASE_LEN = const(50) diff --git a/core/src/apps/debug/__init__.py b/core/src/apps/debug/__init__.py index 2759335ebf..eded456425 100644 --- a/core/src/apps/debug/__init__.py +++ b/core/src/apps/debug/__init__.py @@ -122,9 +122,11 @@ if __debug__: if debuglink_decision_chan.putters: log.warning(__name__, "DebugLinkDecision queue is not empty") + x = msg.x # local_cache_attribute y = msg.y # local_cache_attribute + # TT click on specific coordinates, with possible hold if x is not None and y is not None: evt_down = io.TOUCH_START, x, y evt_up = io.TOUCH_END, x, y @@ -133,6 +135,7 @@ if __debug__: loop.schedule(touch_hold(x, y, msg.hold_ms)) else: loop.synthetic_events.append((io.TOUCH, evt_up)) + # Something more general else: debuglink_decision_chan.publish(msg) diff --git a/core/src/apps/homescreen/res/bg.toif b/core/src/apps/homescreen/res/bg.toif deleted file mode 100644 index bfd515f39e284c6aee5e7d601beb01e2f1c6386c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9522 zcmV-2CC%DYPf2Ew0FVGCB>({Bk~@$i$9aG;3Kp0dVE3kB(Z+xb2t?k?c$t-1tl~h6 z**lxGR63K46f(3kF{7$9SPYJ`$+{}Dv>BOEAwy-{s~x-~6=_K&l`mv?;f419?C!w= zdv6{|&tKE;>FNLLuhDqEPq+us7RZcbJQoN#?#ljyS?Jg1vx!%9N0@fwg-=>|4b~?>rd+ot8(bsV<;D z0gdunB-GNcgrmfsI>aQ9Ok&NlMxj&R5^rkRd0bj&0gtr8EKqlFJ_}^FaVN==ERY@4 zHa3TSX`MATqUHE}{>^6Ocwml_eFo921+HkpEY4(qKSz(y99rKDn*61FFMjwvBdFOFG%Z_o&f^$1nUe0Tw5V>WUpR&iX^(9B zrm(?`M!kt@ww%cwPlf&#BCQ>pUXs8fU$tS0EWNMp!T{rr4s{ zu*qwB+4J-$99c6)6wpE|n1K2NhHzV0C?&}q>O^|hH5yN{O{aKA$ome2aFP0RHAmgz z5n=dz=+K=e1?1BTAe&whX!a7l3FeMvARLi|vH_mFx&!esPvmC*WL@p2Wm8h4Oo z>khlYyEe|iq&vvjEQ98j?f9zGUbvbMQ^TjlgS{) zv0gD~BNdO^Bvdj@W%^9#BJjGM|NG1q}DZn_q}Y$mp55 zlV}#1tux7xU7>8qn30Yp6|rc_7?W(-JzDBYuabEt)1=YNGHWrRpea2tF3EzXM$5A% z5t_bBFt#WDoI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RnmWjQ6%RuOE$+?f8_r5yT?Qi#=#|;BSsy5fA+;6Uwm3@{`lh0{iAV7F z{;~3@GwSZ6={nbEkCuGi?*8x=_`?CTUQIr``M7L8`{}Dmta~X7{0p<7Ke9J{M{t2; zqLX2Vb0T~2)nGb5dU!fa2pO3vc~kOD;7zGR-F=^so|SCr46oyC+=(R%9PBEc{N1(RG2w2FkRd`CaFRvbAs!2&q;wWU1(=9ILOdfmDndbR?7>kx!#xl#AoU?1hk#7wuMJv3H|%tH)TXN%2NrG0=MV zU%q<4E#2y#f zqwO0M&7-+;O5tpMYQyx+^rG9eI!?ZUEXa!Fg6Iec=~kkiB33(#tHwyH;6bWow?4tRmjNaqb${^ZrmSt z<7keAVkOh2K8^@E&z`tz$Lz=jI^;~P^=#hn0~XBi`-x%Bw_ zV~jQ{MK* z-P84W#I@|=OWnYohIzlen@{6wd6bR39tmyZ{X?%pCTt9rd~R&T@o?N9*ID3NpHa7F zjhT1jhlyd?Z$Do;>=3gt6_rH7cgH6cc@DWud4wNcw`qs*R_OYNvgoEws$g_$gZb3u_dR@y% zNx>TFwECW&$yO?OW7U zdpNfE!lWFl#y8~goS8c=k;h3%VeXuDG{?1+ujdTR+5Gt%ArTp-#Wn5`0f%UpHQyXI z{6v$QEf;E?WnZwyF)5>q;dT>;WUL!0A#0Jou}`b<4Sb>v7N+Wtjde(Go%5s7`6d(1 zJhp4ZF~zJ$0L$3 zH3$6JSn`X`YgEsb1CI1BuyJgC#*J^$N{w&*gH~Wf7sy1O2Og6unnXl~jdGNuA}UNF z^?Bnv^$?$PYe(fdgTXwM(?t5j0m}%fOdzP;_zpjHZ>V;Ts3jAz None: """Make sure we will show the welcome screen for appropriate amount of time.""" - # Not wasting the time in debug builds (saves time during emulator debugging) - if __debug__: + # Not wasting the time in emulator debug builds (debugging and development) + if __debug__ and utils.EMULATOR: return while utime.ticks_ms() - welcome_screen_start_ms < _WELCOME_SCREEN_MS: utime.sleep_ms(100) diff --git a/core/src/trezor/ui/layouts/common.py b/core/src/trezor/ui/layouts/common.py index 478134ea78..dd721981e4 100644 --- a/core/src/trezor/ui/layouts/common.py +++ b/core/src/trezor/ui/layouts/common.py @@ -38,6 +38,7 @@ async def interact( br_code: ButtonRequestType = ButtonRequestType.Other, ) -> Any: if hasattr(layout, "page_count") and layout.page_count() > 1: # type: ignore [Cannot access member "page_count" for type "LayoutType"] + # We know for certain how many pages the layout will have await button_request(ctx, br_type, br_code, pages=layout.page_count()) # type: ignore [Cannot access member "page_count" for type "LayoutType"] return await ctx.wait(layout) else: diff --git a/core/src/trezor/ui/layouts/tt_v2/__init__.py b/core/src/trezor/ui/layouts/tt_v2/__init__.py index 58783bcecf..bacd9ed3e0 100644 --- a/core/src/trezor/ui/layouts/tt_v2/__init__.py +++ b/core/src/trezor/ui/layouts/tt_v2/__init__.py @@ -131,7 +131,6 @@ class RustLayout(ui.Layout): touch = loop.wait(io.TOUCH) self._first_paint() - # self.layout.bounds() while True: # Using `yield` instead of `await` to avoid allocations. event, x, y = yield touch @@ -142,7 +141,6 @@ class RustLayout(ui.Layout): if msg is not None: raise ui.Result(msg) self._paint() - # self.layout.bounds() def handle_timers(self) -> loop.Task: # type: ignore [awaitable-is-generator] while True: @@ -357,12 +355,12 @@ async def show_address( xpubs: Sequence[str] = (), ) -> None: send_button_request = True + title = ( + "RECEIVE ADDRESS\n(MULTISIG)" + if multisig_index is not None + else "RECEIVE ADDRESS" + ) while True: - title = ( - "RECEIVE ADDRESS\n(MULTISIG)" - if multisig_index is not None - else "RECEIVE ADDRESS" - ) layout = RustLayout( trezorui2.confirm_address( title=title, @@ -388,7 +386,7 @@ async def show_address( # User pressed corner button or swiped left, go to address details. elif result is INFO: - def xpub_title(i: int): + def xpub_title(i: int) -> str: result = f"MULTISIG XPUB #{i + 1}\n" result += "(YOURS)" if i == multisig_index else "(COSIGNER)" return result @@ -775,7 +773,7 @@ def confirm_value( value: str, description: str, br_type: str, - br_code: ButtonRequestType = ButtonRequestType.Other, + br_code: ButtonRequestType = BR_TYPE_OTHER, *, verb: str | None = None, subtitle: str | None = None, @@ -1021,7 +1019,7 @@ async def confirm_coinjoin( ) ), "coinjoin_final", - ButtonRequestType.Other, + BR_TYPE_OTHER, ) ) @@ -1036,7 +1034,7 @@ async def confirm_sign_identity( data=identity, description=challenge_visual + "\n" if challenge_visual else "", br_type="sign_identity", - br_code=ButtonRequestType.Other, + br_code=BR_TYPE_OTHER, ) @@ -1056,7 +1054,7 @@ async def confirm_signverify( title, address, "Confirm address:", - br_code=ButtonRequestType.Other, + br_code=BR_TYPE_OTHER, ) await confirm_blob( @@ -1065,7 +1063,7 @@ async def confirm_signverify( title, message, "Confirm message:", - br_code=ButtonRequestType.Other, + br_code=BR_TYPE_OTHER, ) @@ -1139,9 +1137,8 @@ async def request_pin_on_device( wrong_pin=wrong_pin, ) ) - while True: - result = await ctx.wait(dialog) - if result is CANCELLED: - raise PinCancelled - assert isinstance(result, str) - return result + result = await ctx.wait(dialog) + if result is CANCELLED: + raise PinCancelled + assert isinstance(result, str) + return result diff --git a/core/src/trezor/ui/layouts/tt_v2/reset.py b/core/src/trezor/ui/layouts/tt_v2/reset.py index ec45ba1bc5..93e8203de1 100644 --- a/core/src/trezor/ui/layouts/tt_v2/reset.py +++ b/core/src/trezor/ui/layouts/tt_v2/reset.py @@ -9,7 +9,7 @@ from ..common import interact from . import RustLayout if TYPE_CHECKING: - from typing import Callable, Sequence, List + from typing import Callable, Sequence from trezor.enums import BackupType from trezor.wire import GenericContext @@ -17,8 +17,8 @@ if TYPE_CHECKING: CONFIRMED = trezorui2.CONFIRMED # global_import_cache -def _split_share_into_pages(share_words: Sequence[str], per_page: int = 4) -> List[str]: - pages = [] +def _split_share_into_pages(share_words: Sequence[str], per_page: int = 4) -> list[str]: + pages: list[str] = [] current = "" for i, word in enumerate(share_words): diff --git a/core/src/trezor/wire/__init__.py b/core/src/trezor/wire/__init__.py index 607c605578..30d336917f 100644 --- a/core/src/trezor/wire/__init__.py +++ b/core/src/trezor/wire/__init__.py @@ -466,7 +466,13 @@ def failure(exc: BaseException) -> Failure: elif isinstance(exc, InvalidSessionError): return Failure(code=FailureType.InvalidSession, message="Invalid session") else: - return Failure(code=FailureType.FirmwareError, message="Firmware error") + # NOTE: when receiving generic `FirmwareError` on non-debug build, + # change the `if __debug__` to `if True` to get the full error message. + if __debug__: + message = f"Firmware error - {exc}" + else: + message = "Firmware error" + return Failure(code=FailureType.FirmwareError, message=message) def unexpected_message() -> Failure: