harden: state an undetermined V4 output token as undetermined, not as ETH (closes #353)
All checks were successful
check / check (push) Successful in 34s
e2e / e2e-chrome (push) Successful in 1m47s
e2e / e2e-firefox (push) Successful in 31s

A V4 swap could set minOutput while leaving outputToken null, and tokenInfo(null) returned ETH at 18 decimals, so the approval screen named an asset the calldata never stated. Established from the V4 encoding that this is wrong rather than protocol semantics: Currency is a user-defined value type over address, so native ETH arrives as the truthy zero-address string and is already mapped to ETH, and an UNWRAP_WETH output is caught earlier — both genuine native-ETH routes are covered without null, so null can only mean no sub-action yielded a currency. A genuine native-ETH V4 swap still renders as ETH, pinned by test against the real mainnet fixture.

The same gate also let a later step overwrite minOutput while an earlier hop's outputToken stayed on screen, showing a figure against the wrong token. Fixed together as the same two lines and the same defect.
This commit was merged in pull request #356.
This commit is contained in:
2026-08-23 18:13:20 +02:00
parent bd0a626e7b
commit 28a527295a
3 changed files with 260 additions and 4 deletions

12
TODO.md
View File

@@ -45,6 +45,18 @@ but the review is broader than any of them.
# Completed Steps
- 2026-08-23: A swap whose output token the calldata never named is said to be
unknown instead of being called ETH
([#353](https://git.eeqj.de/sneak/AutistMask/issues/353)). `tokenInfo(null)`
answers `{symbol: "ETH", decimals: 18}`, and a V4 step could take the
`Min. received` figure while naming no output currency, so the approval screen
stated the wrong asset at the wrong scale. Null is not how V4 spells native
ETH: v4-core's `type Currency is address` wraps `address(0)` for it, which
reaches the decoder as the truthy string
`0x0000000000000000000000000000000000000000` and is named ETH there already.
`Token Out` now reads `Unknown (not named in the calldata)` and
`Min. received` falls to the base-unit refusal from
[#340](https://git.eeqj.de/sneak/AutistMask/issues/340).
- 2026-08-23: The background no longer reads or writes the shared `state`
singleton ([#324](https://git.eeqj.de/sneak/AutistMask/issues/324)), which
also closes the cold-worker wrong-chain send