Skip to content

fix(protocol-contracts): round up unpaid fee to prevent extra reward distribution#1701

Closed
melanciani wants to merge 1 commit intomainfrom
melanciani/fix/protocol-contracts/staking/round_up_fee_in_historical_reward
Closed

fix(protocol-contracts): round up unpaid fee to prevent extra reward distribution#1701
melanciani wants to merge 1 commit intomainfrom
melanciani/fix/protocol-contracts/staking/round_up_fee_in_historical_reward

Conversation

@melanciani
Copy link
Copy Markdown
Contributor

@melanciani melanciani commented Jan 2, 2026

@melanciani melanciani requested a review from a team as a code owner January 2, 2026 10:58
@cla-bot cla-bot bot added the cla-signed label Jan 2, 2026
@melanciani melanciani marked this pull request as draft January 2, 2026 10:59
@mergify
Copy link
Copy Markdown

mergify bot commented Jan 2, 2026

🧪 CI Insights

Here's what we observed from your CI run for 4b9ee62.

🟢 All jobs passed!

But CI Insights is watching 👀

@melanciani melanciani force-pushed the melanciani/fix/protocol-contracts/staking/round_up_fee_in_historical_reward branch from 35682c3 to 4b9ee62 Compare January 2, 2026 11:37
// delegator allocations would be slightly higher than expected as it is based on total
// accumulated rewards subtracted by this unpaid fee amount, reversing the rounding direction.
// This could prevent the last depositor (or the beneficiary) from claiming their rewards.
return totalAssetsPlusPaidRewardsDelta.mulDiv(feeBasisPoints(), 10_000, Math.Rounding.Ceil);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not what OZ suggested for the fix. You should keep original rounding down behaviour, because this is the correct behaviour for the _claimFee function.
On the other hand, you should create a new function variant called _unpaidFeeRoundUp or _unpaidFeeCeil for eg, which contain this formula with the rounding up, and which would be used to compute the historicalReward.

@melanciani
Copy link
Copy Markdown
Contributor Author

issue has been closed as false positive, closing this PR

@melanciani melanciani closed this Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants