31584 - [SC - Critical] Loss Of Boosted Weight When Poking In The Same ...
Description
Brief/Intro
Vulnerability Details
src/Voter.sol:
194: /// @inheritdoc IVoter
195: function poke(uint256 _tokenId) public {
196: // Previous boost will be taken into account with weights being pulled from the votes mapping
@>197: uint256 _boost = 0;
....
205: uint256[] memory _weights = new uint256[](_poolCnt);
206:
207: for (uint256 i = 0; i < _poolCnt; i++) {
208: _weights[i] = votes[_tokenId][_poolVote[i]];
209: }
210:
@>211: _vote(_tokenId, _poolVote, _weights, _boost);
212: }
412: function _vote(uint256 _tokenId, address[] memory _poolVote, uint256[] memory _weights, uint256 _boost) internal {
413: _reset(_tokenId);
....
419: for (uint256 i = 0; i < _poolCnt; i++) {
420: _totalVoteWeight += _weights[i];
421: }
422:
423: IFluxToken(FLUX).accrueFlux(_tokenId);
@>424: uint256 totalPower = (IVotingEscrow(veALCX).balanceOfToken(_tokenId) + _boost);
425:
426: for (uint256 i = 0; i < _poolCnt; i++) {
427: address _pool = _poolVote[i];
428: address _gauge = gauges[_pool];
429:
430: require(isAlive[_gauge], "cannot vote for dead gauge");
431:
@>432: uint256 _poolWeight = (_weights[i] * totalPower) / _totalVoteWeight;
....
439: weights[_pool] += _poolWeight;
440: votes[_tokenId][_pool] += _poolWeight;
441: IBribe(bribes[_gauge]).deposit(uint256(_poolWeight), _tokenId);
442: _totalWeight += _poolWeight;
443: emit Voted(msg.sender, _pool, _tokenId, _poolWeight);
444: }
....
455: }Impact Details
Mitigation Analysis
Proof of Concept
Previous31583 - [SC - Insight] Off by one error while adding reward pool tokenNext31588 - [SC - Low] Users could start cooldown period for their wit...
Last updated
Was this helpful?