Skip to content

fix: use instruction decimals for Solana TransferChecked amount display#242

Open
BitHighlander wants to merge 2 commits into
developfrom
fix/solana-token-decimals
Open

fix: use instruction decimals for Solana TransferChecked amount display#242
BitHighlander wants to merge 2 commits into
developfrom
fix/solana-token-decimals

Conversation

@BitHighlander

Copy link
Copy Markdown
Owner

Summary

  • Finding 3 fix: For SOL_INSTR_TOKEN_TRANSFER_CHECKED, the instruction data encodes the authoritative decimal count at byte 9 (pi->extra_u8). The host-supplied SolanaTokenInfo.decimals is metadata only and can be forged to misrepresent the displayed token amount.
  • Split the combined TOKEN_TRANSFER / TOKEN_TRANSFER_CHECKED fallthrough into separate cases so TRANSFER_CHECKED always uses pi->extra_u8 for decimal scaling.
  • Symbol from host metadata is still used as a display label (acceptable — a wrong symbol is misleading but cannot trick the user into approving a different amount).
  • TOKEN_TRANSFER (no decimals in instruction) continues to use ti->decimals from host metadata as before.

Files Changed

  • lib/firmware/fsm_msg_solana.h — split SOL_INSTR_TOKEN_TRANSFER_CHECKED case, use pi->extra_u8 for decimals

Test Plan

  • Solana SPL token transfer (non-checked): displayed decimals match host metadata as before
  • Solana SPL token transferChecked: displayed decimals match instruction bytes, not host metadata
  • Attempt to forge decimals in SolanaTokenInfo for a transferChecked tx: device shows correct amount from instruction

For SOL_INSTR_TOKEN_TRANSFER_CHECKED the instruction data encodes the
authoritative decimal count in byte 9 (parsed into pi->extra_u8). The
host-supplied SolanaTokenInfo.decimals is metadata only and could be
forged to misrepresent the displayed amount. Split the fallthrough case
so TRANSFER_CHECKED always uses pi->extra_u8 for decimal scaling while
still displaying the host-supplied symbol as a label.
deps/device-protocol → 8ef74da (feat(ripple): memo + THORChain routing)
deps/python-keepkey  → bf870e6 (7.14.2: XRP memo + EVM depositWithExpiry + msg-signing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant