What changed, and why it matters
This is a straightforward internal code cleanup. The change removes a helper feature where user-interface functions automatically inserted a value into a message string, and instead makes each caller build the final message itself. No security bug is fixed or introduced; it is purely a refactoring to simplify the code.
No security action required. Treat as normal code-review/QA for functional parity and translation string correctness.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors MicroPython UI layout helpers confirm_action and confirm_metadata across four layout backends (bolt, caesar, delizia, eckhart). It removes the description_param/param arguments and the implicit description.format(param) call, moving string interpolation responsibility to callers. Callers are updated to use .format() or f-strings directly. The behavior is intended to be functionally equivalent.
Changed components
core/src/trezor/ui/layouts/bolt/__init__.pycore/src/trezor/ui/layouts/caesar/__init__.pycore/src/trezor/ui/layouts/delizia/__init__.pycore/src/trezor/ui/layouts/eckhart/__init__.pycore/src/apps/bitcoin/authorize_coinjoin.pycore/src/apps/eos/layout.pycore/src/apps/management/apply_settings.pycore/src/apps/management/set_u2f_counter.pycore/src/apps/monero/layout.pycore/src/apps/nem/layout.pycore/src/apps/ripple/layout.pycore/src/apps/tezos/layout.pyInspect captured patch +17 / −47
### core/src/apps/bitcoin/authorize_coinjoin.py
@@ -85,8 +85,7 @@ async def authorize_coinjoin(
await confirm_metadata(
"fee_over_threshold",
TR.bitcoin__title_high_mining_fee,
- TR.bitcoin__high_mining_fee_template,
- max_fee_per_vbyte,
+ TR.bitcoin__high_mining_fee_template.format(max_fee_per_vbyte),
ButtonRequestType.FeeOverThreshold,
)
### core/src/apps/eos/layout.py
@@ -15,9 +15,8 @@ async def require_sign_tx(num_actions: int) -> None:
await confirm_action(
"confirm_tx",
TR.send__sign_transaction,
- description=TR.eos__about_to_sign_template,
- description_param=format_plural(
- "{count} {plural}", num_actions, TR.plurals__sign_x_actions
+ description=TR.eos__about_to_sign_template.format(
+ format_plural("{count} {plural}", num_actions, TR.plurals__sign_x_actions)
),
br_code=ButtonRequestType.SignTx,
)
### core/src/apps/management/apply_settings.py
@@ -215,8 +215,7 @@ async def _require_confirm_change_display_rotation(rotation: DisplayRotation) ->
"set_rotation",
TR.rotation__title_change,
subtitle=TR.words__settings,
- description=TR.rotation__change_template,
- description_param=label,
+ description=TR.rotation__change_template.format(label),
br_code=BRT_PROTECT_CALL,
prompt_screen=True,
)
@@ -228,8 +227,7 @@ async def _require_confirm_change_autolock_delay(delay_ms: int) -> None:
await confirm_action(
"set_autolock_delay",
TR.auto_lock__title,
- description=TR.auto_lock__change_template,
- description_param=format_duration_ms(delay_ms),
+ description=TR.auto_lock__change_template.format(format_duration_ms(delay_ms)),
br_code=BRT_PROTECT_CALL,
prompt_screen=True,
)
### core/src/apps/management/set_u2f_counter.py
@@ -21,8 +21,7 @@ async def set_u2f_counter(msg: SetU2FCounter) -> Success:
await confirm_action(
"set_u2f_counter",
TR.u2f__title_set,
- description=TR.u2f__set_template,
- description_param=str(msg.u2f_counter),
+ description=TR.u2f__set_template.format(msg.u2f_counter),
verb=TR.buttons__set,
br_code=ButtonRequestType.ProtectCall,
prompt_screen=True,
### core/src/apps/monero/layout.py
@@ -198,7 +198,6 @@ async def _require_confirm_fee(fee: int) -> None:
await confirm_metadata(
"confirm_final",
TR.words__confirm_fee,
- "{}",
_format_amount(fee),
hold=True,
)
@@ -208,7 +207,6 @@ async def _require_confirm_unlock_time(unlock_time: int) -> None:
await confirm_metadata(
"confirm_locktime",
TR.monero__confirm_unlock_time,
- TR.monero__unlock_time_set_template,
- str(unlock_time),
+ TR.monero__unlock_time_set_template.format(unlock_time),
BRT_SignTx,
)
### core/src/apps/nem/layout.py
@@ -24,8 +24,9 @@ async def require_confirm_fee(action: str, fee: int) -> None:
await confirm_metadata(
"confirm_fee",
TR.words__confirm_fee,
- action + "\n{}",
- format_amount_unit(format_amount(fee, NEM_MAX_DIVISIBILITY), "XEM"),
+ action
+ + "\n"
+ + format_amount_unit(format_amount(fee, NEM_MAX_DIVISIBILITY), "XEM"),
ButtonRequestType.ConfirmOutput,
)
@@ -45,7 +46,8 @@ async def require_confirm_final(fee: int) -> None:
await confirm_metadata(
"confirm_final",
TR.nem__final_confirm,
- TR.nem__sign_tx_fee_template,
- format_amount_unit(format_amount(fee, NEM_MAX_DIVISIBILITY), "XEM"),
+ TR.nem__sign_tx_fee_template.format(
+ format_amount_unit(format_amount(fee, NEM_MAX_DIVISIBILITY), "XEM")
+ ),
hold=True,
)
### core/src/apps/ripple/layout.py
@@ -27,8 +27,7 @@ async def require_confirm_destination_tag(tag: int) -> None:
await confirm_metadata(
"confirm_destination_tag",
TR.ripple__confirm_tag,
- TR.ripple__destination_tag_template,
- str(tag),
+ TR.ripple__destination_tag_template.format(str(tag)),
ButtonRequestType.ConfirmOutput,
)
### core/src/apps/tezos/layout.py
@@ -62,8 +62,7 @@ async def require_confirm_set_delegate(fee: int) -> None:
await confirm_metadata(
"confirm_delegation_final",
TR.tezos__confirm_delegation,
- f"{TR.words__fee}:\n{{}}",
- format_tezos_amount(fee),
+ f"{TR.words__fee}:\n{format_tezos_amount(fee)}",
BR_SIGN_TX,
hold=True,
)
@@ -131,8 +130,7 @@ async def require_confirm_manager_remove_delegate(fee: int) -> None:
await confirm_metadata(
"confirm_undelegation_final",
TR.tezos__remove_delegation,
- f"{TR.words__fee}:\n{{}}",
- format_tezos_amount(fee),
+ f"{TR.words__fee}:\n{format_tezos_amount(fee)}",
BR_SIGN_TX,
hold=True,
)
### core/src/trezor/ui/layouts/bolt/__init__.py
@@ -35,7 +35,6 @@ async def confirm_action(
title: str,
action: str | None = None,
description: str | None = None,
- description_param: str | None = None,
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = None,
@@ -47,9 +46,6 @@ async def confirm_action(
prompt_screen: bool = False, # unused on bolt
prompt_title: str | None = None,
) -> None:
- if description is not None and description_param is not None:
- description = description.format(description_param)
-
with trezorui_api.confirm_action(
title=title,
action=action,
@@ -2054,7 +2050,6 @@ def confirm_metadata(
br_name: str,
title: str,
content: str,
- param: str | None = None,
br_code: ButtonRequestType = ButtonRequestType.SignTx,
hold: bool = False,
verb: str | None = None,
@@ -2065,7 +2060,6 @@ def confirm_metadata(
title=title,
action="",
description=content,
- description_param=param,
verb=verb,
hold=hold,
br_code=br_code,
### core/src/trezor/ui/layouts/caesar/__init__.py
@@ -62,7 +62,6 @@ async def confirm_action(
title: str,
action: str | None = None,
description: str | None = None,
- description_param: str | None = None,
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = "",
@@ -75,8 +74,6 @@ async def confirm_action(
prompt_title: str | None = None,
) -> None:
verb = verb or TR.buttons__confirm # def_arg
- if description is not None and description_param is not None:
- description = description.format(description_param)
with trezorui_api.confirm_action(
title=title,
@@ -2175,14 +2172,13 @@ def confirm_metadata(
br_name: str,
title: str,
content: str,
- param: str | None = None,
br_code: ButtonRequestType = ButtonRequestType.SignTx,
hold: bool = False,
) -> Awaitable[None]:
return _placeholder_confirm(
br_name,
title,
- description=content.format(param),
+ description=content,
hold=hold,
br_code=br_code,
)
### core/src/trezor/ui/layouts/delizia/__init__.py
@@ -41,7 +41,6 @@ async def confirm_action(
title: str,
action: str | None = None,
description: str | None = None,
- description_param: str | None = None,
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = None,
@@ -55,9 +54,6 @@ async def confirm_action(
) -> ui.UiResult:
from trezor.ui.layouts.menu import Menu, cancel_leaf, interact_with_menu
- if description is not None and description_param is not None:
- description = description.format(description_param)
-
with trezorui_api.confirm_action(
title=title,
action=action,
@@ -2084,7 +2080,6 @@ def confirm_metadata(
br_name: str,
title: str,
content: str,
- param: str | None = None,
br_code: ButtonRequestType = ButtonRequestType.SignTx,
hold: bool = False,
verb: str | None = None,
@@ -2095,7 +2090,6 @@ def confirm_metadata(
title=title,
action="",
description=content,
- description_param=param,
verb=verb,
hold=hold,
br_code=br_code,
### core/src/trezor/ui/layouts/eckhart/__init__.py
@@ -42,7 +42,6 @@ async def confirm_action(
title: str,
action: str | None = None,
description: str | None = None,
- description_param: str | None = None,
subtitle: str | None = None,
verb: str | None = None,
verb_cancel: str | None = None,
@@ -54,9 +53,6 @@ async def confirm_action(
prompt_screen: bool = False,
prompt_title: str | None = None,
) -> None:
- if description is not None and description_param is not None:
- description = description.format(description_param)
-
with trezorui_api.confirm_action(
title=title,
action=action,
@@ -2212,7 +2208,6 @@ def confirm_metadata(
br_name: str,
title: str,
content: str,
- param: str | None = None,
br_code: ButtonRequestType = ButtonRequestType.SignTx,
hold: bool = False,
verb: str | None = None,
@@ -2223,7 +2218,6 @@ def confirm_metadata(
title=title,
action="",
description=content,
- description_param=param,
verb=verb,
hold=hold,
br_code=br_code,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.