A V4 step that spends part of a currency it bought shows the whole bought minimum as Min. received #574

Closed
opened 2026-10-19 01:46:23 +02:00 by clawbot · 2 comments
Collaborator

Seen by the review of #566.

Where

The approval screen's swap lines for a V4 step, built by decodeV4Swap() in src/shared/uniswap.js.

What happens

A V4 step swaps 1,000 USDT for at least 0.5 WETH, then swaps 0.3 WETH of it for USDC, then pays out with TAKE USDC and TAKE WETH. When the step's output side is WETH, the screen reads Min. received 0.5000 WETH. Only about 0.2 WETH is guaranteed to reach the user: the other 0.3 is spent inside the same step. next reads the same, and so does the PR above.

What should happen

Min. received never states more than the calldata guarantees. When a currency that swap actions in a step buy is also spent by another swap action in that step, the step's bought minimum is not what the user receives, so the screen shows no Min. received figure for it, as the revised plan on #563 does for the other cases it cannot state.

Severity: minor

Definition of done

  • A V4 step whose swap actions spend part of a currency that other swap actions in the step buy shows no Min. received figure for that currency.
  • A test covers the example above.

Model: opus-5-5

Seen by the review of https://git.eeqj.de/sneak/AutistMask/pulls/566. ## Where The approval screen's swap lines for a V4 step, built by `decodeV4Swap()` in `src/shared/uniswap.js`. ## What happens A V4 step swaps 1,000 USDT for at least 0.5 WETH, then swaps 0.3 WETH of it for USDC, then pays out with `TAKE` USDC and `TAKE` WETH. When the step's output side is WETH, the screen reads `Min. received 0.5000 WETH`. Only about 0.2 WETH is guaranteed to reach the user: the other 0.3 is spent inside the same step. `next` reads the same, and so does the PR above. ## What should happen Min. received never states more than the calldata guarantees. When a currency that swap actions in a step buy is also spent by another swap action in that step, the step's bought minimum is not what the user receives, so the screen shows no Min. received figure for it, as the revised plan on https://git.eeqj.de/sneak/AutistMask/issues/563 does for the other cases it cannot state. Severity: minor ## Definition of done - [ ] A V4 step whose swap actions spend part of a currency that other swap actions in the step buy shows no Min. received figure for that currency. - [ ] A test covers the example above. Model: opus-5-5
clawbot self-assigned this 2026-10-19 01:46:23 +02:00
Author
Collaborator

Plan: one PR to next, in decodeV4Swap() in src/shared/uniswap.js. When a currency that swap actions in a V4 step buy is also spent by another swap action in the same step, the step's bought minimum for that currency is not what the user receives, so the step sets no Min. received figure for it, the way the decoder already shows a minimum it cannot state. A test with the issue's example, failing on next; V4 steps whose swap actions do not spend what they buy (Uniswap's own single and multi-hop routes) read as on next.

Model: opus-5-5

Plan: one PR to `next`, in `decodeV4Swap()` in `src/shared/uniswap.js`. When a currency that swap actions in a V4 step buy is also spent by another swap action in the same step, the step's bought minimum for that currency is not what the user receives, so the step sets no `Min. received` figure for it, the way the decoder already shows a minimum it cannot state. A test with the issue's example, failing on `next`; V4 steps whose swap actions do not spend what they buy (Uniswap's own single and multi-hop routes) read as on `next`. Model: opus-5-5
Author
Collaborator

Built in #667: a V4 step whose swap actions also spend its output currency now shows no Min. received line. A multi-hop action through an intermediate currency does not count as spending it.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/AutistMask/pulls/667: a V4 step whose swap actions also spend its output currency now shows no `Min. received` line. A multi-hop action through an intermediate currency does not count as spending it. 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#574