Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: low
Invalid

[L-02] Redundant Checks on Unsigned Integer Values in `ChainlinkARDOracle` contract

Summary:

The contract contains checks to determine if certain unsigned integer values are less than zero. Given the nature of unsigned integers (they can never be negative), these checks are redundant and can be safely removed to simplify the code and save on gas costs.


Vulnerability Details:

In the following functions:

  1. addTokenMaxDelay

  2. addTokenMaxDeviation

The contract checks if the values maxDelay and maxDeviation are less than zero using the conditions:

if (maxDelay < 0) revert Errors.TokenPriceFeedMaxDelayMustBeGreaterOrEqualToZero();

and

if (maxDeviation < 0) revert Errors.TokenPriceFeedMaxDeviationMustBeGreaterOrEqualToZero();

These checks are unnecessary since maxDelay and maxDeviation are of the uint256 type, which can never be negative.


Impact:

This does not pose a direct security risk but introduces unnecessary complexity to the code. It may confuse developers or auditors who later review the contract, thinking there might be some special reason for the check.


Tools Used:

Manual Review


Recommendations:

  1. Removal of Redundant Checks: The checks for maxDelay and maxDeviation being less than zero can be safely removed from the contract.

    Before:

    if (maxDelay < 0) revert Errors.TokenPriceFeedMaxDelayMustBeGreaterOrEqualToZero(); and
    if (maxDeviation < 0) revert Errors.TokenPriceFeedMaxDeviationMustBeGreaterOrEqualToZero();

    After:

    // No need for the check, simply proceed with the function's logic.
Updates

Lead Judging Commences

hans Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

INFO: Unnecessary maxDelay/maxDeviation check

Redundant check on maxDelay and/or maxDeviation in ARBOracle

Support

FAQs

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