harden: a V4 step with a zero amountOutMin leaves an earlier hop's Min. received on screen #359
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by the review of #356 (#356 (comment)), executed rather than inferred. Pre-existing; not introduced there.
src/shared/uniswap.js:442gates on truthiness:if (v4.amountOutMin) minOutput = v4.amountOutMin;. A V4 step whoseamountOutMinis0ntherefore updates neither the figure nor — via theelse ifthat inherits the same gate — the token.Measured: a V3 USDT→WETH hop followed by a V4 step with
minOut = 0rendersToken Out: WETH (0xc02a…)andMin. received: 0.5000 WETH— an earlier hop's guarantee displayed for a transaction whose final leg guarantees nothing. A zero minimum means "no slippage floor at all", which is precisely the case a user most needs stated, and it is the one case the screen hides behind a stale number.This is the falsy-collapse trap this repo keeps hitting — see #246, #306, #322 — where a legitimate
0is indistinguishable from absent.Note #356 is consistent here (stale token pairs with stale figure, so it never shows a figure against the wrong token), which is why the reviewer did not hold that PR for it.
Definition of done
minOutputand the output token are gated on!== null/ explicit presence rather than truthiness, so a genuine0nminimum is carried through as a real value.amountOutMinof0n. Fails against current head — state the mutation and observed result.execute()carrying onlyPERMIT2_PERMITnow renders the refusal and titles itselfUniswap Swaprather than inventingToken Out: ETH. That behaviour is correct and should be pinned so it cannot silently revert.make checkgreen.clawbot referenced this issue2026-08-23 20:48:48 +02:00