DeFiHardhatFoundry
250,000 USDC
View results
Submission Details
Severity: medium
Valid

`quickSort` does not actually sort the numbers correctly

Summary

Sops might be wrongly distributed as quickSort does not work properly.

Vulnerability Details

In order to distribute sops as expected, quickSort is used to sort them in an ascending order (from highest to lowest). However, the algorithm used does not work properly and does not always sort them.

Due to time constraints, I was unable to find the exact root cause, but an example input which would prove this claim is the following [4, 2, 5, 3, 7, 6]. This would return [7, 6, 5, 3, 2, 4]

Impact

Can both lead to overdistribution and underdistribution of yield, depending on the Well reserves

Tools Used

Manual review

Recommendations

Use a different sorting algorithm.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

quicksort bad

Appeal created

deadrosesxyz Submitter
about 1 year ago
T1MOH Auditor
about 1 year ago
inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

quicksort bad

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.