Statistics.stddev() always reverts because of a design error in variance() function
stddev() function (used in BuyerAgent.finalizeValidation()) returns the standard deviation value for a set of numbers took as parameters. Standard deviation is calculated as the square root of variance, which is another function of Statistics library.
However, variance() function will always revert as it calculates a negative uint256 if any of the input numbers is lower than mean (what will happen always except if all the input numbers are the same value, which is an unrealistic case for this situation).
This is the code line that causes the issue:
Requests that require validations will never be completed as BuyerAgent.finalizeValidation() reverts whenever is called as explained above. As a consequence, generators and validators that took part in the corresponding taskId will not receive the generatorFee and validatorFee respectively, and the task will never get the Completed status.
Manual review, Remix
Modify the variance() function so that no negative uint256 numbers are computed:
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.