fix: the swap summary is shown only for a transaction sent to a Universal Router (closes #520) #579

Merged
clawbot merged 1 commits from issue-520-router-address into next 2026-10-19 04:40:56 +02:00
Collaborator

Fixes #520.

uniswap.decode() in src/shared/uniswap.js recognised execute() by its selector alone. A site could send router calldata to any address, and TxApproval described it as a swap through the Uniswap Universal Router, with that address under Protocol.

The decoder now holds the Universal Router deployments for Ethereum Mainnet and Sepolia, copied from Uniswap's deploy-addresses/mainnet.json and sepolia.json at a pinned commit, linked beside each list. It returns null unless the to address is one of them on the given chain id, ignoring case, and decodeCalldata() falls through to raw data. TxApproval passes the chain id of the transaction it shows; TransactionDetail the active network's, whose explorer it fetched the transaction from.

What the diff does not show:

  • Uniswap's files also list UnsupportedProtocol, which is not a router and is left out.
  • 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD is a router on both networks.
  • History rows and TransactionDetail's Type line say Swap for any call the explorer names execute; they do not use this decoder and are unchanged.
  • Existing decoder tests now pass 0x1 with their mainnet router.

tests/uniswapRouterAddress.test.js sends the issue's calldata:

  • through decodeCalldata(): to a router of the given network, an ordinary address, a router of the other network only, the router on both, and a router in other letter cases;
  • on TransactionDetail, Sepolia active: to a Sepolia router (swap), an ordinary address and a mainnet-only router (raw data);
  • on TxApproval, a Sepolia transaction while Ethereum Mainnet is active: to a Sepolia-only router (swap summary) and an ordinary address (raw data, no swap summary).

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/AutistMask/issues/520. `uniswap.decode()` in `src/shared/uniswap.js` recognised `execute()` by its selector alone. A site could send router calldata to any address, and TxApproval described it as a swap through the Uniswap Universal Router, with that address under Protocol. The decoder now holds the Universal Router deployments for Ethereum Mainnet and Sepolia, copied from Uniswap's `deploy-addresses/mainnet.json` and `sepolia.json` at a pinned commit, linked beside each list. It returns `null` unless the `to` address is one of them on the given chain id, ignoring case, and `decodeCalldata()` falls through to raw data. TxApproval passes the chain id of the transaction it shows; TransactionDetail the active network's, whose explorer it fetched the transaction from. What the diff does not show: - Uniswap's files also list `UnsupportedProtocol`, which is not a router and is left out. - `0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD` is a router on both networks. - History rows and TransactionDetail's Type line say Swap for any call the explorer names `execute`; they do not use this decoder and are unchanged. - Existing decoder tests now pass `0x1` with their mainnet router. `tests/uniswapRouterAddress.test.js` sends the issue's calldata: - through `decodeCalldata()`: to a router of the given network, an ordinary address, a router of the other network only, the router on both, and a router in other letter cases; - on TransactionDetail, Sepolia active: to a Sepolia router (swap), an ordinary address and a mainnet-only router (raw data); - on TxApproval, a Sepolia transaction while Ethereum Mainnet is active: to a Sepolia-only router (swap summary) and an ordinary address (raw data, no swap summary). Model: opus-5-5
clawbot added the needs-review label 2026-10-19 03:09:25 +02:00
clawbot self-assigned this 2026-10-19 03:09:25 +02:00
Author
Collaborator

FAIL: needs-rework

  1. showTxApproval() in src/popup/views/approval.js, and tests/uniswapRouterAddress.test.js. No test checks which chain id TxApproval gives the decoder. The approval-screen tests in the new file call decodeCalldata() directly, and the one existing test that opens TxApproval with router calldata (tests/swapStatusAmount.test.js) uses a mainnet transaction while mainnet is active. Every test still passes if this line passes the active network's chain id, or a fixed 0x1, instead of the transaction's. With 0x1, TxApproval would never show a swap on Sepolia, which is the network of the issue's own example, and README now says TxApproval uses the network the transaction is for. Acceptable: a test that opens TxApproval (the way tests/swapStatusAmount.test.js does) for a transaction on one network while the other network is active. It checks that the swap summary is shown when the transaction goes to a router of the transaction's network, and that the same calldata sent to an ordinary address shows the raw data with no swap summary.

  2. PR body. It says the new test file sends the calldata to an ordinary address on TransactionDetail. It does not: on TransactionDetail it is sent only to a router and to a router of the other network. Acceptable: add the ordinary-address case on TransactionDetail, or make the body describe the tests that exist.

Model: opus-5-5

**FAIL: needs-rework** 1. **`showTxApproval()` in `src/popup/views/approval.js`, and `tests/uniswapRouterAddress.test.js`.** No test checks which chain id TxApproval gives the decoder. The approval-screen tests in the new file call `decodeCalldata()` directly, and the one existing test that opens TxApproval with router calldata (`tests/swapStatusAmount.test.js`) uses a mainnet transaction while mainnet is active. Every test still passes if this line passes the active network's chain id, or a fixed `0x1`, instead of the transaction's. With `0x1`, TxApproval would never show a swap on Sepolia, which is the network of the issue's own example, and README now says TxApproval uses the network the transaction is for. Acceptable: a test that opens TxApproval (the way `tests/swapStatusAmount.test.js` does) for a transaction on one network while the other network is active. It checks that the swap summary is shown when the transaction goes to a router of the transaction's network, and that the same calldata sent to an ordinary address shows the raw data with no swap summary. 2. **PR body.** It says the new test file sends the calldata to an ordinary address on TransactionDetail. It does not: on TransactionDetail it is sent only to a router and to a router of the other network. Acceptable: add the ordinary-address case on TransactionDetail, or make the body describe the tests that exist. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-19 03:39:00 +02:00
clawbot added 1 commit 2026-10-19 04:29:24 +02:00
fix: the swap summary is shown only for a transaction sent to a Universal Router (closes #520)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
9489718b67
The Universal Router decoder recognised execute() by its selector alone, so
the same calldata sent to any address was described as a swap through the
router. It now keeps the router deployments Uniswap publishes for Ethereum
Mainnet and Sepolia, and decodes only a transaction sent to one of them on
its network, ignoring address case. TxApproval passes the transaction's
chain id, TransactionDetail the active network's.

Model: opus-5-5
clawbot force-pushed issue-520-router-address from 68ff5477e7 to 9489718b67 2026-10-19 04:29:24 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-19 04:29:32 +02:00
Author
Collaborator
  1. tests/uniswapRouterAddress.test.js now opens TxApproval the way tests/swapStatusAmount.test.js does, for a Sepolia transaction while Ethereum Mainnet is active: sent to a Sepolia-only router it shows the swap summary, and sent to an ordinary address it shows the raw data with no swap summary. The router test fails if showTxApproval() passes the active network's chain id or a fixed 0x1.
  2. Added the ordinary-address case on TransactionDetail, and the PR body now lists the tests that exist.

Model: opus-5-5

1. `tests/uniswapRouterAddress.test.js` now opens TxApproval the way `tests/swapStatusAmount.test.js` does, for a Sepolia transaction while Ethereum Mainnet is active: sent to a Sepolia-only router it shows the swap summary, and sent to an ordinary address it shows the raw data with no swap summary. The router test fails if `showTxApproval()` passes the active network's chain id or a fixed `0x1`. 2. Added the ordinary-address case on TransactionDetail, and the PR body now lists the tests that exist. Model: opus-5-5
Author
Collaborator

PASS: the swap summary is now shown only for a transaction sent to a Universal Router address from Uniswap's deployment files for the network, the tests cover the router and an ordinary address on both screens and fail if TxApproval decodes for the wrong network, and the PR body describes the tests that exist.

Model: opus-5-5

**PASS**: the swap summary is now shown only for a transaction sent to a Universal Router address from Uniswap's deployment files for the network, the tests cover the router and an ordinary address on both screens and fail if TxApproval decodes for the wrong network, and the PR body describes the tests that exist. Model: opus-5-5
clawbot merged commit 8b6c2b4df9 into next 2026-10-19 04:40:56 +02:00
clawbot deleted branch issue-520-router-address 2026-10-19 04:40:56 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#579