Submitted by hansfriese
When the seller finalizes his auction, all bids are sorted according to the quotePerBase and its calculated using the FixedPointMathLib.mulDivDown().
And the earliest bid will be used first for the same quotePerBase but this ratio is not strict enough so that the worse bid might be filled than the better one.
As a result, the seller might receive fewer quote token than he wants.
This is the test to show the scenario.
This is the output of the test.
When it calculates the quotePerBase, they are same each other with (base, quote) = (K+1, K) and (K+2, K+1) when K = 1<<64.
So the seller can receive K+1 of the quote token but he got K.
I think K is realistic enough with the 18 decimals token because K is around 18 * 1e18.
Foundry
As we can see from the test, its not strict enough to compare bidders using quotePerBase.
We can compare them by multiplying them like below.
$\frac {quote1}{base1} >= \frac{quote2}{base2} <=> quote1 * base2 >= quote2 * base1$
So we can add 2 elements to FinalizeData struct and modify this comparison like below.
0xean (judge) commented:
RagePit (SIZE) confirmed and commented:
Trust (warden) commented:
hansfriese (warden) commented:
Trust (warden) commented:
hansfriese (warden) commented:
0xean (judge) commented:
