test(core): update `InputFlowEIP712ShowMore`
What changed, and why it matters
This commit only updates an automated test helper for Trezor hardware wallets. It makes the test script more precise about which on-screen prompts it expects during EIP-712 typed-data signing flows. There is no change to the firmware, wallet logic, or any code that runs on a real device during normal use.
No security action needed. Treat as routine test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies two test-only files: python/src/trezorlib/testing/common.py and tests/input_flows.py. It adds an optional br_name parameter to swipe_if_necessary() and updates InputFlowEIP712ShowMore to assert specific ButtonRequest names (confirm_address, confirm_typed_value, should_show_struct, confirm_typed_data_final) instead of blindly yielding through the flow. This is a test-maintenance change with no production security relevance.
Changed components
tests/input_flows.pypython/src/trezorlib/testing/common.pyInspect captured patch +23 / −16
diff --git a/python/src/trezorlib/testing/common.py b/python/src/trezorlib/testing/common.py
index f3601f8b..e9caa92a 100644
--- a/python/src/trezorlib/testing/common.py
+++ b/python/src/trezorlib/testing/common.py
@@ -1,4 +1,4 @@
-from typing import TYPE_CHECKING, Generator, Union
+from typing import TYPE_CHECKING, Generator, Optional
from .. import messages
from ..debuglink import LayoutType
@@ -37,7 +37,9 @@ def get_text_possible_pagination(debug: "DebugLink", br: messages.ButtonRequest)
def swipe_if_necessary(
- debug: "DebugLink", br_code: Union[messages.ButtonRequestType, None] = None
+ debug: "DebugLink",
+ br_code: Optional[messages.ButtonRequestType] = None,
+ br_name: Optional[str] = None,
) -> BRGeneratorType:
"""
Generator that swipes through pages if necessary, based on button request code.
@@ -52,6 +54,8 @@ def swipe_if_necessary(
br = yield
if br_code is not None:
assert br.code == br_code
+ if br_name is not None:
+ assert br.name == br_name
swipe_till_the_end(debug, br)
diff --git a/tests/input_flows.py b/tests/input_flows.py
index bf621836..42843e62 100644
--- a/tests/input_flows.py
+++ b/tests/input_flows.py
@@ -1640,40 +1640,43 @@ class InputFlowEIP712ShowMore(InputFlowBase):
def input_flow_common(self) -> BRGeneratorType:
"""Triggers show more wherever possible"""
- yield # confirm address
+ assert (yield).name == "confirm_address" # confirm address
self.debug.press_yes()
- # confirm domain properties
- for _ in range(4):
- yield from swipe_if_necessary(self.debug) # EIP712 DOMAIN
- self.debug.press_yes()
+ # confirm EIP712 domain properties
+ yield from swipe_if_necessary(
+ self.debug, br_name="confirm_typed_value", br_code=B.Other
+ )
+ self.debug.press_yes()
- yield # confirm message
- self.debug.read_layout()
+ assert (yield).name == "should_show_struct" # confirm message
self._confirm_show_more()
- yield # confirm message.from
- self.debug.read_layout()
+ assert (yield).name == "should_show_struct" # confirm message.from
self._confirm_show_more()
# confirm message.from properties
for _ in range(2):
- yield from swipe_if_necessary(self.debug)
+ yield from swipe_if_necessary(
+ self.debug, br_name="confirm_typed_value", br_code=B.Other
+ )
self.debug.press_yes()
- yield # confirm message.to
+ assert (yield).name == "should_show_struct" # confirm message.to
self.debug.read_layout()
self._confirm_show_more()
# confirm message.to properties
for _ in range(2):
- yield from swipe_if_necessary(self.debug)
+ yield from swipe_if_necessary(
+ self.debug, br_name="confirm_typed_value", br_code=B.Other
+ )
self.debug.press_yes()
- yield # confirm message.contents
+ assert (yield).name == "confirm_typed_value" # confirm message.contents
self.debug.press_yes()
- yield # confirm final hash
+ assert (yield).name == "confirm_typed_data_final" # confirm final hash
self.debug.press_yes()
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.