From 99457bbcb0c7fa4df1fe278c9cb6e3bee12b1d53 Mon Sep 17 00:00:00 2001 From: matejcik Date: Thu, 29 Feb 2024 12:13:20 +0100 Subject: [PATCH] refactor(core/ui): make request_number signature the same in TT and TR --- core/embed/rust/src/ui/model_tr/layout.rs | 2 +- core/src/trezor/ui/layouts/tr/reset.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/embed/rust/src/ui/model_tr/layout.rs b/core/embed/rust/src/ui/model_tr/layout.rs index 6381256ffa..1d4f4e6238 100644 --- a/core/embed/rust/src/ui/model_tr/layout.rs +++ b/core/embed/rust/src/ui/model_tr/layout.rs @@ -157,7 +157,7 @@ where impl ComponentMsgObj for NumberInput { fn msg_try_into_obj(&self, msg: Self::Msg) -> Result { - msg.try_into() + (CONFIRMED.as_obj(), msg.try_into()?).try_into() } } diff --git a/core/src/trezor/ui/layouts/tr/reset.py b/core/src/trezor/ui/layouts/tr/reset.py index 3a6511479c..28397f1179 100644 --- a/core/src/trezor/ui/layouts/tr/reset.py +++ b/core/src/trezor/ui/layouts/tr/reset.py @@ -161,7 +161,15 @@ async def _prompt_number( ButtonRequestType.ResetDevice, ) - return int(result) + if __debug__: + if isinstance(result, str): + # debuglink for TR sends a string representing the number + result = CONFIRMED, int(result) + status, value = result + + assert status is CONFIRMED + assert isinstance(value, int) + return value async def slip39_prompt_threshold(