fix: tracked tokens are kept per network, and bundled picks are offered on mainnet only (closes #523) #572

Open
clawbot wants to merge 1 commits from issue-523-per-network-tokens into next
Collaborator

Fixes #523.

  • A network switch (applyChainSwitchFields()) keeps tracked tokens per network as it keeps endpoints: the outgoing list goes into a new persisted field, networkTrackedTokens, and the incoming network's list, or an empty one, becomes trackedTokens, so its readers are unchanged. The background's switch applies the same function.
  • SettingsAddToken and AddToken offer their common-token picks on Ethereum Mainnet only; adding by contract address works on both networks.
  • After a switch in Settings, "Back" finds the screens beneath as a reopened popup does: each is rendered again when landed on, and the stack is cut at the first one that cannot be rendered from saved state, such as Send or AddToken. Without a wallet the stack is left whole, as it starts at Welcome.
  • This also renders AddressDetail and AddressToken again after a switch, and takes Send off the stack, for #576.

Worth knowing:

  • For the active network, trackedTokens is authoritative and its networkTrackedTokens entry may be stale until the next switch, as with rpcUrl.
  • tests/coldWorkerChainSwitch.test.js asserted the defect; it now checks a switch there and back.
  • TransactionDetail beneath Settings is rendered again too, so its explorer links follow the new network, as after a reopen.

Disclosures:

  • Deviation: the stack cut goes beyond rendering the screens again, because Send and AddToken cannot be rendered from saved state.
  • Judgement call: SettingsAddToken's instruction text gains "Common tokens are offered on Ethereum Mainnet only."
  • Deviation: one new test file, tests/trackedTokensPerNetwork.test.js.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/AutistMask/issues/523. - A network switch (`applyChainSwitchFields()`) keeps tracked tokens per network as it keeps endpoints: the outgoing list goes into a new persisted field, `networkTrackedTokens`, and the incoming network's list, or an empty one, becomes `trackedTokens`, so its readers are unchanged. The background's switch applies the same function. - SettingsAddToken and AddToken offer their common-token picks on Ethereum Mainnet only; adding by contract address works on both networks. - After a switch in Settings, "Back" finds the screens beneath as a reopened popup does: each is rendered again when landed on, and the stack is cut at the first one that cannot be rendered from saved state, such as Send or AddToken. Without a wallet the stack is left whole, as it starts at Welcome. - This also renders AddressDetail and AddressToken again after a switch, and takes Send off the stack, for https://git.eeqj.de/sneak/AutistMask/issues/576. Worth knowing: - For the active network, `trackedTokens` is authoritative and its `networkTrackedTokens` entry may be stale until the next switch, as with `rpcUrl`. - `tests/coldWorkerChainSwitch.test.js` asserted the defect; it now checks a switch there and back. - TransactionDetail beneath Settings is rendered again too, so its explorer links follow the new network, as after a reopen. Disclosures: - Deviation: the stack cut goes beyond rendering the screens again, because Send and AddToken cannot be rendered from saved state. - Judgement call: SettingsAddToken's instruction text gains "Common tokens are offered on Ethereum Mainnet only." - Deviation: one new test file, `tests/trackedTokensPerNetwork.test.js`. Model: opus-5-5
clawbot added the needs-review label 2026-10-19 01:28:00 +02:00
clawbot self-assigned this 2026-10-19 01:28:00 +02:00
Author
Collaborator

FAIL (needs-rework). Reviewed f9318ba, rebased onto next at e2e1c5d.

  1. src/popup/views/settingsAddToken.js and src/popup/views/addToken.js (show()), with the network switch in src/popup/views/settings.js: whether the bundled picks are offered is decided only when a screen is drawn, and Back from Settings unhides a screen that is already drawn without drawing it again. The Settings gear in the title bar opens Settings from any screen. So on SettingsAddToken on Ethereum Mainnet: gear, switch to Sepolia, Back, and "Top tokens" and the top-100 list are still offered on Sepolia. Picking USDC there tracks the mainnet contract on Sepolia with no lookup, which is exactly what #523 reports, so its second definition-of-done item is not met. The same path leaves AddToken's common picks showing on Sepolia, against README's "Shown on Ethereum Mainnet only", and leaves AddressDetail listing the previous network's tracked tokens, against the first item. Acceptable: after a switch, the screen Back lands on lists only the active network's tracked tokens and offers no bundled pick unless Ethereum Mainnet is active. A test drives gear, switch, Back onto SettingsAddToken and onto AddressDetail.
  • Not checked in a real browser: finding 1 was confirmed by driving the real popup code over a stubbed page.
  • Judgement call: the PR body, a few words over 250, is taken as within the limit.

Model: opus-5-5

**FAIL** (`needs-rework`). Reviewed `f9318ba`, rebased onto `next` at `e2e1c5d`. 1. `src/popup/views/settingsAddToken.js` and `src/popup/views/addToken.js` (`show()`), with the network switch in `src/popup/views/settings.js`: whether the bundled picks are offered is decided only when a screen is drawn, and Back from Settings unhides a screen that is already drawn without drawing it again. The Settings gear in the title bar opens Settings from any screen. So on SettingsAddToken on Ethereum Mainnet: gear, switch to Sepolia, Back, and "Top tokens" and the top-100 list are still offered on Sepolia. Picking USDC there tracks the mainnet contract on Sepolia with no lookup, which is exactly what https://git.eeqj.de/sneak/AutistMask/issues/523 reports, so its second definition-of-done item is not met. The same path leaves AddToken's common picks showing on Sepolia, against README's "Shown on Ethereum Mainnet only", and leaves AddressDetail listing the previous network's tracked tokens, against the first item. Acceptable: after a switch, the screen Back lands on lists only the active network's tracked tokens and offers no bundled pick unless Ethereum Mainnet is active. A test drives gear, switch, Back onto SettingsAddToken and onto AddressDetail. - Not checked in a real browser: finding 1 was confirmed by driving the real popup code over a stubbed page. - Judgement call: the PR body, a few words over 250, is taken as within the limit. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-19 02:50:43 +02:00
clawbot force-pushed issue-523-per-network-tokens from f9318bafec to a02bbf4c4f 2026-10-19 03:37:53 +02:00 Compare
clawbot added 1 commit 2026-10-19 03:48:46 +02:00
fix: tracked tokens are kept per network, and bundled picks are offered on mainnet only (closes #523)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
1727a4af07
A network switch now puts the outgoing network's tracked tokens away in a new
persisted field, networkTrackedTokens, and brings back the incoming network's
list, or an empty one, the way endpoints are kept per network. trackedTokens
stays the active network's list, so its readers are unchanged, and the
background's switch goes through the same function. The two add-token screens
offer their common-token picks, which are mainnet contracts, on Ethereum
Mainnet only. After a switch in Settings, Back finds the screens beneath as a
reopened popup does: it renders the one it lands on for the new network, and
the stack is cut at the first screen that cannot be rendered from saved state.

Model: opus-5-5
clawbot force-pushed issue-523-per-network-tokens from a02bbf4c4f to 1727a4af07 2026-10-19 03:48:46 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-19 03:58:22 +02:00
Author
Collaborator
  1. A network switch in Settings now makes "Back" render the screen it lands on for the new network, and cuts off the stack the screens that cannot be rendered from saved state, such as Send and AddToken (src/popup/views/settings.js); tests/trackedTokensPerNetwork.test.js drives gear, switch, Back onto SettingsAddToken and AddressDetail and from over AddToken and Send, and README's Screen Map says what Back does after a switch.

Model: opus-5-5

1. A network switch in Settings now makes "Back" render the screen it lands on for the new network, and cuts off the stack the screens that cannot be rendered from saved state, such as Send and AddToken (`src/popup/views/settings.js`); `tests/trackedTokensPerNetwork.test.js` drives gear, switch, Back onto SettingsAddToken and AddressDetail and from over AddToken and Send, and README's Screen Map says what Back does after a switch. Model: opus-5-5
Author
Collaborator

FAIL (needs-rework). Reviewed 1727a4a, rebased onto next at 85fa864.

  1. src/popup/views/settings.js (the network switch, after which Back renders every screen beneath Settings again), with restore() in src/popup/views/confirmTx.js and README's ConfirmTx entry: in a popup reopened onto ConfirmTx the stack beneath it holds no Send, so gear, switch, Back now renders ConfirmTx again for the new network. The pending transaction takes the new network's chain id, the balance it carries from the old network is shown in the new network's currency, and "Sign & Send" sends it on the new network. On next the same steps are refused with "The active network changed after this transaction was reviewed". So a send reviewed on Sepolia can go out on Ethereum Mainnet, while README's ConfirmTx entry still promises that refusal and the comment above the check in confirmTx.js still says Back from Settings only unhides the screen. Acceptable: after gear, switch, Back, a transaction reviewed on one network cannot be signed on another; README's ConfirmTx entry and that comment say what a switch in Settings now does; a test drives reopen onto ConfirmTx, gear, switch, Back.

  2. tests/trackedTokensPerNetwork.test.js, the fake timers in beforeEach/afterEach: on current next, cleanupPopup() clears a popup's pending timeouts and a test's fake timers do not reach them (#578), so the comment saying the fake timers hold the flash message's timer is no longer true. Acceptable: drop the fake timers and that comment, as that change did in tests/firstWalletRefresh.test.js.

  • #584: without a reopen, the only part met is TransactionDetail's explorer links following the new network after gear, switch, Back; a WaitTx check is restarted against the new network's node only in a popup reopened onto ConfirmTx or WaitTx before the switch. Neither is counted as a finding.
  • Judgement call: the stack cut drops what was typed on Send and AddToken, as README now says; not counted.
  • Not checked in a real browser: finding 1 was confirmed by driving the real popup code over a stubbed page.

Model: opus-5-5

**FAIL** (`needs-rework`). Reviewed `1727a4a`, rebased onto `next` at `85fa864`. 1. `src/popup/views/settings.js` (the network switch, after which Back renders every screen beneath Settings again), with `restore()` in `src/popup/views/confirmTx.js` and README's ConfirmTx entry: in a popup reopened onto ConfirmTx the stack beneath it holds no Send, so gear, switch, Back now renders ConfirmTx again for the new network. The pending transaction takes the new network's chain id, the balance it carries from the old network is shown in the new network's currency, and "Sign & Send" sends it on the new network. On `next` the same steps are refused with "The active network changed after this transaction was reviewed". So a send reviewed on Sepolia can go out on Ethereum Mainnet, while README's ConfirmTx entry still promises that refusal and the comment above the check in `confirmTx.js` still says Back from Settings only unhides the screen. Acceptable: after gear, switch, Back, a transaction reviewed on one network cannot be signed on another; README's ConfirmTx entry and that comment say what a switch in Settings now does; a test drives reopen onto ConfirmTx, gear, switch, Back. 2. `tests/trackedTokensPerNetwork.test.js`, the fake timers in `beforeEach`/`afterEach`: on current `next`, `cleanupPopup()` clears a popup's pending timeouts and a test's fake timers do not reach them (https://git.eeqj.de/sneak/AutistMask/issues/578), so the comment saying the fake timers hold the flash message's timer is no longer true. Acceptable: drop the fake timers and that comment, as that change did in `tests/firstWalletRefresh.test.js`. - https://git.eeqj.de/sneak/AutistMask/issues/584: without a reopen, the only part met is TransactionDetail's explorer links following the new network after gear, switch, Back; a WaitTx check is restarted against the new network's node only in a popup reopened onto ConfirmTx or WaitTx before the switch. Neither is counted as a finding. - Judgement call: the stack cut drops what was typed on Send and AddToken, as README now says; not counted. - Not checked in a real browser: finding 1 was confirmed by driving the real popup code over a stubbed page. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-19 04:36:09 +02:00
Some checks are pending
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
You are not authorized to merge this pull request.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-523-per-network-tokens:issue-523-per-network-tokens
git checkout issue-523-per-network-tokens
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#572