The condition if (oldPrimeRate > 0) is unnecessary in the setPrimeRate Function of the ReserveLibrary.sol Contract, because oldPrimeRate is of type uint256, which is always greater than or equal to 0, and both the constructor and each update ensure the value is always greater than 0. This check does not add value to the logic, and removing it would streamline the function without affecting its behavior.
contracts/libraries/pools/ReserveLibrary.sol:setPrimeRate#L404
The condition if (oldPrimeRate > 0) is redundant because oldPrimeRate is a uint256 type, which can never be less than 0. This check will always evaluate as true if oldPrimeRate > 0, and will not add any additional protection or logic. Furthermore, the construct does not change any behavior because oldPrimeRate is always non-negative due to its type.
Code Inefficiency: The redundant check adds unnecessary complexity and reduces code readability. While it does not affect functionality directly, it unnecessarily clutters the code, making it harder to understand and maintain.
Gas Efficiency: Even though the impact is minimal, redundant checks introduce unnecessary operations, slightly increasing gas costs without providing any additional security or logic.
Manual code review
It is recommended to remove the redundant check and The updated function should look like this:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.