An issue was identified in the BaseGauge.sol contract where the _getBaseWeight() function incorrectly retrieves the weight of the contract (address(this)) instead of the user's weight. This leads to incorrect reward calculations, preventing users from receiving their rightful rewards.
_getBaseWeight(address account) in BaseGauge.sol
The BaseGauge contract is responsible for handling staking and distributing rewards to users who deposit veRAAC tokens. When a user calls stake(), the updateReward modifier is triggered to calculate and update their rewards.
The _updateReward() function determines rewards by calling earned(), which relies on getUserWeight(). This function then calls _getBaseWeight() to retrieve the user’s base weight. However, instead of returning the user's weight, it mistakenly retrieves the contract’s weight (address(this)), causing miscalculations in the reward distribution.
_getBaseWeight() incorrectly returns the contract’s weight instead of the user's weight.
A user stakes veRAAC tokens in the BaseGauge contract.
The stake() function triggers updateReward(), which calls _updateReward().
_updateReward() calls earned(), which calls getUserWeight(), which then calls _getBaseWeight().
The user stakes veRAAC tokens.
The system calculates rewards based on _getBaseWeight().
_getBaseWeight() retrieves the contract’s weight instead of the user’s.
The reward calculation is incorrect, resulting in unfair reward distribution.
High Severity: Users are not receiving the correct rewards due to incorrect weight retrieval, leading to unfair reward distribution.
This flaw may discourage users from staking and participating in governance, affecting protocol adoption.
Long-term misallocation of rewards can impact the sustainability of the ecosystem.
Manual
To ensure accurate reward calculation, _getBaseWeight() should return the user’s weight instead of the contract’s:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.