test(core): de-duplicate backup success confirmation
What changed, and why it matters
This commit only changes test helper code in a single Python file. It removes duplicated button-press confirmations after backup/recovery flows and moves the final 'success_backup' confirmation into a shared helper function. There is no change to the actual Trezor firmware or wallet behavior, so it cannot affect real users' funds or security.
No security action needed. Treat as routine test-code maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff refactors tests/input_flows.py. The load_N_shares() helper now handles both per-share ‘success_share_confirm’ / ‘success_recovery’ confirmations and the final ‘success_backup’ confirmation, depending on layout type and share count. Callers such as InputFlowSlip39BasicBackup and InputFlowSlip39CustomBackup had their redundant final confirmation blocks removed. get_mnemonic() now delegates to load_N_shares(debug, n=1). No firmware, crypto, or runtime device code is modified.
Changed components
tests/input_flows.pyInspect captured patch +17 / −65
diff --git a/tests/input_flows.py b/tests/input_flows.py
index bc829493..d523fb60 100644
--- a/tests/input_flows.py
+++ b/tests/input_flows.py
@@ -1796,20 +1796,7 @@ class InputFlowEthereumSignTxStaking(InputFlowBase):
def get_mnemonic(debug: DebugLink) -> Generator[None, "messages.ButtonRequest", str]:
"""Used for BIP39 or SLIP-39 1-of-1 backup."""
# mnemonic phrases
- mnemonic = yield from read_and_confirm_mnemonic(debug)
-
- if debug.layout_type in (LayoutType.Bolt, LayoutType.Caesar):
- br = yield # confirm recovery share check
- assert br.code == B.Success
- assert br.name == "success_share_confirm"
- debug.press_yes()
-
- br = yield
- assert br.code == B.Success
- assert br.name == "success_backup"
- debug.press_yes()
-
- assert mnemonic is not None
+ [mnemonic] = yield from load_N_shares(debug, n=1)
return mnemonic
@@ -1983,15 +1970,28 @@ def load_N_shares(
mnemonic = yield from read_and_confirm_mnemonic(debug)
assert mnemonic is not None
mnemonics.append(mnemonic)
- br = yield # Confirm continue to next
- assert br.code == B.Success
- debug.press_yes()
+
+ if n > 1 or debug.layout_type in (LayoutType.Bolt, LayoutType.Caesar):
+ expected_br_name = "success_share_confirm"
+ if debug.layout_type is LayoutType.Eckhart:
+ expected_br_name = "success_recovery"
+
+ br = yield # Confirm continue to next
+ assert br.code == B.Success
+ assert br.name == expected_br_name
+ debug.press_yes()
+
elif method is messages.BackupMethod.N4W1:
assert (yield).name == "backup_write"
mnemonics.append(n4w1_handle_write(debug).decode())
else:
raise RuntimeError
+ br = yield
+ assert br.code == B.Success
+ assert br.name == "success_backup"
+ debug.press_yes()
+
return mnemonics
@@ -2039,10 +2039,6 @@ class InputFlowSlip39BasicBackup(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 5)
- br = yield # Confirm backup
- assert br.code == B.Success
- self.debug.press_yes()
-
def input_flow_caesar(self) -> BRGeneratorType:
assert self.method is messages.BackupMethod.Display
if self.repeated:
@@ -2072,10 +2068,6 @@ class InputFlowSlip39BasicBackup(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 5)
- br = yield # Confirm backup
- assert br.code == B.Success
- self.debug.press_yes()
-
def input_flow_delizia(self) -> BRGeneratorType:
assert self.method is messages.BackupMethod.Display
if self.repeated:
@@ -2105,10 +2097,6 @@ class InputFlowSlip39BasicBackup(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 5)
- br = yield # Confirm backup
- assert br.code == B.Success
- self.debug.press_yes()
-
def input_flow_eckhart(self) -> BRGeneratorType:
assert self.method in (
messages.BackupMethod.Display,
@@ -2145,10 +2133,6 @@ class InputFlowSlip39BasicBackup(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 5, self.method)
- br = yield # Confirm backup
- assert br.code == B.Success
- self.debug.press_yes()
-
class InputFlowSlip39BasicResetRecovery(InputFlowBase):
def __init__(
@@ -2176,10 +2160,6 @@ class InputFlowSlip39BasicResetRecovery(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 5)
- br = yield # safety warning
- assert br.code == B.Success
- self.debug.press_yes()
-
def input_flow_caesar(self) -> BRGeneratorType:
assert self.method is messages.BackupMethod.Display
yield # Confirm Reset
@@ -2208,10 +2188,6 @@ class InputFlowSlip39BasicResetRecovery(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 5)
- br = yield # Confirm backup
- assert br.code == B.Success
- self.debug.press_yes()
-
def input_flow_delizia(self) -> BRGeneratorType:
assert self.method is messages.BackupMethod.Display
# 1. Confirm Reset
@@ -2229,10 +2205,6 @@ class InputFlowSlip39BasicResetRecovery(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 5)
- br = yield # success screen
- assert br.code == B.Success
- self.debug.press_yes()
-
def input_flow_eckhart(self) -> BRGeneratorType:
num_screens = {
messages.BackupMethod.Display: 10,
@@ -2253,10 +2225,6 @@ class InputFlowSlip39BasicResetRecovery(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, 5, self.method)
- br = yield # success screen
- assert br.code == B.Success
- self.debug.press_yes()
-
class InputFlowSlip39CustomBackup(InputFlowBase):
def __init__(
@@ -2291,10 +2259,6 @@ class InputFlowSlip39CustomBackup(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, self.share_count)
- br = yield # Confirm backup
- assert br.code == B.Success
- self.debug.press_yes()
-
def input_flow_caesar(self) -> BRGeneratorType:
assert self.backup_method is messages.BackupMethod.Display
if self.repeated:
@@ -2314,10 +2278,6 @@ class InputFlowSlip39CustomBackup(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, self.share_count)
- br = yield # Confirm backup
- assert br.code == B.Success
- self.debug.press_yes()
-
def input_flow_delizia(self) -> BRGeneratorType:
assert self.backup_method is messages.BackupMethod.Display
if self.repeated:
@@ -2337,10 +2297,6 @@ class InputFlowSlip39CustomBackup(InputFlowBase):
# Mnemonic phrases
self.mnemonics = yield from load_N_shares(self.debug, self.share_count)
- br = yield # Confirm backup
- assert br.code == B.Success
- self.debug.press_yes()
-
def input_flow_eckhart(self) -> BRGeneratorType:
if self.repeated:
yield
@@ -2368,10 +2324,6 @@ class InputFlowSlip39CustomBackup(InputFlowBase):
self.debug, self.share_count, self.backup_method
)
- br = yield # Confirm backup
- assert br.code == B.Success
- self.debug.press_yes()
-
def load_5_groups_5_shares(
debug: DebugLink,
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.