Dria

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

User could not specify max amount of fee for request

Summary

User could not specify max amount of fee, which will be transfer to coordinator, when user make request to oracle. Fee could be changed, while user's tx in mempool.

Vulnerability Details

When user call oracleStateRequest() or oraclePurchaseRequest() in his buyer agent contract, contract LLMOracleCoordinator.sol transfer feeToken's from buyerAgent's balance. Amount of transfer depends on swan.getOracleParameters().

getOracleParams function return these data

struct LLMOracleTaskParameters {
/// @notice Difficulty of the task.
uint8 difficulty;
/// @notice Number of generations.
uint40 numGenerations;
/// @notice Number of validations.
uint40 numValidations;
}

These values could be changed by owner of project while user's tx in mempool.

Also, tx consist of platformFee, which value also could be changed, while user's tx in mempool.

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.numValidations * validatorFee)));
}

Platform fee could be changed by owner of project call to LLMOracleManager.sol.setFees()

The problem is that BuyerAgent contract has infinity approve for coordinator contract. So, user could not cotrol amount, which will be transfered from his buyer agent contract.

Impact

User could not cotrol amount, which will be transfered from his buyer agent contract. Fee could changed to too big for user and if he know about new value of fee, he will not make request to oracle.

Tools Used

Manual review

Recommendations

Add parameter in oracleStateRequest() or oraclePurchaseRequest() - maxAmountFee

Updates

Lead Judging Commences

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Appeal created

sovaslava Submitter
8 months ago
inallhonesty Lead Judge
8 months ago
inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

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