Pre-auditThree days of senior audit time for $1,500, credited in full toward your Zealynx audit.3 audit days, credited toward your auditSee how →
M-14·

Reward Index Inflation Due to Rounding Up Can Trap Rewards

Not reportedoptionsleverageblack-scholes
TL;DR

In the _depositPremium function within PositionInteractionFacet.sol, when option premiums are added as rewards for liquidity providers, the rewards.rewardsPerLPQ128 index is updated using mulDivRoundingUp:

Severity
MEDIUM
Method
MManual review
CAT.
02Section · Severity

Severity

Impact: Medium

Likelihood: Medium

03Section · Description

Description

In the _depositPremium function within PositionInteractionFacet.sol, when option premiums are added as rewards for liquidity providers, the rewards.rewardsPerLPQ128 index is updated using mulDivRoundingUp:

solidity
if (lpSupply > 0) rewards.rewardsPerLPQ128 += upscaledPremium.mulDivRoundingUp(Q128, lpSupply);

Using mulDivRoundingUp causes the calculated reward added per LP token unit (scaled by Q128) to be rounded up to the nearest integer in the fixed-point representation. While seemingly small for individual deposits, these upward rounding errors accumulate in the rewardsPerLPQ128 index with each premium deposit over time.

This leads to the rewardsPerLPQ128 index potentially representing a slightly higher total reward distribution promise than the actual amount of totalRewards physically deposited into the pool.

When a user claims rewards via _claimRewards in LiquidityFacet.sol, their pending rewards (pending) are calculated based on the difference in the (potentially inflated) index relative to their last claim checkpoint. The function then attempts to subtract these pending rewards from the actual totalRewards available:

solidity
strg.ledger.state.rewardsByToken[token].totalRewards -= pending;

If the accumulated upward rounding errors in the rewardsPerLPQ128 index cause the calculated pending amount for a user (especially one claiming later after many premium deposits have occurred) to exceed the actual remaining totalRewards, this subtraction will underflow and revert the transaction.

Consequently, the last users attempting to claim their rewards may be unable to do so, and their legitimately earned rewards become permanently trapped in the contract.

04Section · Recommendations

Recommendations

To prevent reward index inflation and ensure accounting solvency, use standard rounding down when calculating the reward-per-token index increment.

05Section · Report provenance

Report provenance

Published by Pashov Audit Group, with Carlos (Bloqarl) participating as a contractor. The source report states that its fixes review was not fully completed; no final remediation disposition is recorded for this finding. Read the full report.

M-14