Asymmetric commission rounding creates systematic accounting drift
The staking contract calculates user commission with ceiling division but validator commission with floor division, so a tiny rounding difference is never recorded. Over many claims this makes total payouts plus validator commission less than total emitted rewards, causing accounting drift.
- Disclosed after under an hour
52409 sc high asymmetric commission rounding creates systematic accounting drift
Submitted on Aug 10th 2025 at 13:41:05 UTC by @spongebob for Attackathon | Plume Network
- Report ID: #52409
- Report Type: Smart Contract
- Report severity: High
- Target: https://github.com/immunefi-team/attackathon-plume-network/blob/main/plume/src/facets/StakingFacet.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
PlumeStaking calculates commission two different ways: users get charged with ceiling division, while validators accrue commission with floor division.
The mismatch creates a small rounding gap on every calc. That gap isn’t tracked anywhere, so over time the system’s books drift: sum(user_payouts) + sum(validator_commission) < sum(emitted_rewards).
No one can steal funds and individual balances look fine, but the totals won’t reconcile and value effectively leaks from accounting.
Vulnerability Details
User commission (ceil)
When users claim, _calculateRewardsCore() uses ceiling division to compute commission:
The helper _ceilDiv explicitly rounds up so users always pay at least as much commission as validators should get:
Validator commission (floor)
Validator accrual in updateRewardPerTokenForValidator() uses normal (floor) division. _ceilDiv’s comment even calls out this asymmetry: it’s designed so “sum of user commissions ≥ validator accrued commission.”
The extra few wei created by ceiling division during user claims never gets recorded as anyone’s balance. Users are paid net (gross − ceiling commission), validators later claim what they accrued via floor division, and the difference disappears.
Because rewards are processed across time segments between checkpoints, each segment can introduce another tiny delta.
Lots of micro-claims or frequent rate changes mean lots of segments—and more drift. This is very subtle because each piece works alone.
Users don’t underpay, validators don’t over-accrue, and there are no negative balances.
The problem only shows up when you add everything across the system and compare to total emitted rewards.
Impact Details
I consider a low severity as the contract delivers per-user/per-validator amounts, but total distribution won’t match emissions.
Proof of Concept
{% stepper %} {% step %}
Deploy and setup
- Deploy the PlumeStaking system with a test validator and reward token.
- Set a commission rate for the validator (e.g., 33% to maximize rounding effects).
- Add a reward token with a specific rate that will create fractional commission amounts.
- Fund the treasury with sufficient reward tokens. {% endstep %}
{% step %}
Create a minimal-stake scenario
- Stake a small amount (e.g., 1 wei) to create minimal rewards that amplify rounding effects.
- Set reward rate to a value that creates fractional commission (e.g., a rate that results in commission like 2.7 tokens).
- Wait for a short time period (e.g., 1 second) to accrue minimal rewards. {% endstep %}
{% step %}
Record initial state
Record:
- Total reward tokens in treasury
- User's claimable rewards
- Validator's accrued commission {% endstep %}
{% step %}
Manual expected calculation
Calculate expected values manually:
- Gross reward = stake × rate × time
- Commission (ceiling) = ceil(gross_reward × commission_rate)
- Commission (floor) = floor(gross_reward × commission_rate)
- Rounding delta = ceiling_commission - floor_commission
- Expected net user reward = gross_reward - ceiling_commission {% endstep %}
{% step %}
Execute claim and observe
- Execute user claim and record actual claimed amount.
- Check validator's accrued commission using
getAccruedCommission(). {% endstep %}
{% step %}
Compute discrepancy
- Total distributed = user_claimed + validator_commission
- Expected total = gross_reward
- Missing amount = expected_total - total_distributed {% endstep %}
{% step %}
Repeat to accumulate drift
- Repeat the minimal accrual & claim cycle multiple times with different small stake amounts to accumulate the rounding delta.
- Each iteration should show the same small rounding delta being lost.
- Sum all missing amounts to demonstrate cumulative accounting drift. {% endstep %}
{% step %}
Final observation
- Confirm treasury balance shows more tokens than the sum of all distributed rewards.
Conclusion: Each claim cycle will show a small amount (the rounding delta) that disappears from accounting. The cumulative effect grows with each transaction. Treasury will retain slightly more tokens than the sum of user payouts + validator commissions and the equation emitted_rewards ≠ Σ(user_payouts) + Σ(validator_commission) will be violated. {% 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 contract uses ceiling division for user commission and floor division for validator commission without tracking the resulting rounding difference.
Impact
The contract still pays individual users and validators correctly, but total distributions will not match emitted rewards, so value effectively leaks from accounting.
What the attacker needed
A deployed staking contract; a validator with a commission rate; many small claims or frequent rate changes
How it was found
- Deploy the staking system with a test validator and reward token, set a commission rate, and fund the treasury.
- Stake a very small amount and set a reward rate that produces fractional commission, then wait briefly to accrue rewards.
- Record the treasury balance, the user's claimable rewards, and the validator's accrued commission.
- Manually calculate the ceiling commission, floor commission, rounding delta, and expected net user reward.
- Execute the user claim and check the validator's accrued commission.
- Compare total distributed rewards with the expected gross reward to see the missing amount, then repeat to accumulate drift.
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 a reward between a user and a validator, it rounds the numbers. Here it rounds the user's share up and the validator's share down. The small leftover amount is not given to anyone, so the contract's total records slowly stop matching the rewards it actually paid out.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.