Dria

Swan
NFTHardhat
21,000 USDC
View results
Submission Details
Severity: low
Valid

wrong implement of "getBestResponse"

Summary

if if taskResponses[i].score is equal to highestScore then we are not considering this as we only taking the first highestScore.

Vulnerability Details

function getBestResponse(uint256 taskId) external view returns (TaskResponse memory) {
TaskResponse[] storage taskResponses = responses[taskId];
// ensure that task is completed
if (requests[taskId].status != LLMOracleTask.TaskStatus.Completed) {
revert InvalidTaskStatus(taskId, requests[taskId].status, LLMOracleTask.TaskStatus.Completed);
}
// pick the result with the highest validation score
TaskResponse storage result = taskResponses[0];
uint256 highestScore = result.score;
for (uint256 i = 1; i < taskResponses.length; i++) {
if (taskResponses[i].score > highestScore) {
highestScore = taskResponses[i].score;
result = taskResponses[i];
}
}
return result;
}

}

Impact

wrong calculation of result in getBestResponse.

Tools Used

Recommendations

if (taskResponses[i].score >= highestScore)

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

wrong implementation of "getBestResponse" when there are more than 1 responses with highestScore

Support

FAQs

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