Dria

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

Inadequate Fee Validation Allows Zero and Identical Fees

Summary

The LLMOracleManager::setFees function allows the owner to set the platformFee, generationFee, and validationFee, which are critical fees for different functions of the platform. However, the function lacks proper validation, making it possible for the owner to mistakenly input zero values for any of the fees. According to the documentation, "To keep a fee unchanged, provide the same value." While setting fees, the owner might inadvertently set all the fees to the same value, which conflicts with the intended use.

Each fee has a distinct purpose:

  • The platformFee is a fixed fee for using the platform.

  • The generationFee is a base fee for generating LLM output, scaled based on difficulty and the number of generations.

  • The validationFee mirrors the generationFee but applies to validation.

Since these fees serve different functions, they must be distinct, and setting them to identical values undermines their intended separation.

Vulnerability Details

The LLMOracleManager::setFees function is responsible for setting the platform, generation, and validation fees. However, it lacks proper validation checks to prevent the owner (who acts as the admin) from mistakenly inputting zero values for any of the fees. Additionally, the function doesn't handle cases where the fees are set to identical values, which is problematic since each fee serves a different purpose. The platform fee should differ from the generation fee, and the validation fee should be distinct from the others, reflecting their unique roles in the system.

function setFees(uint256 _platformFee, uint256 _generationFee, uint256 _validationFee) public onlyOwner {
//@audit No proper validation on fees and identical fees input
platformFee = _platformFee;
generationFee = _generationFee;
validationFee = _validationFee;
}
  1. The admin can mistakenly set the platform fee to zero while correctly setting the generation and validation fees. This error could result in the platform losing revenue due to the admin's oversight in setting the platform fee, which is a critical source of income. Proper validation is necessary to prevent such mistakes and ensure that all fees are appropriately set.

  2. The admin can mistakenly set the same amount for the platform fee, generation fee, and validation fee, even though each fee serves a different purpose. This error could result in either loss or inadequate fees being charged, as these fees are intended to be distinct from one another to reflect their specific functions. Proper validation is required to prevent this issue and ensure the fees are set appropriately.

Impact

If the LLMOracleManager::setFees function allows the admin to set zero or identical fees for the platform, generation, and validation, it could lead to significant financial loss and operational inefficiency. Setting the platform fee to zero would result in a complete loss of revenue from platform usage, while identical fees for generation and validation would undermine the distinction between their roles, leading to inaccurate pricing models. Over time, this vulnerability could severely affect the platform's revenue streams, distort fee structures, and compromise the system's intended functionality.

Tools Used

Manuel Review

Recommendations

function setFees(uint256 _platformFee, uint256 _generationFee, uint256 _validationFee) public onlyOwner {
// Ensure that no fee is set to zero
+ require(_platformFee > 0, "Platform fee cannot be zero");
+ require(_generationFee > 0, "Generation fee cannot be zero");
+ require(_validationFee > 0, "Validation fee cannot be zero");
// Ensure that not all fees are the same
+ require(
_platformFee != _generationFee ||
_platformFee != _validationFee ||
_generationFee != _validationFee,
"All fees cannot be the same"
);
platformFee = _platformFee;
generationFee = _generationFee;
validationFee = _validationFee;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 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.