[M-1] In BaseGauge :: constructor doing initialization boostState.maxBoost was scaled in Basis points while boostState.minBoost was scaled in WadRayMath
Description: Doing initialization process in BaseGauge :: constructor the protocol initialize boostState.maxBoost = 25000; which is 2.5x in basis points and mistakenly initialize boostState.minBoost = 1e18; in wad which if turn to basis point is way more higher than 25000
Impact:
With this incorrect logic min boost becomes way more higher than max boost , this mistake will lead to calculation errors when used in functions, This definitely Breaks core boost mechanism assumptions
Proof of Concept:
constructor(
address _rewardToken,
address _stakingToken,
address _controller,
uint256 _maxEmission,
uint256 _periodDuration
) {
rewardToken = IERC20(_rewardToken);
stakingToken = IERC20(_stakingToken);
controller = _controller;
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(CONTROLLER_ROLE, _controller);
boostState.maxBoost = 25000;
@> boostState.minBoost = 1e18;
boostState.boostWindow = 7 days;
uint256 currentTime = block.timestamp;
uint256 nextPeriod = ((currentTime / _periodDuration) * _periodDuration) + _periodDuration;
periodState.periodStartTime = nextPeriod;
periodState.emission = _maxEmission;
TimeWeightedAverage.createPeriod(
periodState.votingPeriod,
nextPeriod,
_periodDuration,
0,
10000
);
}
This below is the vulnerable part in the function
boostState.maxBoost = 25000;
@> boostState.minBoost = 1e18;
Recommended Mitigation:
kindly use same scaling method
boostState.maxBoost = 25000;
- boostState.minBoost = 1e18;
+ boostState.minBoost = 10000;