An address is never falsy once set, but an amount of 0n is. So a hop that supplies a zero amountIn fixes Token In permanently while leaving inputAmount open, and the next hop's figure is then displayed against the first hop's token, at that token's scale.
Measured — a V3 hop USDT -> WETH with amountIn = 0, followed by a V2 hop WETH -> USDC with amountIn = 0.5e18:
Token In = USDT (0xdac17f958d2ee523a2206206994597c13d831ec7)
Amount = 500000000000.0000 USDT
The 0.5 WETH figure of the second hop, rendered as 500 billion USDT. Nothing on the screen is true.
Same falsy-collapse class this repo keeps hitting — #246, #306, #322 — and the exact input-side counterpart of #359, whose text covers only minOutput and the output token. Both sides want the same remedy and could reasonably be one unit.
Not fixed in #365 (the fix for #357): that unit was scoped away from the truthiness gates, and its own change — null means undetermined — does not touch this, which produces a determined-but-wrong token.
Definition of done
inputToken and inputAmount are gated on explicit presence (=== null) rather than truthiness, so a genuine 0 amount is a real value and cannot be superseded by a later hop's figure.
An amount and the token it is counted in always come from the same hop; a figure is never rendered against a token that did not supply it.
Test: a hop with amountIn of 0n followed by a hop in a different token. Fails against current head — state the mutation and observed result.
make check green.
Found while resolving https://git.eeqj.de/sneak/AutistMask/issues/357, measured by execution rather than inferred. Pre-existing; not introduced there.
`src/shared/uniswap.js` gates the input side on truthiness, and the token and the amount are gated independently:
```js
if (!inputToken) inputToken = s.tokenIn;
if (!inputAmount) inputAmount = s.amountIn;
```
An address is never falsy once set, but an amount of `0n` is. So a hop that supplies a zero `amountIn` fixes `Token In` permanently while leaving `inputAmount` open, and the next hop's figure is then displayed against the first hop's token, at that token's scale.
Measured — a V3 hop `USDT -> WETH` with `amountIn = 0`, followed by a V2 hop `WETH -> USDC` with `amountIn = 0.5e18`:
```
Token In = USDT (0xdac17f958d2ee523a2206206994597c13d831ec7)
Amount = 500000000000.0000 USDT
```
The 0.5 WETH figure of the second hop, rendered as 500 billion USDT. Nothing on the screen is true.
Same falsy-collapse class this repo keeps hitting — https://git.eeqj.de/sneak/AutistMask/issues/246, https://git.eeqj.de/sneak/AutistMask/issues/306, https://git.eeqj.de/sneak/AutistMask/issues/322 — and the exact input-side counterpart of https://git.eeqj.de/sneak/AutistMask/issues/359, whose text covers only `minOutput` and the output token. Both sides want the same remedy and could reasonably be one unit.
Not fixed in https://git.eeqj.de/sneak/AutistMask/pulls/365 (the fix for https://git.eeqj.de/sneak/AutistMask/issues/357): that unit was scoped away from the truthiness gates, and its own change — null means undetermined — does not touch this, which produces a determined-but-wrong token.
## Definition of done
- [ ] `inputToken` and `inputAmount` are gated on explicit presence (`=== null`) rather than truthiness, so a genuine `0` amount is a real value and cannot be superseded by a later hop's figure.
- [ ] An amount and the token it is counted in always come from the same hop; a figure is never rendered against a token that did not supply it.
- [ ] Test: a hop with `amountIn` of `0n` followed by a hop in a different token. Fails against current head — state the mutation and observed result.
- [ ] `make check` green.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found while resolving #357, measured by execution rather than inferred. Pre-existing; not introduced there.
src/shared/uniswap.jsgates the input side on truthiness, and the token and the amount are gated independently:An address is never falsy once set, but an amount of
0nis. So a hop that supplies a zeroamountInfixesToken Inpermanently while leavinginputAmountopen, and the next hop's figure is then displayed against the first hop's token, at that token's scale.Measured — a V3 hop
USDT -> WETHwithamountIn = 0, followed by a V2 hopWETH -> USDCwithamountIn = 0.5e18:The 0.5 WETH figure of the second hop, rendered as 500 billion USDT. Nothing on the screen is true.
Same falsy-collapse class this repo keeps hitting — #246, #306, #322 — and the exact input-side counterpart of #359, whose text covers only
minOutputand the output token. Both sides want the same remedy and could reasonably be one unit.Not fixed in #365 (the fix for #357): that unit was scoped away from the truthiness gates, and its own change — null means undetermined — does not touch this, which produces a determined-but-wrong token.
Definition of done
inputTokenandinputAmountare gated on explicit presence (=== null) rather than truthiness, so a genuine0amount is a real value and cannot be superseded by a later hop's figure.amountInof0nfollowed by a hop in a different token. Fails against current head — state the mutation and observed result.make checkgreen.