The pendingStakes array in the LiquidationPool contract does not have any limit to its size and there is no upper bound to how large it can get. This can cause "Out of gas" or "Block Gas Limit" errors in loops which are required to iterate over all the indices in this array.
Everytime LiquidationPool::increasePosition is called, this pushes a new stake into the pendingStakes array. As there is no limit to the size, the array can grow infinitely large.
https://github.com/Cyfrin/2023-12-the-standard/blob/91132936cb09ef9bf82f38ab1106346e2ad60f91/contracts/LiquidationPool.sol#L134-L142
Everytime LiquidationPool::consolidatePendingStakes is called within the contract, it has to iterate over the whole pendingStakes array, if in the worst case this is too large, then any function that calls consolidatePendingStakes will revert due to "Out of Gas" and "Block Gas Limit" errors.
This means any function calling consolidatePendingStakes will revert due to "Out of Gas" and "Block Gas Limit" errors. The functions that call this are decreasePosition and distributeAssets, hence meaning users wouldn't be able to decrease their position of the stake and the pool manager won't be able to distribute the assets. Not only this, the gas cost to the array becomes even more expensive.
Manual Review
Implement size checks or limitations on array growth within the increasePosition function.
Alternatively, Consider alternative data structures or pagination techniques to manage large datasets more efficiently and control gas consumption.
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.