Dria

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

getFee(LLMOracleTaskParameters) on LLMOracleManager contract is wrongly calculated

Summary

Fee is not calculated properly.

Vulnerability Details

Calculation of the getFee(LLMOracleTaskParameters) function is wrong because it does not calculate the fee so that every generation has to be validated. If there are 3 generations and 4 validators then the amount of validations is 12 (3*4 -> every generations is validated 4 times). As per sponsor explanation

Impact

Fee mechanism is erroneously calculated leading to a wrong calculation of totalFee.

Tools Used

Manual review

Recommendations

Rewrite getFee(LLMOracleTaskParameters) to following:

function getFee(LLMOracleTaskParameters calldata parameters)
public
view
returns (uint256 totalFee, uint256 generatorFee, uint256 validatorFee)
{
uint256 diff = (2 << uint256(parameters.difficulty));
generatorFee = diff * generationFee;
validatorFee = diff * validationFee;
totalFee = platformFee + (parameters.numGenerations * generatorFee) + (parameters.numGenerations * parameters.numValidations * validatorFee);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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