Skip to content
Smart contracts Audit finding Intermediate

Mismatched rounding rules in reward logic library results in two fold loss of earnings

The reward logic charges stakers a rounded-up commission but pays validators a rounded-down commission, so each settlement loses a small remainder. Over many settlements this causes a shortfall in unclaimed yield and breaks accounting invariants.

jovi Follow

Originally disclosed on Immunefi

  • Disclosed after under an hour

51912 sc high mismatched rounding rules in reward logic library results in two fold loss of earnings

Submitted on Aug 6th 2025 at 14:55:30 UTC by @jovi for Attackathon | Plume Network

Description

Brief/Intro

Every time rewards are settled, the contract silently loses the remainder created by divergent rounding rules. Over weeks of operation—and especially with many delegators per validator—this gap grows into a material shortfall that makes the true APR lower than the correct value.

Description

The PlumeRewardLogic is utilized to calculate the rewards for stakers and the commission for validators. In this context, _calculateRewardsCore charges a ceiled commission value to the stakers, but validators are paid a floored commission value.

Where users are charged (round-up):

Solidity
// PlumeRewardLogic.sol :: _calculateRewardsCore
commissionForThisSegment =
    _ceilDiv(grossRewardForSegment * effectiveCommissionRate, REWARD_PRECISION);

File link: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/lib/PlumeRewardLogic.sol#L348

The ceilDiv function adds b-1 before division, so any fractional part pushes the result up by one wei.

Where validators are paid (double round-down):

Solidity
// PlumeRewardLogic.sol :: updateRewardPerTokenForValidator
grossRewardForValidatorThisSegment =
    (totalStaked * rewardPerTokenIncrease) / REWARD_PRECISION;   // floor #1

commissionDeltaForValidator =
    (grossRewardForValidatorThisSegment * commissionRateForSegment)
    / REWARD_PRECISION;                                          // floor #2

File link: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/lib/PlumeRewardLogic.sol#L181C21-L187C62

Both divisions truncate toward zero, so the validator is under-credited.

The totalClaimableByToken, userRewards, and validatorAccruedCommission functions never receive the missing wei. There is also no “dust sweep” or “fee collector” variable; leading the contract’s ERC-20 balance to drift away from the sum of the bookkeeping variables.

Impact

  • Delegator APR erosion — each settlement skims extra wei from every delegator’s reward.
  • Validator revenue loss — commission actually received is systematically lower than the rate advertised on-chain.
  • Accounting invariants broken — the true Σ(userRewards) + Σ(validatorAccruedCommission) is less than the supposedly correct value.

Proof of Concept

For clarity purposes in this proof of concept, we'll consider 1 token = 1e18 units of a token.

{% stepper %} {% step %}

Setup

  • Deploy protocol with commissionRate = 10 % (1e17).
  • Two users each stake 1 token with the same validator. {% endstep %}

{% step %}

Set reward rate

  • Global rate yields 1 token + 1 wei total over the next period. {% endstep %}

{% step %}

Trigger settlement (call any function that invokes updateRewardsForValidator)

  • Per-user gross reward = 0.5 token
  • Per-user commission = ceil(0.5 × 0.1) = 0.05 000…→ 0.05 000 000 000 000 000 001
  • Total removed from users:
    2 × 0.050000…001 wei ≈ 0.100000…002 wei {% endstep %}

{% step %}

Validator accrual path

  • totalStaked = 2
  • grossRewardForValidator = floor(1 × 0.1 + 1 wei) = 0.1 token
  • Validator receives: 0.1 token (no extra wei) {% endstep %}

{% step %}

Observation

  • validatorAccruedCommission increases by exactly 0.1 token
  • Sum removed from users is 0.1 token + 2 wei
  • The extra 2 wei are nowhere in storage yet still reside in the ERC-20 balance. {% endstep %}

{% step %}

Repeat

Every settlement with at least one delegator whose commission share is fractional repeats the leak, widening the gap between bookkeeping and real balances. {% endstep %} {% endstepper %}


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

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 commission calculation uses ceil division for stakers but floor division twice for validators, so the remainder is never credited to any bookkeeping variable.

Impact

Each settlement skims extra wei from delegators and under-pays validators, eroding APR and breaking the accounting invariant that user rewards plus validator commission equals the correct total.

What the attacker needed

Fractional commission share per delegator; multiple settlements over time

The fix

The commission calculation should use consistent rounding so that the remainder is either credited to a bookkeeping variable or swept, rather than silently lost.

How it was found

  1. Deploy the protocol with a 10% commission rate and have two users each stake one token with the same validator.
  2. Set a global reward rate that yields one token plus one wei over the period.
  3. Trigger settlement by calling any function that invokes updateRewardsForValidator.
  4. Observe that the validator's accrued commission increases by exactly 0.1 token while users are charged 0.1 token plus 2 wei.
  5. Repeat the settlement to widen the gap between bookkeeping and the actual ERC-20 balance.

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.

When a contract splits rewards, it must round numbers. Here it rounds up when taking commission from stakers but rounds down when paying that commission to validators. The tiny difference is never recorded or paid to anyone, so the contract's records slowly drift from the tokens it actually holds.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by jovi

View all

25 more disclosed reports, best first.

More from Plume Network

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.