MorpheusAI

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

LinearDistributionIntervalDecrease::`_calculatePartPeriodReward()`:`intervalPart_` calculation results 0 part period reward for all boolean value of `toEnd`

Summary

The value calculation of intervalPart local variable in LinearDistributionIntervalDecrease::_calculatePartPeriodReward() is harmful and it will cause 0 part period reward.

Vulnerability Details

The below mentioned code returns the value of intervalPart -> interval when toEnd is true and 0 when toEnd is false for any value of startTime, payoutStart and interval.

if (toEnd_) {
intervalPart_ = interval_ * (intervalsPassed_ + 1) + payoutStart_ - startTime_;
} else {
intervalPart_ = startTime_ - interval_ * intervalsPassed_ - payoutStart_;
}

Here is a mock example, assume the following configurations:

startTime = X
payoutStart = Y
interval = Z
so, intervalPassed = (X - Y) / Z

When toEnd is true:

intervalPart_ = interval_ * (intervalsPassed_ + 1) + payoutStart_ - startTime_ ;
= Z * ( (X - Y) / Z + 1) + Y - X
= X - Y + Z + Y - X
= Z

As the intervalPart is equal to interval_ so when toEnd is true the returned reward from _calculatePartPeriodReward() is 0 because:

if (intervalPart_ == interval_) {
return 0;
}

When toEnd is false:

intervalPart_ = startTime_ - interval_ * intervalPassed_ - payoutStart_
= X - Z*(X - Y) / Z - Y
= X -X + Y - Y
= 0

So as per the formula here (intervalFullReward_ * intervalPart_) / interval_ it will also return 0 because intervalPart_ is 0 here.

Impact

Due to this code :

if (toEnd_) {
intervalPart_ = interval_ * (intervalsPassed_ + 1) + payoutStart_ - startTime_;
} else {
intervalPart_ = startTime_ - interval_ * intervalsPassed_ - payoutStart_;
}

The returned reward amount from _calculatePartPeriodReward() is 0 for all boolean value of toEnd.

Tools Used

Manual analysis.

Recommendations

Follow any better approach.

Updates

Lead Judging Commences

inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
0xAbinash Submitter
over 1 year ago
0xAbinash Submitter
over 1 year ago
inallhonesty Lead Judge
over 1 year ago
0xAbinash Submitter
over 1 year ago
inallhonesty Lead Judge
over 1 year ago
inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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