Incorrect weight calculation, due to not summing up weights when calculating total weight leads to incorrect share values being outputted causing significant impacts in many parts of the protocol.
Here is the Vault::updateVaultAndCreditDelegationWeight
function. The problem with this is that each weight is set to newWeight and the totalCreditDelegationWeight is also set to newWeight. As a result, in Vault::_updateCreditDelegations
, each market will have a credit delegation share of 1:
since 2 of the same numbers divided by each other equal 1.
As a result, the new credit capacity each vault receives will be higher than it should be:
This now incorrect value is set to be creditDelegation.valueUsd
, therefore this value is also too high.
Then, when Vault::_recalculateConnectedMarketsState
is called, incorrect values are used therefore, potentially leading to protocol insolvency since all the values for ctx.realizedDebtChangeUsdX18
/ ctx.unrealizedDebtChangeUsdX18
/ ctx.usdcCreditChangeX18
will be higher than they should be.
This incorrect values could lead to many issues, one for example being deleveraging taking place prematurely as the realised debt is too high for example so users lose profit they shouldn't use.
Auto deleveraging occurs too early causing unjustified extraction of profits from legitimate users.
Manual review
Set weight values correctly by summing them up when calculating th etotal.
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.