Invocations to abortBidTaker
should refund the taker their collateral, however due to an unsafe sequence of operations, user deposits are vulnerable to severe precision loss.
When aborting a taker's Bid
for a maker's Ask
, the taker is free to reclaim their capital via closeBidTaker
(refunds via RemainingCash
) or abortBidTaker
(refunds via MakerRefund
).
In the latter case, the calculated MakerRefund
is computed as follows:
This is vulnerable to precision loss.
Let's consider the following offer.
This combination of
points
andamount
is used frequently (1 2 3) throughoutPreMarkets.t.sol
, and is therefore in the opinion of Tadle to be a rational order configuration):
If we imagine a taker opts to fulfill the entire offer (1_000
points), a refund of their input amount evaluates to as follows:
The user's deposit is devalued to zero, since integer math evaluates:
We should note that when applying the "real" precision of USDC (
e6
), the taker's deposit continues to be subject to excessive devaluation.
Consequently, the user's deposit has been lost using an order configuration especially supported by the team.
Excessive devaluation of claim to refunded collateral when using an intended (recommended) order configuration.
Manual Review
Calculate using a higher precision:
Valid medium, given the free nature of the markets, it may be possible that such an offer type where both low amount of points correspond to lower decimal and lower amount of collateral value, so I believe medium severity is appropriate.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.