In the LiquidationPool contract, the increasePosition function allows users to open or increase their staking position, setting transactions in a pending state for at least one day. The consolidatePendingStakes function is then employed to finalize these positions. However, there's a potential risk of this function running out of gas, which could lead to a denial of service.
The consolidatePendingStakes function processes all eligible positions in the pendingStakes array that have been pending for over 24 hours. The absence of an upper limit on the array's size and the function's mechanism to loop through the entire array could result in gas consumption exceeding the block gas limit in scenarios with a large number of pending stakes.
This could potentially lead to consistently failing transactions due to excessive gas requirements, effectively causing a denial of service and hindering the staking process.
If the consolidatePendingStakes function is unable to execute due to gas limitations, it would disrupt the normal operation of the LiquidationPool contract. This interruption could prevent the finalization of pending stakes, affecting the overall functionality of the staking mechanism.
Manual analysis
Modify the consolidatePendingStakes function to incorporate an early termination feature. Since the pendingStakes array is ordered from oldest to newest, the function should terminate as soon as it encounters the first stake that does not meet the 24-hour threshold. This approach will ensure efficient processing by only iterating through relevant stakes, significantly reducing the function's 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.