feat(ethereum): token amount native currency
What changed, and why it matters
This commit changes how the Trezor hardware wallet formats token amounts shown on screen during Ethereum transactions. It adds support for treating certain addresses as the network's native currency (like ETH on Ethereum mainnet) rather than as ERC-20 tokens when displaying amounts. There is no indication in the commit that this fixes a security vulnerability; it appears to be a user-interface correctness feature.
No security action required. Treat as a normal feature commit. If desired, review the related PR or changelog for context on why native-currency display was needed.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch modifies TokenAmountFormatter in core/src/apps/ethereum/clear_signing.py. It introduces a new optional parameter native_currency_address (a list of bytes) and, when formatting a token amount, checks whether the resolved token address is in that list. If so, it skips the token definition lookup and treats the amount as the network’s native currency. The visible amount formatting and returned metadata are adjusted accordingly. The change is small and localized to display logic.
Changed components
core/src/apps/ethereum/clear_signing.pyTokenAmountFormatter classEthereum transaction clear-signing / amount displayInspect captured patch +15 / −3
diff --git a/core/src/apps/ethereum/clear_signing.py b/core/src/apps/ethereum/clear_signing.py
index c3e6dc90..1b5d2f8e 100644
--- a/core/src/apps/ethereum/clear_signing.py
+++ b/core/src/apps/ethereum/clear_signing.py
@@ -195,9 +195,13 @@ class AmountFormatter(FieldFormatter):
class TokenAmountFormatter(FieldFormatter):
def __init__(
- self, token_path: Path | None = None, threshold: int | None = None
+ self,
+ token_path: Path | None = None,
+ native_currency_address: list[bytes] | None = None,
+ threshold: int | None = None,
) -> None:
self.token_path = token_path
+ self.native_currency_address = native_currency_address
self.threshold = threshold
def format(
@@ -222,11 +226,19 @@ class TokenAmountFormatter(FieldFormatter):
token_address = path_walker(self.token_path)
if not isinstance(token_address, bytes):
raise InvalidFormatDefinition
- token = definitions.get_token(token_address)
+ is_native_currency = False
+ if self.native_currency_address is not None:
+ if token_address in self.native_currency_address:
+ is_native_currency = True
+ token = (
+ definitions.get_token(token_address)
+ if not is_native_currency
+ else None
+ )
return (
format_ethereum_amount(amount, token, definitions.network),
token,
- token_address,
+ token_address if not is_native_currency else None,
)
return (
format_ethereum_amount(amount, token, definitions.network),
Why this scored 16/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.