Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: high
Valid

`getVaultAccumulatedValues` will not account new debt if previous one was 0

Summary

In the getVaultAccumulatedValues the a wrong condition is used to account for debt change.

Vulnerability Details

The realized debt change will not account for any change when lastVaultDistributedRealizedDebtUsdPerShareX18 was zero.

realizedDebtChangeUsdX18 = !lastVaultDistributedRealizedDebtUsdPerShareX18.isZero()
? sd59x18(self.realizedDebtUsdPerVaultShare).sub(lastVaultDistributedRealizedDebtUsdPerShareX18).mul(
vaultCreditShareX18.intoSD59x18()
)
: SD59x18_ZERO;

This is incorrect as the first debt change will be accounted incorrectly.

Impact

First accumulated values will not be accounted properly

Tools Used

Manual Review

Recommendations

Remove the conditional logic.

Updates

Lead Judging Commences

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Appeal created

novaman33 Submitter
6 months ago
inallhonesty Lead Judge
6 months ago
inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Vault and market state updates are incorrectly skipped when lastVaultDistributed values are zero, requiring WETH fees before accounting starts working

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.