DittoEth incentivizes short creation by adding yield to these position, yield for positions is updated with the function updateYield() in LibVault.sol.
However if for any reason the TAPP has more ethEscrowed than the vault, this function will revert
LibVault.sol#updateYield() is called via YieldFacet.sol#updateYield() :
LibVault.sol#UpdateYield() calculates the yield by taking how much zeth has been added to the vault , if no zeth has been added it return, if new zeth has been added yield is calculated by calculating the difference between old balance of zeth and new balance :
Then yield is decremented by calculating how much the treasury (TAPP) owns zeth by dividing this amount from the total of zeth owned by the vault.
However the total number of zeth owned by the vault is not an addition of how much users deposited + how much the treasury owns because treasury can own zeth through multiple process like liquidation :
and treasury can own zeth through withdraw :
So as you can see tapp.ethEscrowed can become bigger as vault.ethEscrowed can be decremented in case of withdrawal.
The main point of this finding is that if tapp.ethEscrowed become bigger than vault.zethTotal it is a problem for updateYield() function. The problem is here :
here we can see that if yield < zethTreasuryReward it will revert with an underflow error
=> if yield < yield.mul(zethTreasury).divU88(zethTotal)
=> if zethTotal < zethTreasury it will revert
So if TAPP.ethEscrowed > Vault.zethTotal, libVault.updateYield() will revert and yield won't be able to be distributed anymore using YieldFacet.sol
DOS of yieldFacet.sol#updateYield()
VSCode
One method could be to add a check to ensure zethTotal > zethTreasury and take the fee only if this check pass, otherwise give the full yield to the vault , or simply revert if zethTotal > zethTreasury
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.