chore(core): minor annotation and docstring fix
What changed, and why it matters
This commit only fixes whitespace in documentation comments and makes a minor type annotation change (using a more general AnyBytes type alias instead of bytes). There is no change to actual program logic, no bug fix, and no security relevance.
No security action needed. This is a cosmetic/documentation commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff consists entirely of docstring/comment indentation corrections in C header files and their generated Python stub files, plus a TYPE_CHECKING-only annotation change from bytes to AnyBytes in core/src/apps/common/paths.py. No executable code, memory handling, cryptographic operations, or input validation is modified.
Changed components
core/embed/upymod/modtrezorapp/modtrezorapp-image.hcore/embed/upymod/modtrezorcrypto/modtrezorcrypto-cardano.hcore/embed/upymod/modtrezorio/modtrezorio-pm.hcore/embed/upymod/modtrezorutils/modtrezorutils-meminfo.hcore/mocks/generated/trezorapp/__init__.pyicore/mocks/generated/trezorcrypto/cardano.pyicore/mocks/generated/trezorio/pm.pyicore/mocks/generated/trezorutils.pyicore/src/apps/common/paths.pyInspect captured patch +29 / −26
diff --git a/core/embed/upymod/modtrezorapp/modtrezorapp-image.h b/core/embed/upymod/modtrezorapp/modtrezorapp-image.h
index 1bef6d19..334f5703 100644
--- a/core/embed/upymod/modtrezorapp/modtrezorapp-image.h
+++ b/core/embed/upymod/modtrezorapp/modtrezorapp-image.h
@@ -58,9 +58,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_trezorapp_AppImage_write_obj,
/// def finalize(self, bool accept) -> None:
/// """
-/// Finalizes loading of the application image. If `accept` is true,
-/// the image is marked as loaded and will be available for execution.
-/// If `accept` is false, the image is discarded.
+/// Finalizes loading of the application image. If `accept` is true,
+/// the image is marked as loaded and will be available for execution.
+/// If `accept` is false, the image is discarded.
/// """
STATIC mp_obj_t mod_trezorapp_AppImage_finalize(mp_obj_t self,
mp_obj_t accept_obj) {
diff --git a/core/embed/upymod/modtrezorcrypto/modtrezorcrypto-cardano.h b/core/embed/upymod/modtrezorcrypto/modtrezorcrypto-cardano.h
index a7eadca6..e8211fc0 100644
--- a/core/embed/upymod/modtrezorcrypto/modtrezorcrypto-cardano.h
+++ b/core/embed/upymod/modtrezorcrypto/modtrezorcrypto-cardano.h
@@ -121,9 +121,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorcrypto_from_secret_obj,
mod_trezorcrypto_from_secret);
/// def from_seed_slip23(seed: AnyBytes) -> HDNode:
-/// """
-/// Creates a Cardano HD node from a seed via SLIP-23 derivation.
-/// """
+/// """
+/// Creates a Cardano HD node from a seed via SLIP-23 derivation.
+/// """
STATIC mp_obj_t mod_trezorcrypto_from_seed_slip23(mp_obj_t seed) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(seed, &bufinfo, MP_BUFFER_READ);
diff --git a/core/embed/upymod/modtrezorio/modtrezorio-pm.h b/core/embed/upymod/modtrezorio/modtrezorio-pm.h
index 8864029e..1d735119 100644
--- a/core/embed/upymod/modtrezorio/modtrezorio-pm.h
+++ b/core/embed/upymod/modtrezorio/modtrezorio-pm.h
@@ -41,10 +41,10 @@
/// EVENT_SOC_UPDATED: int
/// def soc() -> int:
-/// """
-/// Returns the state of charge (SoC) in percent (0-100). Raises RuntimeError
-/// on failure.
-/// """
+/// """
+/// Returns the state of charge (SoC) in percent (0-100). Raises
+/// RuntimeError on failure.
+/// """
STATIC mp_obj_t mod_trezorio_pm_soc() {
pm_state_t state = {0};
pm_status_t res = pm_get_state(&state);
diff --git a/core/embed/upymod/modtrezorutils/modtrezorutils-meminfo.h b/core/embed/upymod/modtrezorutils/modtrezorutils-meminfo.h
index d632fa80..8fc8af75 100644
--- a/core/embed/upymod/modtrezorutils/modtrezorutils-meminfo.h
+++ b/core/embed/upymod/modtrezorutils/modtrezorutils-meminfo.h
@@ -740,9 +740,10 @@ static void dump_meminfo_json(FILE *out) {
}
/// def meminfo(filename: str | None) -> None:
-/// """Dumps map of micropython GC arena to a file.
+/// """
+/// Dumps map of micropython GC arena to a file.
/// The JSON file can be decoded by analyze-memory-dump.py
-/// """
+/// """
STATIC mp_obj_t mod_trezorutils_meminfo(mp_obj_t filename) {
size_t fn_len;
FILE *out = (filename == mp_const_none)
diff --git a/core/mocks/generated/trezorapp/__init__.pyi b/core/mocks/generated/trezorapp/__init__.pyi
index 99328980..f30bc07a 100644
--- a/core/mocks/generated/trezorapp/__init__.pyi
+++ b/core/mocks/generated/trezorapp/__init__.pyi
@@ -15,9 +15,9 @@ class AppImage:
def finalize(self, bool accept) -> None:
"""
- Finalizes loading of the application image. If `accept` is true,
- the image is marked as loaded and will be available for execution.
- If `accept` is false, the image is discarded.
+ Finalizes loading of the application image. If `accept` is true,
+ the image is marked as loaded and will be available for execution.
+ If `accept` is false, the image is discarded.
"""
diff --git a/core/mocks/generated/trezorcrypto/cardano.pyi b/core/mocks/generated/trezorcrypto/cardano.pyi
index 015e2ecd..a68ba721 100644
--- a/core/mocks/generated/trezorcrypto/cardano.pyi
+++ b/core/mocks/generated/trezorcrypto/cardano.pyi
@@ -27,9 +27,9 @@ def from_secret(secret: AnyBytes) -> HDNode:
# upymod/modtrezorcrypto/modtrezorcrypto-cardano.h
def from_seed_slip23(seed: AnyBytes) -> HDNode:
- """
- Creates a Cardano HD node from a seed via SLIP-23 derivation.
- """
+ """
+ Creates a Cardano HD node from a seed via SLIP-23 derivation.
+ """
# upymod/modtrezorcrypto/modtrezorcrypto-cardano.h
diff --git a/core/mocks/generated/trezorio/pm.pyi b/core/mocks/generated/trezorio/pm.pyi
index 22a2b97c..c3cd5199 100644
--- a/core/mocks/generated/trezorio/pm.pyi
+++ b/core/mocks/generated/trezorio/pm.pyi
@@ -22,10 +22,10 @@ EVENT_SOC_UPDATED: int
# upymod/modtrezorio/modtrezorio-pm.h
def soc() -> int:
- """
- Returns the state of charge (SoC) in percent (0-100). Raises RuntimeError
- on failure.
- """
+ """
+ Returns the state of charge (SoC) in percent (0-100). Raises
+ RuntimeError on failure.
+ """
# upymod/modtrezorio/modtrezorio-pm.h
diff --git a/core/mocks/generated/trezorutils.pyi b/core/mocks/generated/trezorutils.pyi
index 4c07a3c0..29082256 100644
--- a/core/mocks/generated/trezorutils.pyi
+++ b/core/mocks/generated/trezorutils.pyi
@@ -4,9 +4,10 @@ from buffer_types import *
# upymod/modtrezorutils/modtrezorutils-meminfo.h
def meminfo(filename: str | None) -> None:
- """Dumps map of micropython GC arena to a file.
+ """
+ Dumps map of micropython GC arena to a file.
The JSON file can be decoded by analyze-memory-dump.py
- """
+ """
from trezor import utils
diff --git a/core/src/apps/common/paths.py b/core/src/apps/common/paths.py
index 93affdeb..69b83746 100644
--- a/core/src/apps/common/paths.py
+++ b/core/src/apps/common/paths.py
@@ -5,12 +5,13 @@ HARDENED = const(0x8000_0000)
SLIP25_PURPOSE = const(10025 | HARDENED)
if TYPE_CHECKING:
+ from buffer_types import AnyBytes
from typing import Any, Callable, Collection, Container, Iterable, Sequence, TypeVar
from typing_extensions import Protocol
Bip32Path = list[int]
- Slip21Path = Sequence[bytes]
+ Slip21Path = Sequence[AnyBytes]
PathType = TypeVar("PathType", Bip32Path, Slip21Path, contravariant=True)
class PathSchemaType(Protocol):
@@ -371,7 +372,7 @@ def address_n_slip21_to_str(address_n: Slip21Path) -> str:
if not address_n:
return "m"
- def label_to_str(label: bytes) -> str:
+ def label_to_str(label: AnyBytes) -> str:
out = []
for b in label:
if b == ord("\\"):
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.