The Statistics library used in the LLMOracleCoordinator contract has a flaw in its variance function (called by stddev function), where calculating data[i] - mean can cause an underflow if mean exceeds individual data values. Since this stddev function is called in finalizeValidation, this issue results in an unresolvable underflow exception, effectively blocking the finalizeValidation process.
In the Statistics library:
The variance function calculates the squared difference (data[i] - mean)^2 to compute the variance:
If any of data[i] is smaller than mean, the subtraction will result in an underflow, reverting the transaction due to the nature of Solidity >= 0.8.0, for example:
data[] = [1, 3, 5], mean = 3
diff = data[0] - mean = 1 - 3 -> UNDERFLOW (revert)
In the LLMOracleCoordinator contract:
finalizeValidation calls stddev, which depends on the variance calculation. Any underflow during variance calculation causes the transaction to revert:
Since finalizeValidation is called upon task completion after sufficient validations, this underflow issue effectively blocks the validation from completing, leaving the task in an unresolvable state.
The underflow in variance calculation causes a Denial of Service (DoS), as it permanently prevents task finalization. This failure impacts: users and validators because The LLMOracleCoordinator contract cannot complete validation of tasks which requires validation.
Manual Review
Modify the variance function to calculate the absolute difference diff = mean > data[i] ? mean - data[i] : data[i] - mean, ensuring that the difference is always non-negative:
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.