Finding: every valuation through the real BondingCalculator reverts for a sub-18-decimal token pair, taking Treasury tokenValue, deposit and auditReserves down for that token. I executed both legs in forge: a 9 and 6 decimal mock pair reverts with the exact panic 0x11, while the 18 and 18 control returns a value. The remaining premise is a registered sub-18 pair, which is not settleable locally.
Suggested fix: scale by the decimals difference instead of subtracting into an underflow.
Location: StandardBondingCalculator dot sol, getKValue at line 23. Line 26 computes token0 plus token1 minus the pair decimals, and line 29 raises 10 to that power:
markdown on the 9 and 6 pair: reverts with the identical panic
The revert path runs through Treasury tokenValue, deposit and auditReserves. Note the function never returns a wrong number, it reverts, so this is not a mispricing claim.
The one open premise: a registered pair whose decimals sum below 18, for example the 9 decimal ecosystem base token paired with a 6 decimal counterpart. Not settleable locally.
Someone already posted the same issue previously (I tried to find it, but it wasn’t an easy task). The main idea is that we use only WETH as a reserve - or, in the worst case, DAI - and both have 18 decimals. That’s why I believe your issue is valid in general, but we can’t fall into it, since we restrict ourselves to not using other tokens.
Hi team, checking in on this one. The full reproduction is already in the thread from October 6: getKValue subtracts decimals at line 26, and any pair whose decimals add up below 18 reverts valuation with a panic instead of pricing. The open premise is still a registered pair with that decimal shape. Has the team confirmed the underflow, and is there a verdict coming?