chore(core): remove unused `context.maybe_call()`
What changed, and why it matters
This commit simply deletes an unused helper function called maybe_call() from the Trezor firmware's internal communication code. The function had no remaining callers, so removing it cannot introduce or fix any security issue. It is a routine code cleanup with no user-visible or security-relevant change.
No action needed. This is a non-security cleanup commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff removes the async function maybe_call() from core/src/trezor/wire/context.py. The commit message states its last caller was removed in an earlier commit (2ddca8ec1d942d077e400eac55fc363385259ff0). The function conditionally sent a protobuf message to the host only when a current wire context existed. Because the function is now dead code, its deletion has no runtime effect and does not alter any security boundary, parsing, or protocol behavior.
Changed components
core/src/trezor/wire/context.pyInspect captured patch +0 / −18
diff --git a/core/src/trezor/wire/context.py b/core/src/trezor/wire/context.py
index d424a5d0..f0469e2a 100644
--- a/core/src/trezor/wire/context.py
+++ b/core/src/trezor/wire/context.py
@@ -7,10 +7,6 @@ context.
To avoid the need to pass a context object around, the context is stored in a
pseudo-global manner: any workflow handler can request access to the context via this
module, and the appropriate context object will be used for it.
-
-Some workflows don't need a context to exist. This is supported by the `maybe_call`
-function, which will silently ignore the call if no context is available. Useful mainly
-for ButtonRequests. Of course, `context.wait()` transparently works in such situations.
"""
from typing import TYPE_CHECKING
@@ -89,20 +85,6 @@ async def call_any(
return await CURRENT_CONTEXT.read(expected_wire_types)
-async def maybe_call(
- msg: protobuf.MessageType, expected_type: type[LoadedMessageType]
-) -> None:
- """Send a message to the host and read but ignore the response.
-
- If there is a context, the function still checks that the response is of the
- requested type. If there is no context, the call is ignored.
- """
- if CURRENT_CONTEXT is None:
- return
-
- await call(msg, expected_type)
-
-
def get_context() -> Context:
"""Get the current session context.
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.