What changed, and why it matters
This commit fixes a bug in how the Keystone 3 hardware wallet classifies certain Tron (TRX) transactions. Previously, only memos starting with '=:' were recognized as swap transactions. Now memos beginning with 'SWAP:' (case-insensitive) are also recognized as swaps. This is a UI/flow correction rather than a cryptographic fix, but misclassification could cause a user to review a swap transaction on the wrong screen, potentially hiding important swap-specific warnings or safety checks.
Treat as a routine functional bug fix. Review whether the 'SWAP:' prefix is the complete set of swap markers and confirm that the TronSwapTx flow enforces the intended security checks. No urgent user action is indicated from this diff alone.
Security signals we found
Transaction-type classification heuristic expanded
Swap-specific approval flow may now trigger for previously mismatched memos
No cryptographic, signature, or parsing hardening visible in diff
Evidence from the diff
In rust/rust_c/src/common/ur_ext.rs, get_view_type_from_keystone() now checks whether tx.memo starts with ‘=:’ OR starts with ‘SWAP:’ (after uppercasing). The prior code only matched ‘=:’, so Tron swap transactions whose memo used the ‘SWAP:’ prefix were classified as ordinary TronTx instead of TronSwapTx. The change broadens the heuristic used to select the wallet’s view/approval flow.
Changed components
rust/rust_c/src/common/ur_ext.rsTron transaction view-type selectionKeystone UR (Uniform Resources) decoding pathInspect captured patch +2 / −1
diff --git a/rust/rust_c/src/common/ur_ext.rs b/rust/rust_c/src/common/ur_ext.rs
index c3a7a26..3733f5b 100644
--- a/rust/rust_c/src/common/ur_ext.rs
+++ b/rust/rust_c/src/common/ur_ext.rs
@@ -272,7 +272,8 @@ fn get_view_type_from_keystone(bytes: Vec<u8>) -> Result<ViewType, URError> {
if let Some(protoc::sign_transaction::Transaction::TronTx(tx)) =
sign_tx_content.transaction
{
- if tx.memo.starts_with("=:") {
+ if tx.memo.starts_with("=:") || tx.memo.to_uppercase().starts_with("SWAP:")
+ {
ViewType::TronSwapTx
} else {
ViewType::TronTx
Why this scored 35/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.