<!-- canonical: https://0xsimao.com/findings/m-0-cast-vote-reason-fires -->

# castVoteWithReason always fires a VoteCast event with an empty reason

Low/Info · Three Sigma · Stablecoin framework · 8th January, 2024

Finding 3S-M^0-N14 of the M^0 Minter Gateway security review.

- Protocol: https://www.m0.org/
- Report: /reports/m-0
- Codebase: https://github.com/0xsimao/ttg/tree/a8127901fa1f24a2e821cf4d9854a1aa6ac8088c
- Source: https://cdn.sanity.io/files/qoqld077/production/1cdafafad874aba76e062ad8c216c98338c096db.pdf

---

### Description

The [BatchGovernor](https://github.com/MZero-Labs/ttg/blob/a8127901fa1f24a2e821cf4d9854a1aa6ac8088c/src/abstract/BatchGovernor.sol) contract supports castVoteWithReason to be compatible with certain
governors. Because the VoteCast event has a reason parameter, whoever uses this
external function is expecting an event being emitted with the provided reason. Instead, the
reason parameter is always empty in the event being emitted by _castVote:

```solidity
function _castVote(address voter_, uint256 weight_, uint256 proposalId_, uint8 support_) internal virtual {
    // ... emit VoteCast(voter_, proposalId_, support_, weight_, "");
}
```

### Recommendation

Make sure that the reason input of castVoteWithReason is passed through to the
VoteCast event.

### Status

Addressed in [#b97b196](https://github.com/MZero-Labs/ttg/pull/231).
