A discrepancy exists between the comment and the implemented condition in the _coveredDebtOf
function within the SablierFlow
contract. Specifically, the comment suggests that the function should return the balance when the balance is "less than or equal to" the total debt. However, the actual implementation checks for a strictly "less than" condition. This inconsistency can lead to unintended behavior if the balance is exactly equal to the total debt.
The current condition only checks if balance is strictly less than totalDebt (using <), not considering the scenario where balance is equal to totalDebt. This discrepancy can cause the function to proceed and return totalDebt.toUint128() in cases where balance == totalDebt
, potentially causing unexpected outcomes.
If the balance is equal to the totalDebt
, the function does not behave as expected based on the comment, which suggests that balance should be returned. Instead, it proceeds to the next statement, returning totalDebt.toUint128(). This could lead to confusion for developers and auditors reviewing the code and potentially impact functionality if any dependent code expects balance to be returned in cases where balance == totalDebt
.
Manual Review
Ensure that comments reflect the function's actual implementation and purpose. If the function logic is ever modified, corresponding comments should be reviewed and updated to prevent inconsistencies.
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.