From 42df05750fa4a1127b56dd1a9fb9f77ece15c647 Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Mon, 18 Nov 2024 14:26:19 +0100 Subject: [PATCH] fixup! feat(core): implement thp context and cache --- core/src/trezor/wire/message_handler.py | 3 +-- core/src/trezor/wire/thp/session_context.py | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/core/src/trezor/wire/message_handler.py b/core/src/trezor/wire/message_handler.py index 799d9c5b7..ad66c732a 100644 --- a/core/src/trezor/wire/message_handler.py +++ b/core/src/trezor/wire/message_handler.py @@ -15,11 +15,10 @@ from trezor.wire.errors import * # isort:skip # noqa: F401,F403 if TYPE_CHECKING: - from typing import Any, Callable, Container + from typing import Callable, Container from trezor.wire import Handler, LoadedMessageType, WireInterface - HandlerFinder = Callable[[Any, Any], Handler | None] Filter = Callable[[int, Handler], Handler] # If set to False protobuf messages marked with "experimental_message" option are rejected. diff --git a/core/src/trezor/wire/thp/session_context.py b/core/src/trezor/wire/thp/session_context.py index 6b917f52d..688fa46b3 100644 --- a/core/src/trezor/wire/thp/session_context.py +++ b/core/src/trezor/wire/thp/session_context.py @@ -5,7 +5,7 @@ from storage.cache_thp import MANAGEMENT_SESSION_ID, SessionThpCache from trezor import log, loop, protobuf, utils from trezor.wire import message_handler, protocol_common from trezor.wire.context import UnexpectedMessageException -from trezor.wire.message_handler import failure, find_handler +from trezor.wire.message_handler import failure from ..protocol_common import Context, Message from . import SessionState @@ -15,7 +15,6 @@ if TYPE_CHECKING: from storage.cache_common import DataCache - from ..message_handler import HandlerFinder from .channel import Channel pass @@ -34,7 +33,6 @@ class GenericSessionContext(Context): self.channel: Channel = channel self.session_id: int = session_id self.incoming_message = loop.mailbox() - self.handler_finder: HandlerFinder = find_handler async def handle(self) -> None: if __debug__ and utils.ALLOW_DEBUG_MESSAGES: