refactor(core): move Caesar-specific recovery confirmation layout
What changed, and why it matters
This commit is a straightforward code cleanup: it moves a confirmation screen that appears during wallet recovery from one file to another, so the same screen is still shown but in a more appropriate place. There is no security-relevant change.
No security action needed; this is a benign refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change refactors where the Caesar UI layout shows a pre-recovery confirmation dialog. Previously, homescreen.py checked utils.UI_LAYOUT == "CAESAR" and called layout.homescreen_dialog(...) before invoking layout.request_word_count(...). Now, that dialog call is moved inside trezor/ui/layouts/caesar/recovery.py’s request_word_count() implementation. The user-visible behavior on Caesar devices remains identical; non-Caesar devices were unaffected before and remain unaffected. The diff also includes a trivial comment capitalization fix.
Changed components
core/src/apps/management/recovery_device/homescreen.pycore/src/apps/management/recovery_device/layout.pycore/src/trezor/ui/layouts/caesar/recovery.pyInspect captured patch +7 / −10
diff --git a/core/src/apps/management/recovery_device/homescreen.py b/core/src/apps/management/recovery_device/homescreen.py
index d6b1face..763a62f3 100644
--- a/core/src/apps/management/recovery_device/homescreen.py
+++ b/core/src/apps/management/recovery_device/homescreen.py
@@ -90,7 +90,6 @@ async def _continue_repeated_backup() -> None:
async def _continue_recovery_process() -> Success:
- from trezor import utils
from trezor.enums import RecoveryType
from trezor.errors import MnemonicError
@@ -115,14 +114,6 @@ async def _continue_recovery_process() -> Success:
while secret is None:
if is_first_step:
# If we are starting recovery, ask for word count first...
- # _request_word_count
- # For others than Caesar (TS3), just continue straight to word count keyboard
- # pylint: disable-next=consider-using-in
- if utils.UI_LAYOUT == "CAESAR":
- await layout.homescreen_dialog(
- TR.buttons__continue, TR.recovery__num_of_words
- )
- # ask for the number of words
try:
word_count = await layout.request_word_count(recovery_type)
except wire.ActionCancelled:
diff --git a/core/src/apps/management/recovery_device/layout.py b/core/src/apps/management/recovery_device/layout.py
index 88d25e33..f8432613 100644
--- a/core/src/apps/management/recovery_device/layout.py
+++ b/core/src/apps/management/recovery_device/layout.py
@@ -75,7 +75,7 @@ async def request_mnemonic(
i += 1
non_empty_words = [word for word in words if word]
- # raises `WordValidityResult` on error.
+ # Raises `WordValidityResult` on error.
word_validity.check(backup_type, non_empty_words)
return " ".join(words)
diff --git a/core/src/trezor/ui/layouts/caesar/recovery.py b/core/src/trezor/ui/layouts/caesar/recovery.py
index 0cfa4017..55e1e6e4 100644
--- a/core/src/trezor/ui/layouts/caesar/recovery.py
+++ b/core/src/trezor/ui/layouts/caesar/recovery.py
@@ -16,6 +16,12 @@ if TYPE_CHECKING:
async def request_word_count(recovery_type: RecoveryType) -> int:
+ from apps.management.recovery_device.layout import homescreen_dialog
+
+ # Show confirmation screen before choosing the number of words
+ # May raise `RecoveryAborted`
+ await homescreen_dialog(TR.buttons__continue, TR.recovery__num_of_words)
+
count = await interact(
trezorui_api.select_word_count(recovery_type=recovery_type),
"recovery_word_count",
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.