Staking rounding drift

DeFi

Nov 16, 2025

Staking rounding drift

DeFi

Nov 16, 2025

Staking rounding drift

DeFi

Nov 16, 2025

Client

DeFi protocol

Service

Smart contract audit

Location

Undisclosed

A staking contract paid rewards proportionally. The arithmetic was correct in every individual case and wrong in aggregate.

The Challenge

Integer division does not lose value politely. It loses it in a direction. Where a reward calculation rounds, it rounds the same way every time, and a participant who controls the timing and the size of their position controls how often that rounding happens in their favour.

Nothing about this looks like an exploit in a diff. The contract does what it says it does. The drift only appears when you model the accounting across many small interactions instead of one large one.

The Approach

We read the reward accounting line by line, then modelled it rather than argued about it: repeated interactions at the boundary sizes, tracking the difference between what the pool believed it owed and what it actually paid out.

The divergence accumulated in a predictable direction and was reachable by any participant. Confirmed, written up, and in the client channel the same hour.

The Outcome

The accounting was reworked so the residual stayed with the pool rather than the caller, and the boundary cases were covered by tests before redeploy.

We retested the redeployed contract. Reported as CRITICAL in 2024. Retest included in the engagement.

CRITICAL

CRITICAL

Severity

Severity

2024

2024

Disclosed

Disclosed

Included

Included

Retest

Retest