Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: high
Valid

`FeeCollector::claimRewards` it's not working correctly at all

Summary

The claimRewards function in the FeeCollector contract allows users to claim rewards based on their voting power. However, there are multiple issues that can lead to users being unable to claim their rightful rewards or claiming more than their fair share. Specifically:

  1. If a user claims rewards after only one distribution, they may lose access to future rewards due to incorrect tracking of claimed amounts.

  2. The contract does not correctly account for voting power changes over multiple distributions.

  3. Users who had voting power during distribution may be unable to withdraw their rewards if new users with voting power claim first.

Vulnerability Details

The issue arises from the way userRewards[user] is updated in claimRewards:

userRewards[user] = totalDistributed;

This assignment effectively prevents users from claiming any additional rewards in future distributions. Once a user claims, their rewards are set to totalDistributed, which could be higher than their entitled share if multiple distributions occur. Consequently, if new users with voting power claim rewards, previous users may find themselves locked out from withdrawing their rightful rewards.

Additionally, _calculatePendingRewards does not account for changes in voting power correctly. If the total voting power fluctuates over time, users may not receive their proportional share.

Also users can claim rewards for all distribtuion from begging.

Proof of Concept

Consider the following scenario:

  1. A user has voting power and rewards are distributed.

  2. The user claims their rewards. Their userRewards[user] is set to totalDistributed.

  3. New distribution is added.

  4. The user, who initially had voting power during the first distribution, can no longer claim further rewards due to the incorrect update of userRewards[user].

Impact

The vulnerabilities described above have significant consequences for the fairness and functionality of the reward distribution mechanism:

  1. Loss of Rewards for Legitimate Users: Users who claim rewards early may lose access to future distributions, even if they maintain their voting power. This undermines the intended incentive structure of the protocol.

  2. Unfair Distribution of Rewards: Users who claim rewards later may receive more than their fair share, especially if the total voting power changes over time. This could lead to centralization of rewards among a small group of users.

  3. Lockout of Early Users: Early participants in the protocol may be permanently locked out of claiming rewards if new users claim rewards first, reducing trust in the system and discouraging participation.

Tools Used

Manual review

Recommendations

Implement a mechanism which will correctly rewards only to eligible for every epoch.

Updates

Lead Judging Commences

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Validated
Assigned finding tags:

FeeCollector::claimRewards sets `userRewards[user]` to `totalDistributed` seriously grieving users from rewards

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.