variance
will revert in some cases due to underflow
finalizeValidation
is used to finalize any tasks that require validation, where that function invokes stddev
, and then stddev
uses variance
, where the actual issue is. variance
is used to calculate the average
and mean
of an array of scores. Where the function performs some interesting math finding the diff by subtracting the mean from each data index - uint256 diff = data[i] - mean;
However that code is dangerous as it will lead to an underflow in most cases, as the mean
, also known as average, is gonna be bigger then the smallest instances of data.
Example:
We call variance
for this set of scores - [10, 15, 20]
mean
will be calculates as 15 using the avg
function
The first loop will revert as we do diff => data[0] - mean => 10 - 15 => underflow
Core function will revert, causing the whole system to freeze the tasks that require validation.
Manual review
Use an int to calculate the diff.
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.