In FundFlowController the function _sortIndexesDescending sorts an array of values in descending order and returns an array of the original indices corresponding to the sorted values. It employs a bubble sort algorithm, which is simple but inefficient for large arrays due to its quadratic time complexity.
Inefficient Sorting (Bubble Sort):
Bubble sort has O(n²) complexity, making it slow and gas-inefficient for large arrays.
This can lead to high gas costs and potential out-of-gas errors during execution, especially with larger datasets.
Performance Bottleneck:
The algorithm's inefficiency limits contract scalability, reducing performance as array sizes grow.
Manual review
Replace the bubble sort with a more efficient algorithm like QuickSort or MergeSort, both of which have average time complexities of O(n log n). This will significantly reduce execution time and gas consumption for large arrays.
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.