A reopened confirmation screen shows the balance from before a network switch #558

Open
opened 2026-10-14 15:32:20 +02:00 by clawbot · 2 comments
Collaborator

Raised by the review of #542.

Where. ConfirmTx (src/popup/views/confirmTx.js). A popup reopened onto a saved confirmation screen after the network was switched in another popup draws the screen again for the new network, but shows, and checks the amount against, the balance it read before the switch.

What happens. The screen states a balance from the other network, and the "amount plus fee exceeds the balance" check is made against it, so a send can be refused that the new network's balance covers, or let through to fail at the node.

Should. README ConfirmTx: the amounts and the balance check are those of the network the screen is drawn for.

Severity: minor

Definition of done

  • When ConfirmTx is drawn for a network, the balance it shows and checks is read on that network.
  • A test switches the network between saving and reopening the confirmation screen and checks the balance shown and the check.

Model: opus-5-5

Raised by the review of https://git.eeqj.de/sneak/AutistMask/pulls/542. **Where.** ConfirmTx (`src/popup/views/confirmTx.js`). A popup reopened onto a saved confirmation screen after the network was switched in another popup draws the screen again for the new network, but shows, and checks the amount against, the balance it read before the switch. **What happens.** The screen states a balance from the other network, and the "amount plus fee exceeds the balance" check is made against it, so a send can be refused that the new network's balance covers, or let through to fail at the node. **Should.** README ConfirmTx: the amounts and the balance check are those of the network the screen is drawn for. Severity: minor ## Definition of done - [ ] When ConfirmTx is drawn for a network, the balance it shows and checks is read on that network. - [ ] A test switches the network between saving and reopening the confirmation screen and checks the balance shown and the check. Model: opus-5-5
clawbot self-assigned this 2026-10-14 15:32:20 +02:00
Author
Collaborator

Plan: show() in src/popup/views/confirmTx.js stamps the screen with the active network's chain id, and restore() calls it for a saved confirmation, but the balance lines and the balance check use txInfo.balance and txInfo.tokenBalance as Send saved them. When the screen is drawn, it reads the sending address's ETH balance, and for a token send its token balance, from the node of the network it is drawn for (the same provider the fee estimate uses), and the balance lines and the balance check use those. Until the read returns, the balance line keeps its space with a placeholder (README, No Layout Shift) and Sign & Send stays disabled, as it already does while the fee is pending; a failed read is stated as unknown, never as zero. No new module. Tests, in tests/confirmTxNetworkSwitch.test.js or a new tests/confirmTxBalanceNetwork.test.js: save the confirmation on one network, switch, reopen, and find the balance shown and checked is the new network's, in both the "enough" and the "not enough" case.

Model: opus-5-5

Plan: `show()` in `src/popup/views/confirmTx.js` stamps the screen with the active network's chain id, and `restore()` calls it for a saved confirmation, but the balance lines and the balance check use `txInfo.balance` and `txInfo.tokenBalance` as Send saved them. When the screen is drawn, it reads the sending address's ETH balance, and for a token send its token balance, from the node of the network it is drawn for (the same provider the fee estimate uses), and the balance lines and the balance check use those. Until the read returns, the balance line keeps its space with a placeholder (README, No Layout Shift) and Sign & Send stays disabled, as it already does while the fee is pending; a failed read is stated as unknown, never as zero. No new module. Tests, in `tests/confirmTxNetworkSwitch.test.js` or a new `tests/confirmTxBalanceNetwork.test.js`: save the confirmation on one network, switch, reopen, and find the balance shown and checked is the new network's, in both the "enough" and the "not enough" case. Model: opus-5-5
Author
Collaborator

Built in #569 as the plan above describes. Two things the plan did not spell out: the fee estimate now starts once the balance is read, because a max ETH send's amount is worked out from the balance, and Send no longer hands its balances to ConfirmTx, since nothing reads them.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/AutistMask/pulls/569 as the plan above describes. Two things the plan did not spell out: the fee estimate now starts once the balance is read, because a max ETH send's amount is worked out from the balance, and Send no longer hands its balances to ConfirmTx, since nothing reads them. 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#558