mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-android.git
synced 2026-07-22 12:35:49 +00:00
9de7267a58
RealTronTransactionService's native-TRX branch (transact/calculateFee for TronTransactionIntent.Native) had zero automated coverage - only the TRC20 ABI encoding (Trc20TransferAbiTest) and address derivation/formatting (TronDerivationTest, TronAddressTest) were tested. Send/transfer code moving real funds shouldn't ship untested just because it happens to share its sign/broadcast plumbing with an already-tested asset type. Covers: the raw_data is hashed and signed exactly as documented (sha256, not the raw bytes or txID), the r+s+v signature is assembled correctly before being sent to broadcastTransaction, and - the one true security invariant here - a TronGrid response whose txID doesn't match sha256(raw_data) is refused before ever reaching the signer, not just before broadcast. Also covers the native fee estimator's bandwidth-shortfall math against the documented fallback price. Fixture note: the raw_data_hex/txID pair here is self-consistent (computed locally) rather than live-captured against TronGrid, unlike Trc20TransferAbiTest's ABI vector - this class never encodes a real TransferContract protobuf itself (see its own class doc), so what matters is that this service correctly hashes/signs/forwards whatever raw_data TronGrid returns, which a self-consistent fixture exercises identically.