MorpheusAI

MorpheusAI
Foundry
22,500 USDC
View results
Submission Details
Severity: medium
Invalid

Wrong comment in `getPeriodReward`

Summary

In the getPeriodReward function of the LinearDistributionIntervalDecrease library, there is a discrepancy between the comment and the code implementation regarding the condition for returning 0 when startTime_ is equal to endTime_. The comment suggests a condition of strictly greater than (>), while the code implementation checks for greater than or equal to (>=). To ensure clarity and consistency, it is recommended to clarify the desired behavior and reconcile the code with the comments.

Vulnerability Details

In the provided code snippet:

// Return 0 when calculation 'startTime_' is bigger than 'endTime_'.
if (startTime_ >= endTime_) {
return 0;
}

The comment suggests returning 0 when startTime_ is strictly greater than endTime_, while the code checks for greater than or equal to.

Impact

The discrepancy between the comment and code may lead to confusion regarding the intended behavior of the function. Depending on the desired logic, this inconsistency could impact the understanding of the code's functionality.

Recommendations

Clarify the desired behavior and reconcile the code with the comments. Depending on the intended logic, either update the comment to reflect the current code implementation or adjust the code to match the comment.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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