The Statistics::variance
will revert when an element in data
is less than the computed mean, due to unchecked subtraction.
In the variance
function, mean
is calculated using the avg
function, which takes the average of all elements in the data
array. If mean
is greater than one or more elements in data
, calculating diff
as data[i] - mean
will cause underflow, as uint256
cannot represent negative values.
The variance
function is used in stddev
function to compute the standard deviation of the data.
And the stddev
function is used in finalizeValidation
The impact is that when LLMOracleCoordinator::finalizeValidation
is called, unless the scores
are all identical, the function will revert because of the variance function. Which leads to an incomplete validation task.
Manual review.
Use absolute difference to prevent reversion:
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.