Skip to content
Business logic Audit finding Intermediate

Rollover rewards are permanently lost due to flawed rewardRate calculation

The notifyRewardAmount function calculates rewardRate using only the new rewardAmount, ignoring the rollover amount, so the pool's reward reserve includes rollover but the emission rate is too low. As a result, rollover rewards are never fully distributed and are permanently lost.

osok Follow with Ibukun and odeili

Originally disclosed on Code4rena

Submitted by osok, also found by Ibukun, odeili

This issue was also found by V12.

GaugeCL.sol #L256

Summary

The notifyRewardAmount() function miscalculates the rewardRate when a new epoch begins, causing rollover rewards from previous epochs to be permanently lost.

When block.timestamp >= _periodFinish, the function adds both the new rewardAmount and the previous epoch’s clPool.rollover() to form the totalRewardAmount. However, the rewardRate is derived only from rewardAmount, ignoring the rollover portion:

// @audit The total amount to be reserved includes rollover...
uint256 totalRewardAmount = rewardAmount + clPool.rollover();
if (block.timestamp >= _periodFinish) {
    // @audit but the rate calculation completely ignores the rollover.
    rewardRate = rewardAmount / epochTimeRemaining;

    // @audit The pool is synced with a CORRECT reserve but an INCORRECTLY LOW rate.
    clPool.syncReward({
        rewardRate: rewardRate,
        rewardReserve: totalRewardAmount, // Correct total
        periodFinish: epochEndTimestamp
    });
}

This mismatch means the pool receives the full reserve (new + rollover) but emits rewards too slowly to deplete it. The rollover portion remains stranded, and when the next epoch begins, it is overwritten and effectively erased. The logic in the else branch fails to correct this issue; instead, it perpetuates the error. The updated rate is calculated using the old, already flawed rewardRate, ensuring that once rollover funds are stranded, they can never be reclaimed through subsequent reward notifications.

Impact

  1. Permanent Loss of Funds: Unclaimed rollover rewards are locked in the contract and cannot be recovered.
  2. Reduced LP Yields: Liquidity providers earn less than intended, as part of their entitled rewards never distribute.
  3. Protocol Resource Waste: Tokens from the treasury or partners are effectively burned, wasting incentive funds.

Recommended mitigation steps

The rewardRate calculation should include the rollover amount to ensure the emission rate matches the total rewards available for distribution. This change guarantees that all rollover rewards are correctly accounted for and eventually distributed. In GaugeCL.sol:

-   rewardRate = rewardAmount / epochTimeRemaining;
+   rewardRate = totalRewardAmount / epochTimeRemaining;
    clPool.syncReward({
        rewardRate: rewardRate,
        rewardReserve: totalRewardAmount,
        periodFinish: epochEndTimestamp })

Proof of concept

Please refer to the original submission to view the coded proof of concept.

Hybra Finance mitigated:

fix - S-36 ClaimFees Steals Staking Rewards fix - S-841 rollover rewardRate calcuate fix - S-645 Missing unchecked block in Gauge Dependent Library Will Cause Freezing of Reward Calculations

Status: Mitigation confirmed. Full details in the mitigation review reports from niffylord, rayss, and ZanyBonzy.


The original report as published on Code4rena, by osok. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the rewardRate calculation omits the rollover amount, using only the new rewardAmount while the rewardReserve includes both.

Impact

Rollover rewards are permanently locked in the contract, reducing liquidity provider yields and wasting incentive funds.

What the attacker needed

New epoch begins with rollover rewards

The fix

The rewardRate calculation should include the rollover amount, using totalRewardAmount instead of rewardAmount.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A smart contract pays out rewards over time at a set rate. When a new period starts, it adds leftover rewards from the previous period to the total, but it forgets to include that leftover when calculating the payout speed. So the contract holds more money than it will ever pay out, and the extra is stuck forever.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More from Hybra Finance

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.