https://github.com/Cyfrin/2024-07-zaros/blob/main/src/perpetuals/branches/LiquidationBranch.sol#L42-L86
The array initialization in checkLiquidatableAccounts
leads to inefficiencies by potentially allocating more memory than necessary.
The array liquidatableAccountsIds
is initialized with a size based on the upper and lower bounds of the iteration, which might be larger than the actual number of liquidatable accounts, leading to inefficient memory usage and increased gas costs.
Increased Gas Costs: Unnecessary allocation of memory increases gas consumption.
Inefficiency: Potential waste of resources due to oversized array initialization.
Manual
Optimize Array Initialization: Initialize the array to the exact number of liquidatable accounts found.
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.