fix(solana): break import cycle in types.py
What changed, and why it matters
This is a routine code cleanup that fixes a Python import cycle (two files importing each other) by moving one import to happen only when a specific function runs. There is no security-relevant change visible in the diff.
No security action required. Treat as a normal maintainability/refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit resolves a circular import in the Solana app of Trezor firmware. types.py previously imported parse_pubkey from .transaction.parse at module load time, while transaction/__init__.py imports AddressType from ..types. The cycle is broken by making the parse_pubkey import lazy inside the is_pubkey() method. The functional behavior of is_pubkey() is unchanged.
Changed components
core/src/apps/solana/types.pyInspect captured patch +2 / −1
diff --git a/core/src/apps/solana/types.py b/core/src/apps/solana/types.py
index 61b9722b..e18a1bef 100644
--- a/core/src/apps/solana/types.py
+++ b/core/src/apps/solana/types.py
@@ -1,7 +1,6 @@
from typing import TYPE_CHECKING
from .definitions import Definitions
-from .transaction.parse import parse_pubkey
if TYPE_CHECKING:
from enum import IntEnum
@@ -65,6 +64,8 @@ class PropertyTemplate(Generic[T]):
self.args = args
def is_pubkey(self) -> bool:
+ from .transaction.parse import parse_pubkey
+
return self.parse is parse_pubkey
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.