fix: the send and send-confirm screens render a sub-1e-6 balance and fee as 0.0 #343

Open
opened 2026-08-23 15:38:21 +02:00 by clawbot · 0 comments
Collaborator

Found by the re-review of #339 (#339 (comment)). Pre-existing; not introduced there.

src/shared/balances.js:31,39 and src/popup/views/confirmTx.js:299 (formatFeeEth) use a 6-decimal truncation, separate from the 4-decimal rule that #322 fixed. A quantity below 1e-6 renders as 0.0 — visible as Current balance on the send screen, and Balance plus the fee line on the send-confirm screen.

Same failure mode as #322: a nonzero quantity displayed as nothing. The direct consequence of that issue's fix is an inconsistency the repo's own Display Consistency rule forbids — the approval screen's max fee is now floored while the send-confirm screen's fee is not, so the same value renders differently on two screens.

Deliberately NOT in milestone 1.0.0, and the reasoning should be re-examined rather than inherited: unlike the approval-screen case, the understatement here is bounded at 1e-6, these are balance and fee readouts rather than the figure the user is authorizing, and at 6 decimals the hidden quantity is dust for any realistic token. Promote it if that judgement is wrong.

Definition of done

  • A nonzero balance or fee never renders as 0.0 on the send or send-confirm screens.
  • The fee is rendered consistently on the send-confirm and approval screens — same value, same string. Prefer routing both through the shared helper in src/shared/amountDisplay.js over adding a fourth truncation rule.
  • Test: a sub-1e-6 balance and a sub-1e-6 fee each render nonzero. Fails against current head — state the mutation and observed result.
  • make check green.
Found by the re-review of https://git.eeqj.de/sneak/AutistMask/pulls/339 (https://git.eeqj.de/sneak/AutistMask/pulls/339#issuecomment-69037). Pre-existing; not introduced there. `src/shared/balances.js:31,39` and `src/popup/views/confirmTx.js:299` (`formatFeeEth`) use a **6-decimal** truncation, separate from the 4-decimal rule that https://git.eeqj.de/sneak/AutistMask/issues/322 fixed. A quantity below 1e-6 renders as `0.0` — visible as `Current balance` on the send screen, and `Balance` plus the fee line on the send-confirm screen. Same failure mode as https://git.eeqj.de/sneak/AutistMask/issues/322: a nonzero quantity displayed as nothing. The direct consequence of that issue's fix is an inconsistency the repo's own Display Consistency rule forbids — **the approval screen's max fee is now floored while the send-confirm screen's fee is not**, so the same value renders differently on two screens. Deliberately NOT in milestone 1.0.0, and the reasoning should be re-examined rather than inherited: unlike the approval-screen case, the understatement here is bounded at 1e-6, these are balance and fee readouts rather than the figure the user is authorizing, and at 6 decimals the hidden quantity is dust for any realistic token. Promote it if that judgement is wrong. ## Definition of done - [ ] A nonzero balance or fee never renders as `0.0` on the send or send-confirm screens. - [ ] The fee is rendered consistently on the send-confirm and approval screens — same value, same string. Prefer routing both through the shared helper in `src/shared/amountDisplay.js` over adding a fourth truncation rule. - [ ] Test: a sub-1e-6 balance and a sub-1e-6 fee each render nonzero. Fails against current head — state the mutation and observed result. - [ ] `make check` green.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#343