Users may lose a small portion of promised returns due to precision loss #305
Labels
1 (Low Risk)
Assets are not at risk. State handling, function incorrect as to spec, issues with comments
bug
Something isn't working
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/AuctionEscapeHatch.sol#L131-L140
If we assume that
maxEarlyExitBps
is 200 andcooloffPeriod
is 1 day, whenprogressionBps
less than 50,(maxEarlyExitBps * progressionBps / 10000)
will be 0 due to precision loss, which resulted inmaxProfit
is 0.When
maxEarlyExitBps
is set smaller, the margin of error will be even larger.POC
Given:
purchaseArbitrageTokens()
and purchase with 8,000 DAI;exitEarly()
, it will mint 8,888.88 Malt and receive 8,000 DAI, while it's expected to 8,890 MALT and 8,000.96 DAI.Recommendation
Change to:
The text was updated successfully, but these errors were encountered: