Dria

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

Using `storage` for `view` functions is not needed

Description

When calling Coordinator::getBestResponse(), we are reading the value of responses and getting the best response. But we are reading the value as storage instead of memory.

llm/LLMOracleCoordinator.sol#L405-L413

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++) { ... }
return result;
}

Recommendations

Use memory instead of memory

Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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