A swap step allowed to revert still has its minimum shown as received #602

Closed
opened 2026-10-19 10:07:16 +02:00 by clawbot · 0 comments
Collaborator

Found by the worker on #598.

Where

The swap decoder, decode() in src/shared/uniswap.js. Each Universal Router command byte carries an allow-revert flag (0x80): when it is set, the router carries on if that step fails, instead of reverting the whole transaction. The decoder reads the command type and ignores the flag.

What happens

A swap step marked allow-revert can fail without anything else failing, so its minimum is not guaranteed. The approval screen still shows that step's minimum as Min. received. The rule recorded on #594 (a payout to the pair the next V2 step spends is a hop, because the router enforces that next swap's minimum) also assumes the next step cannot fail silently.

What should happen

Min. received states only what the calldata guarantees. A step that may fail without reverting the transaction does not guarantee its minimum: when the step that sets the output side, a step that pays it out, or a hop's next step carries the allow-revert flag, the screen does not call the minimum received, and the Steps line marks the step as allowed to fail.

Severity: major

Definition of done

  • A swap, payout or hop step carrying the allow-revert flag never has its minimum called received.
  • The Steps line marks such a step.
  • Tests with and without the flag on each.

Model: opus-5-5

Found by the worker on https://git.eeqj.de/sneak/AutistMask/pulls/598. ## Where The swap decoder, `decode()` in `src/shared/uniswap.js`. Each Universal Router command byte carries an allow-revert flag (`0x80`): when it is set, the router carries on if that step fails, instead of reverting the whole transaction. The decoder reads the command type and ignores the flag. ## What happens A swap step marked allow-revert can fail without anything else failing, so its minimum is not guaranteed. The approval screen still shows that step's minimum as `Min. received`. The rule recorded on https://git.eeqj.de/sneak/AutistMask/issues/594 (a payout to the pair the next V2 step spends is a hop, because the router enforces that next swap's minimum) also assumes the next step cannot fail silently. ## What should happen `Min. received` states only what the calldata guarantees. A step that may fail without reverting the transaction does not guarantee its minimum: when the step that sets the output side, a step that pays it out, or a hop's next step carries the allow-revert flag, the screen does not call the minimum received, and the Steps line marks the step as allowed to fail. Severity: major ## Definition of done - [ ] A swap, payout or hop step carrying the allow-revert flag never has its minimum called received. - [ ] The Steps line marks such a step. - [ ] Tests with and without the flag on each. Model: opus-5-5
clawbot self-assigned this 2026-10-19 10:07:16 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#602