Skip to content
Business logic Audit finding Advanced

checkpoint() does not correct effectiveBond downward at year boundaries where inflation decreases

The checkpoint function only corrects effectiveBond upward when the actual maxBond exceeds the pre-credited prediction, but never subtracts the over-credit when actual inflation is lower. At the two year boundaries where inflation decreases, phantom bond capacity persists, allowing the Depository to create bond programs that mint more OLAS than the inflation schedule intends.

Alekso Follow with DDooTo

Originally disclosed on Code4rena

Submitted by Alekso, also found by DDooTo

  • autonolas-tokenomics/../contracts/Tokenomics.sol#L1163-L1177
  • autonolas-tokenomics/../contracts/Tokenomics.sol #L1278-L1280
  • autonolas-tokenomics/../contracts/TokenomicsConstants.sol#L85-L96

At the end of each epoch, checkpoint() pre-credits effectiveBond with the next epoch’s maxBond (line 1279-1280):

curMaxBond += effectiveBond;
effectiveBond = uint96(curMaxBond);

This maxBond is computed using the current inflationPerSecond. When the next epoch actually settles, the code compares the actual maxBond for the settled epoch (incentives[4], computed from the actual inflation that occurred) against the predicted maxBond that was pre-credited:

// Line 1161
incentives[4] = (inflationPerEpoch * tp.epochPoint.maxBondFraction) / 100;

// Line 1166
uint256 curMaxBond = maxBond;

// Line 1172-1177
// This has to be always true, or incentives[4] == curMaxBond if the epoch is settled exactly at the epochLen time
if (incentives[4] > curMaxBond) {
    // Adjust the effectiveBond
    incentives[4] = effectiveBond + incentives[4] - curMaxBond;
    effectiveBond = uint96(incentives[4]);
}

The adjustment at line 1173 only fires when incentives[4] > curMaxBond — i.e., when the actual bond allocation exceeds the prediction. There is no else branch for the reverse case. The developer comment at line 1172 explicitly states this condition “has to be always true”, assuming checkpoints always settle late (actual time > epochLen), so actual inflation always exceeds predicted.

This assumption breaks at year boundaries where inflation decreases. When an epoch crosses such a boundary, inflationPerEpoch is computed as a blend of the old (higher) and new (lower) rates (lines 1138-1147):

inflationPerEpoch = (yearEndTime - prevEpochTime) * curInflationPerSecond;
curInflationPerSecond = getInflationForYear(numYears) / ONE_YEAR;
inflationPerEpoch += (block.timestamp - yearEndTime) * curInflationPerSecond;

The blended inflationPerEpoch is lower than what the pre-credited maxBond assumed (which was based entirely on the old, higher rate). So incentives[4] < curMaxBond, the if condition is false, and the over-credit is never subtracted from effectiveBond. This phantom capacity persists forever.

The OLAS inflation schedule (TokenomicsConstants.sol#L85-96) has exactly two decreasing transitions:

Transition | Old Inflation | New Inflation | Decrease |

Year 2 → 3 | 40,400,000 OLAS | 25,260,023 OLAS | -37.5% |

Year 9 → 10 | 30,161,788 OLAS | ~15,234,531 OLAS | -49.5% |

After year 10, inflation is 2% compound on an increasing supply cap (always increasing), so the bug never fires again.

Impact

At each of the two inflation-decreasing year boundaries, effectiveBond retains phantom bond capacity equal to the difference between the pre-credited maxBond (computed at the old rate) and the actual blended maxBond for the settled epoch. The PoC below demonstrates ~346,068 OLAS of phantom capacity at the Year 2→3 boundary alone, with a comparable amount at Year 9→10.

This phantom capacity is real and actionable: reserveAmountForBondProgram() (line 803) uses effectiveBond as its sole gatekeeper. The Depository can create bond programs against this phantom, and when bonds mature, the Treasury mints actual OLAS to pay bondholders. The total phantom across both transitions is approximately ~412,000 OLAS (~0.04% of total supply), representing a violation of the inflation schedule’s intended bond allocation.

The bug triggers automatically at the two year boundaries with no admin action required.

Recommended Mitigation

Add a downward correction in the else branch to subtract the over-credit when the actual maxBond is less than predicted:

  if (incentives[4] > curMaxBond) {
      // Adjust the effectiveBond
      incentives[4] = effectiveBond + incentives[4] - curMaxBond;
      effectiveBond = uint96(incentives[4]);
+ } else if (incentives[4] < curMaxBond) {
+     // Adjust the effectiveBond downward when actual maxBond is less than pre-credited
+     effectiveBond = uint96(effectiveBond - (curMaxBond - incentives[4]));
  }

Proof of Concept

View detailed Proof of Concept


The original report as published on Code4rena, by Alekso. 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

The adjustment branch only handles the case where actual maxBond exceeds the pre-credited value, with no else branch to subtract the over-credit when actual inflation is lower.

Impact

At each of the two inflation-decreasing year boundaries, effectiveBond retains phantom capacity (~346,068 OLAS at Year 2→3 and a comparable amount at Year 9→10, ~412,000 OLAS total) that the Depository can use to create bond programs which mint real OLAS, violating the intended bond allocation.

What the attacker needed

Epoch crosses a decreasing inflation boundary; no admin action required

The fix

Add an else-if branch that subtracts the over-credit from effectiveBond when the actual maxBond is less than the pre-credited value.

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 keeps a running allowance of how many tokens can be handed out as rewards for bonding. At the end of each period it guesses the next period's allowance and adds it in advance, then later checks whether the guess was too low and tops it up. It never checks whether the guess was too high, so when the reward rate drops at certain year boundaries the contract keeps an allowance it should have given back.

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 Olas

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.