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.
- 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
- Report ID: #51912
- Report Type: Smart Contract
- Report severity: High
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/lib/PlumeRewardLogic.sol
- Impacts:
- Theft of unclaimed yield
- Loss of unclaimed yield due to rounding errors
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):
// PlumeRewardLogic.sol :: _calculateRewardsCore
commissionForThisSegment =
_ceilDiv(grossRewardForSegment * effectiveCommissionRate, REWARD_PRECISION);
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):
// PlumeRewardLogic.sol :: updateRewardPerTokenForValidator
grossRewardForValidatorThisSegment =
(totalStaked * rewardPerTokenIncrease) / REWARD_PRECISION; // floor #1
commissionDeltaForValidator =
(grossRewardForValidatorThisSegment * commissionRateForSegment)
/ REWARD_PRECISION; // floor #2
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 = 2grossRewardForValidator = floor(1 × 0.1 + 1 wei) = 0.1 token- Validator receives:
0.1 token(no extra wei) {% endstep %}
{% step %}
Observation
validatorAccruedCommissionincreases 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 %}
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
- Deploy the protocol with a 10% commission rate and have two users each stake one token with the same validator.
- Set a global reward rate that yields one token plus one wei over the period.
- Trigger settlement by calling any function that invokes updateRewardsForValidator.
- Observe that the validator's accrued commission increases by exactly 0.1 token while users are charged 0.1 token plus 2 wei.
- 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.