Summary
The BaseGauge._getBaseWeight
function which takes address account
as an input parameter never uses it, and returns instead the value for the address(this)
every time.
Vulnerability Details
File: contracts/core/governance/gauges/BaseGauge.sol
218: function _getBaseWeight(address account) internal view virtual returns (uint256) {
219: return IGaugeController(controller).getGaugeWeight(address(this)); <@ should be `account`
220: }
...:
...:
...:
594: function getUserWeight(address account) public view virtual returns (uint256) {
595: uint256 baseWeight = _getBaseWeight(account);
596: return _applyBoost(account, baseWeight);
597: }
Impact
That function is called by BaseGauge.earned
, which is called and used by BaseGauge._updateReward
to compute account
reward.
Recommendations
File: contracts/core/governance/gauges/BaseGauge.sol
function _getBaseWeight(address account) internal view virtual returns (uint256) {
- return IGaugeController(controller).getGaugeWeight(address(this));
+ return IGaugeController(controller).getGaugeWeight(address(account));
}