Open sherlock-admin2 opened 4 months ago
1 comment(s) were left on this issue during the judging contest.
infect3d commented:
that is the reason of the MIN_PRICE state variable
If the yield source is expected to have large jumps in yield (by design or by the prize vault owner's actions) the prize vault owner can either:
smoothingFactor
on the liquidation pair to mitigate the effect within a reasonable efficiency targetEscalate
This issue should be informational
This is clearly a design decision by the protocol
The sponsor has also suggested some ways the prizeVault owner can mitigate this in the vault setup
Even if there is the odd upward fluctuation of yield the current design of the auction system ensures it will correct itself for future liquidations
Escalate
This issue should be informational
This is clearly a design decision by the protocol
The sponsor has also suggested some ways the prizeVault owner can mitigate this in the vault setup
Even if there is the odd upward fluctuation of yield the current design of the auction system ensures it will correct itself for future liquidations
You've created a valid escalation!
To remove the escalation from consideration: Delete your comment.
You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final.
This is clearly a design decision by the protocol
The sponsor has also suggested some ways the prizeVault owner can mitigate this in the vault setup
I don't see how the auction mechanism being a design decision invalidates this issue. I've clearly pointed out how this design decision is incapable of handling upward yield fluctuations, which is an actual problem.
The sponsor has pointed out ways which, in my opinion, only partially mitigate the problem presented. The owner has to either has to temporarily stop liquidations or reduce the percentage of yield that can be liquidated to smooth out the upward fluctuation. Note that both ways are a form of owner intervention, and I don't believe it is documented anywhere on how the owner should deal with upward yield fluctuations.
Even if there is the odd upward fluctuation of yield the current design of the auction system ensures it will correct itself for future liquidations
The prize vault still loses funds for the current liquidation, so this doesn't invalidate anything.
Agree with @MiloTruck comments.
As the report says, the issue may cause loss of funds to users, hence, I believe design decision rule is not appropriate here. Planning to reject the escalation and leave the issue as it is.
Result: Medium Has duplicates
MiloTruck
medium
Price formula in
TpdaLiquidationPair._computePrice()
does not account for a jump in liquidatable balanceSummary
The linearly decreasing auction formula in
TpdaLiquidationPair._computePrice()
does not account for sudden increases in the vault's liquidatable balance, causing the price returned to be much lower than it should be.Vulnerability Detail
The price paid by liquidation bots to liquidate the asset balance in a vault is calculated in
TpdaLiquidationPair._computePrice()
as shown:TpdaLiquidationPair.sol#L191-L195
As seen from above, the price paid decreases linearly over time from
targetAuctionPeriod * lastAuctionPrice
to 0. This allows the liquidation pair to naturally find a price that liquidation bots are willing to pay for the current liquidatable balance in the vault, which is calculated as shown:TpdaLiquidationPair.sol#L184-L186
The vault's liquidatable balance is determined by
liquidatableBalanceOf()
:PrizeVault.sol#L687-L709
Apart from the yield vault suddenly gaining yield, there are two reasons why the vault's liquidatable balance might suddenly increase:
_tokenOut == address(this)
._maxAmountOut = _mintLimit(_totalDebt) = 0
._maxAmountOut
is now1000e18
, which means 1000 more shares can be minted._liquidYield
is restricted by_maxAmountOut
, it jumps from0
to1000e18
, causing a sudden increase in the liquidatable balance.setYieldFeePercentage()
to decreaseyieldFeePercentage
. As seen from above, this will cause the returned value fromliquidatableBalanceOf()
to suddenly increase.However, since the vault's liquidatable balance is not included in price calculation and the price decreases linearly,
TpdaLiquidationPair._computePrice()
cannot accurately account for instantaneous increases inliquidatableBalanceOf()
.Using (1) to illustrate this:
_computePrice()
decreases to near-zero to match the liquidatable balance._computePrice()
will still remain close to 0 USDC.As seen from above, when a sudden increase in liquidatable balance occurs, the price in
_computePrice()
could be too low due to the linearly decreasing auction.Impact
When
liquidatableBalanceOf()
suddenly increases due to an increase in the mint limit or a reduction inyieldFeePercentage
, liquidation bots can swap the liquidatable balance in the vault for less than its actual value. This causes a loss of funds for the vault, and by extension, all users in the vault.Code Snippet
https://github.com/sherlock-audit/2024-05-pooltogether/blob/1aa1b8c028b659585e4c7a6b9b652fb075f86db3/pt-v5-tpda-liquidator/src/TpdaLiquidationPair.sol#L191-L195
https://github.com/sherlock-audit/2024-05-pooltogether/blob/1aa1b8c028b659585e4c7a6b9b652fb075f86db3/pt-v5-tpda-liquidator/src/TpdaLiquidationPair.sol#L184-L186
https://github.com/sherlock-audit/2024-05-pooltogether/blob/1aa1b8c028b659585e4c7a6b9b652fb075f86db3/pt-v5-vault/src/PrizeVault.sol#L687-L709
Tool used
Manual Review
Recommendation
Consider using an alternative auction formula in
_computePrice()
, ideally one that takes into account the current liquidatable balance in the vault.