Skip to content

Commit dfdb92a

Browse files
BitcoinQnAclaude
andcommitted
Correct stale Prime review and about copy
The review and about screens still described a Sepolia-only wallet and displayed a wei-exact fee. - "How it works" and the onboarding banner claimed Sepolia-only assets, and the approval screen told the user to await Sepolia confirmation, which is wrong after a Bitcoin transfer. The approval wording is now chain-neutral. - The review screen showed USDT where the companion shows USD~T. - Maximum fees rendered as eighteen decimals. They are now shortened to eight, always rounding up: this figure is the ceiling the user authorises, so it must never read lower than what the transaction can spend, and dust must never display as zero. Six decimals collapsed a typical Sepolia gas cost to one significant digit, so eight is the floor for a useful review. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 576448e commit dfdb92a

3 files changed

Lines changed: 34 additions & 6 deletions

File tree

prime-app/i18n/en.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"about.approvalTitle": "Approve every transfer",
77
"about.content": "Tether Wallet uses the phone for the wallet experience and Passport Prime for custody and approval.",
88
"about.eyebrow": "HOW IT WORKS",
9-
"about.phoneContent": "The phone builds and broadcasts Sepolia transactions.",
9+
"about.phoneContent": "The phone builds and broadcasts Sepolia and Bitcoin Testnet transactions.",
1010
"about.phoneTitle": "Tether Wallet on your phone",
1111
"about.primeContent": "The private key is derived and used only inside Passport.",
1212
"about.primeTitle": "Keys stay on Passport Prime",
13-
"about.testnet": "This proof of concept uses Sepolia testnet assets only.",
13+
"about.testnet": "This proof of concept uses Sepolia and Bitcoin Testnet assets only.",
1414
"about.title": "One wallet, two secure roles",
1515
"brand.name": "Tether Wallet",
1616
"common.button.back": "Back",
@@ -63,7 +63,7 @@
6363
"onboarding.pairTitle": "Pair securely",
6464
"onboarding.reviewContent": "See exactly what the phone asks Passport to sign.",
6565
"onboarding.reviewTitle": "Review every transfer",
66-
"onboarding.testnet": "Sepolia testnet only • Do not send real funds",
66+
"onboarding.testnet": "Testnet only • Do not send real funds",
6767
"onboarding.title": "Your Tether wallet. Secured by Passport.",
6868
"pairing.content": "In Tether Wallet, choose Passport Prime and scan this code.",
6969
"pairing.contentConnected": "Scan this second code in Tether Wallet to exchange secure identities.",
@@ -87,7 +87,7 @@
8787
"result.action": "Back to wallet",
8888
"result.content": "Passport Prime signed the transfer and securely returned it to your companion app.",
8989
"result.eyebrow": "TRANSFER APPROVED",
90-
"result.next": "Next, check your companion app for Sepolia network confirmation.",
90+
"result.next": "Next, check your companion app for network confirmation.",
9191
"result.title": "Transfer approved",
9292
"review.amount": "Amount",
9393
"review.maximumFee": "Maximum network fee",

prime-app/src/evm.rs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl EvmWallet {
191191

192192
Ok(PreparedTransaction {
193193
request,
194-
review: Review { asset, amount, recipient, maximum_fee: format_units(total_fee, 18) },
194+
review: Review { asset, amount, recipient, maximum_fee: format_fee_ceil(total_fee) },
195195
})
196196
}
197197

@@ -405,6 +405,18 @@ fn length_prefix(length: usize, short_base: u8, long_base: u8) -> Vec<u8> {
405405
prefix
406406
}
407407

408+
/// Wei-exact fees render as eighteen decimals, which is unreadable on the
409+
/// review screen. Shorten to eight, always rounding *up*: this is the maximum
410+
/// the user is authorising, so the figure on screen must never be lower than
411+
/// what the transaction can actually spend, and a non-zero fee must never
412+
/// display as zero. Eight decimals keeps several significant digits on typical
413+
/// Sepolia gas costs, where six would collapse them to a single one.
414+
fn format_fee_ceil(value_wei: u128) -> String {
415+
const SCALE: u128 = 10_000_000_000; // 18 decimals down to 8
416+
let ceiled = value_wei.div_ceil(SCALE);
417+
format_units(ceiled, 8)
418+
}
419+
408420
fn format_units(value: u128, decimals: usize) -> String {
409421
let mut digits = value.to_string();
410422
if decimals == 0 {
@@ -430,6 +442,22 @@ mod tests {
430442

431443
const SEED: [u8; 32] = [0x42; 32];
432444

445+
#[test]
446+
fn displayed_maximum_fee_never_understates_the_authorised_amount() {
447+
// The real fee from a Sepolia USD~T transfer, which rendered as
448+
// 0.000099281419373928 before this shortened it.
449+
assert_eq!(format_fee_ceil(99_281_419_373_928), "0.00009929");
450+
451+
// Rounding is upward, so the figure on screen is never lower than what
452+
// the transaction can spend, and dust never displays as zero.
453+
assert_eq!(format_fee_ceil(1), "0.00000001");
454+
assert_eq!(format_fee_ceil(10_000_000_001), "0.00000002");
455+
456+
// Exact multiples stay exact, and a genuinely zero fee stays zero.
457+
assert_eq!(format_fee_ceil(20_000_000_000), "0.00000002");
458+
assert_eq!(format_fee_ceil(0), "0.0");
459+
}
460+
433461
fn base_request() -> WdkEvmSignTransactionRequest {
434462
let wallet = EvmWallet::new(SEED);
435463
WdkEvmSignTransactionRequest {

prime-app/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ fn handle_signing_requests(ui: &AppWindow, state: &StoredValue<AppState>) {
356356
let view = ui.global::<State>();
357357
view.set_asset(match prepared.review.asset {
358358
Asset::Eth => SharedString::from("ETH"),
359-
Asset::Usdt => SharedString::from("USDT"),
359+
Asset::Usdt => SharedString::from("USD₮"),
360360
});
361361
view.set_amount(prepared.review.amount.clone().into());
362362
view.set_recipient(prepared.review.recipient.clone().into());

0 commit comments

Comments
 (0)