The memory array intialised with length but not populated empty array will be passed as an arguments which leads incorrect calculation and accounting in protocol.
The function recalculateVaultsCreditCapacity()
is used to calculate the vaults' credit capacity and update it based on the markets they are connected to. The connected markets are stored as an EnumerableSet
, which can become corrupted when using the .remove()
function, as it does not guarantee ordering. To address this, the developer attempts to cache the connected market IDs but declares them without initializing them.
In above code snippet we can see that connectedMarketsIdsCache passed without populate it. In function updateVaultAndCreditDelegationWeight() it used for-loop lenght condition
But in function it is used to copy markets Ids to rehydrated but with empty array default 0 will be copy this leads to incorrect calculation and accounting
It will break the protocol accounting and calculations by passing empty array.
Foundry , Manual view
Populate before Passes as an Arguments
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.