chore(core): rename `ButtonRequest` handling task
What changed, and why it matters
This is a routine code cleanup: a function is renamed from _handle_usb_iface to _handle_button_requests because it now handles button request messages, not just USB interface messages. A local variable is introduced for clarity. There is no security change.
No action needed; this is a non-functional refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit renames an async helper method in core/src/trezor/ui/init.py and splits a loop.race() call into a named variable for readability. The control flow and behavior are unchanged: the task still races context.read(()) against button_request_box and processes button requests. No security logic is modified.
Changed components
core/src/trezor/ui/__init__.pyInspect captured patch +5 / −6
diff --git a/core/src/trezor/ui/__init__.py b/core/src/trezor/ui/__init__.py
index 3ad96c15f..f3ea769f9 100644
--- a/core/src/trezor/ui/__init__.py
+++ b/core/src/trezor/ui/__init__.py
@@ -251,7 +251,7 @@ class Layout(Generic[T]):
# else we are (a) still running or (b) already finished
try:
if self.context is not None and self.result_box.is_empty():
- self._start_task(self._handle_usb_iface())
+ self._start_task(self._handle_button_requests())
return await self.result_box
finally:
self.stop()
@@ -423,15 +423,14 @@ class Layout(Generic[T]):
finally:
touch.close()
- async def _handle_usb_iface(self) -> None:
+ async def _handle_button_requests(self) -> None:
if self.context is None:
return
while True:
try:
- result = await loop.race(
- self.context.read(()),
- self.button_request_box,
- )
+ # The following task will raise `UnexpectedMessageException` on any message.
+ unexpected_read = self.context.read(())
+ result = await loop.race(unexpected_read, self.button_request_box)
assert isinstance(result, tuple)
br_code, br_name = result
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.