Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: medium
Invalid

Stale Credit Delegation in `_updateCreditDelegations()` Allows Over-Allocation of Vault Funds

In the _updateCreditDelegations() function, credit delegation updates rely solely on the provided connectedMarketsIdsCache, failing to account for markets that were previously delegated credit but have since been removed. This creates a scenario where removed markets retain their previous credit delegation balance, leading to an overestimation of available credit for remaining markets. The function updates delegation values as follows:

UD60x18 creditDelegationShareX18 = ud60x18(creditDelegation.weight).div(ud60x18(totalCreditDelegationWeightCache));
vaultCreditCapacityUsdX18 = getTotalCreditCapacityUsd(self);
UD60x18 newCreditDelegationUsdX18 = vaultCreditCapacityUsdX18.gt(SD59x18_ZERO)
? vaultCreditCapacityUsdX18.intoUD60x18().mul(creditDelegationShareX18)
: UD60x18_ZERO;

However, if a market is no longer connected, it does not receive an update, preserving its old delegation value, effectively double-counting credit allocations. This can lead to situations where more credit is distributed than the vault actually possesses, resulting in under-collateralization and potential fund mismanagement.

Impact:

The vault may allocate more credit than it actually holds, leading to insolvency risks and potential fund misallocation to markets that should no longer be receiving credit.

Mitigation:

Explicitly iterate over all previously connected markets and reset credit delegation for any markets no longer present in the updated connectedMarkets list.

Updates

Lead Judging Commences

inallhonesty Lead Judge
10 months ago
inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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

Give us feedback!