chore: remove unused ThpError - INVALID_DATA [no changelog]
What changed, and why it matters
This commit simply removes an unused error code named INVALID_DATA from the Trezor hardware wallet's new THP (Trezor Host Protocol) code. It deletes the numeric constant, the matching Python exception class, and the mapping that translated the error number into that exception. There is no change to how data is validated or how errors are handled; it only cleans up code that was never referenced.
No action required. This is a benign cleanup commit and can be treated as routine maintenance.
Security signals we found
No security-relevant behavioral change
Removal of dead/unreferenced error code only
No input parsing, validation, or cryptographic code modified
Evidence from the diff
The change is a pure code-cleanup chore across three files: core/src/trezor/wire/thp/init.py drops the ThpErrorType.INVALID_DATA enum member (value 4); python/src/trezorlib/exceptions.py removes the InvalidData(ThpError) class; and python/src/trezorlib/transport/thp/protocol_v2.py removes the _ERRORS_MAP entry mapping code 4 to that exception. No functional logic, parsing, validation, or error-handling paths are modified. The commit message explicitly labels it as a chore with ‘[no changelog]’.
Changed components
core/src/trezor/wire/thp/__init__.pypython/src/trezorlib/exceptions.pypython/src/trezorlib/transport/thp/protocol_v2.pyInspect captured patch +0 / −6
diff --git a/core/src/trezor/wire/thp/__init__.py b/core/src/trezor/wire/thp/__init__.py
index 56c32e20..9ebc1fce 100644
--- a/core/src/trezor/wire/thp/__init__.py
+++ b/core/src/trezor/wire/thp/__init__.py
@@ -58,7 +58,6 @@ class ThpErrorType(IntEnum):
TRANSPORT_BUSY = 1
UNALLOCATED_CHANNEL = 2
DECRYPTION_FAILED = 3
- INVALID_DATA = 4
DEVICE_LOCKED = 5
diff --git a/python/src/trezorlib/exceptions.py b/python/src/trezorlib/exceptions.py
index 81faf337..3c591a2f 100644
--- a/python/src/trezorlib/exceptions.py
+++ b/python/src/trezorlib/exceptions.py
@@ -121,10 +121,6 @@ class DecryptionFailed(ThpError):
pass
-class InvalidData(ThpError):
- pass
-
-
class DeviceLocked(ThpError):
pass
diff --git a/python/src/trezorlib/transport/thp/protocol_v2.py b/python/src/trezorlib/transport/thp/protocol_v2.py
index 2d85b6c6..28f8f690 100644
--- a/python/src/trezorlib/transport/thp/protocol_v2.py
+++ b/python/src/trezorlib/transport/thp/protocol_v2.py
@@ -412,6 +412,5 @@ _ERRORS_MAP = {
1: exceptions.TransportBusy,
2: exceptions.UnallocatedChannel,
3: exceptions.DecryptionFailed,
- 4: exceptions.InvalidData,
5: exceptions.DeviceLocked,
}
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.