A balance reads differently in the balance list and on Send: the lists round, Send cuts #757

Open
opened 2026-11-10 20:54:17 +01:00 by clawbot · 1 comment
Collaborator

The balance lists and Home's ETH balance round amounts with Number.toFixed(4) (balanceLine() in src/popup/views/helpers.js, the ETH line in src/popup/views/home.js). Every other screen cuts through src/shared/amountDisplay.js. So one balance reads two ways:

  • a holding of 0.99996 ETH reads 1.0000 ETH in the balance list, more than the address holds, and 0.9999 ETH as Send's current balance;
  • a holding of 0.00004 USDC reads 0.0000 USDC in the balance list and 0.00004 USDC on Send.

The rule: RULES.md Display Consistency, "Same data formatted identically across all screens". sneak's README.md text behind it: "If a formatting rule applies in one place, it applies in every place. Users should never see the same value rendered differently on two screens."

Found in the RULES.md read on #672 (comment).

Fix

  • Every summary amount goes through truncateAmountNeverZero() in src/shared/amountDisplay.js, applied to the exact decimal string (the stored balance, or the output of formatEther() / formatUnits()), never to a JavaScript number. That covers the balance lists, Home's ETH balance, history rows (src/shared/transactions.js, which uses truncateAmount() today), Send's current balance and the screens that state what is authorized.
  • TransactionDetail keeps the exact amount and base units. "quantity unknown" stays as it is.
  • USD values may still be computed from a parsed number; only the shown quantity changes.
  • truncateAmount() stays only as the step inside truncateAmountNeverZero(), or goes if nothing else calls it.
  • README.md "Amounts": replace the sentences saying the balance lists round and history rows cut without the floor with the one rule.

Files: src/popup/views/helpers.js, src/popup/views/home.js, src/shared/transactions.js, src/shared/amountDisplay.js if needed, README.md, tests. No new module.

Definition of done

  • Tests, failing on current next: 0.99996 ETH renders 0.9999 in the balance list and in Home's ETH line; 0.00004 renders 0.00004 in the balance list and in a history row.
  • No screen formats an amount with toFixed().
  • make check green. Gate runs: flock -w 3600 /srv/code/tmp/.autistmask-gate.lock script/cibuild.

Model: opus-5-5

The balance lists and Home's ETH balance round amounts with `Number.toFixed(4)` (`balanceLine()` in `src/popup/views/helpers.js`, the ETH line in `src/popup/views/home.js`). Every other screen cuts through `src/shared/amountDisplay.js`. So one balance reads two ways: - a holding of 0.99996 ETH reads `1.0000 ETH` in the balance list, more than the address holds, and `0.9999 ETH` as Send's current balance; - a holding of 0.00004 USDC reads `0.0000 USDC` in the balance list and `0.00004 USDC` on Send. The rule: `RULES.md` Display Consistency, "Same data formatted identically across all screens". sneak's `README.md` text behind it: "If a formatting rule applies in one place, it applies in every place. Users should never see the same value rendered differently on two screens." Found in the `RULES.md` read on https://git.eeqj.de/sneak/AutistMask/issues/672#issuecomment-160312. ## Fix - Every summary amount goes through `truncateAmountNeverZero()` in `src/shared/amountDisplay.js`, applied to the exact decimal string (the stored balance, or the output of `formatEther()` / `formatUnits()`), never to a JavaScript number. That covers the balance lists, Home's ETH balance, history rows (`src/shared/transactions.js`, which uses `truncateAmount()` today), Send's current balance and the screens that state what is authorized. - TransactionDetail keeps the exact amount and base units. "quantity unknown" stays as it is. - USD values may still be computed from a parsed number; only the shown quantity changes. - `truncateAmount()` stays only as the step inside `truncateAmountNeverZero()`, or goes if nothing else calls it. - `README.md` "Amounts": replace the sentences saying the balance lists round and history rows cut without the floor with the one rule. Files: `src/popup/views/helpers.js`, `src/popup/views/home.js`, `src/shared/transactions.js`, `src/shared/amountDisplay.js` if needed, `README.md`, tests. No new module. ## Definition of done - Tests, failing on current `next`: `0.99996` ETH renders `0.9999` in the balance list and in Home's ETH line; `0.00004` renders `0.00004` in the balance list and in a history row. - No screen formats an amount with `toFixed()`. - `make check` green. Gate runs: `flock -w 3600 /srv/code/tmp/.autistmask-gate.lock script/cibuild`. Model: opus-5-5
clawbot self-assigned this 2026-11-10 20:54:17 +01:00
clawbot added this to the 1.0.0 milestone 2026-11-10 20:54:24 +01:00
Author
Collaborator

Built in #768. The balance lists, Home's ETH line and history rows now show amounts through truncateAmountNeverZero().

For the owner: RULES.md Display Consistency says "exactly 4 decimal places in all summary views". The floor this issue asks for shows an amount below 0.0001 in the lists with more places, such as 0.00004. RULES.md is unchanged.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/AutistMask/pulls/768. The balance lists, Home's ETH line and history rows now show amounts through `truncateAmountNeverZero()`. For the owner: `RULES.md` Display Consistency says "exactly 4 decimal places in all summary views". The floor this issue asks for shows an amount below 0.0001 in the lists with more places, such as `0.00004`. `RULES.md` is unchanged. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#757