30886 - [SC - Medium] Wrong totalWeight in Votersol

Submitted on May 7th 2024 at 18:39:32 UTC by @cryptoticky for Boost | Alchemix

Report ID: #30886

Report type: Smart Contract

Report severity: Medium

Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/Voter.sol

Impacts:

  • Manipulation of governance voting result deviating from voted outcome and resulting in a direct change from intended effect of original results

Description

Brief/Intro

If the user proceeds with the vote only once and does nothing afterwards, the voting power of the user does not decrease and this affects the overall voting result.

Vulnerability Details

/// @inheritdoc IVoter
    function notifyRewardAmount(uint256 amount) external {
        require(msg.sender == minter, "only minter can send rewards");
        require(totalWeight > 0, "no votes");

        _safeTransferFrom(base, msg.sender, address(this), amount); // transfer rewards in

        uint256 _ratio = (amount * 1e18) / totalWeight; // 1e18 adjustment is removed during claim

        if (_ratio > 0) {
            index += _ratio;
        }

        emit NotifyReward(msg.sender, base, amount);
    }

In this protocol, votingPower linearly decreases over time. However, if no action for the tokenId is taken after the first vote, the votingPower of that token remains within totalWeight and weights. This directly affects _ratio within the Voter.notifyRewardAmount function. It also impacts claimable in the Voter._updateFor function.

When the Voter.distribute function is called, newly minted ALCX tokens are distributed to each gauge according to the voting results.

Ultimately, the voting results differ from what was intended, which affects the distribution of ALCX tokens.

Even if a token expires, this phenomenon continues.

Impact Details

The governance voting results are manipulated, leading to a direct deviation from the intended impact of the original results.

Proof of Concept

Last updated

Was this helpful?