feat(tron): reconstruct-then-sign for clear-signed transactions#56
Merged
BitHighlander merged 3 commits intodevelopfrom Mar 18, 2026
Merged
feat(tron): reconstruct-then-sign for clear-signed transactions#56BitHighlander merged 3 commits intodevelopfrom
BitHighlander merged 3 commits intodevelopfrom
Conversation
7 tasks
TRON: secp256k1 + Keccak256 address derivation, SHA256 tx signing TON: Ed25519 address derivation with CRC16 + Base64url, Ed25519 tx signing Both use existing trezor-crypto primitives only.
Security improvement: firmware reconstructs protobuf from structured fields (TronTransferContract, TronTriggerSmartContract) and signs the reconstruction. Display shows verified data, not host-asserted strings. - Structured mode: host sends transfer/trigger_smart fields, firmware rebuilds raw_data protobuf, displays verified amount/address, signs - Legacy mode: raw_data field still works with explicit blind-sign warning - TRC-20 ABI decoding: recognizes transfer(address,uint256) selector - 12 hardcoded TRC-20 tokens (USDT, USDC, SUN, BTT, etc.) - Bounded protobuf serialization with capacity checks - Address validation BEFORE display (prevents confusion attacks) - C unit tests for address, TRC-20 decoding, formatting - Device-protocol updated with structured message definitions Based on upstream keepkey#387 (feat/tron-ton-support)
Proto defines transfer and trigger_smart as separate optional fields, not a oneof. The serializer only processes one (if/else if), so if both are present the UI would walk both confirmation branches but only one gets signed — a display/signature mismatch. Reject with SyntaxError before any confirmation dialog.
43a8438 to
314e6e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Proto changes
Base
Built on top of upstream keepkey#387 (feat/tron-ton-support)
Test plan