<!-- canonical: https://0xsimao.com/findings/m-0-unnecessary-standard-governor-state -->

# Unnecessary check in StandardGovernor.state

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

Finding 3S-M^0-N05 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

Since [StandardGovernor._votingPeriod](https://github.com/MZero-Labs/ttg/blob/a8127901fa1f24a2e821cf4d9854a1aa6ac8088c/src/StandardGovernor.sol#L439) function will always returns 0, voteStart will always
be equal to voteEnd.
This means that the following check in the StandardGovernor.state is unnecessary:
if (currentEpoch_ <= voteEnd_) return ProposalState.Active;
The use of < spends unnecessary gas by checking that currentEpoch_ is less than
voteEnd_.
If currentEpoch_ is indeed less that voteEnd_ then the transaction will stop a few lines
above:
if (currentEpoch_ < voteStart_) return ProposalState.Pending;

### Recommendation

The check for strict equality (==) will suffice.

### Status

Addressed in [#768c250](https://github.com/MZero-Labs/ttg/commit/768c250da47c2a29a7dfcec3c3d30b5d56ad1294).

---

Related findings:

- [_tempTokenToCheck in BaseRouter does not need to be a state variable](https://0xsimao.com/findings/fuji-finance-temp-need-state-variable): Fuji Finance
- [The domain with 0 index in Cap::_checkRemoteStateAndAdvance() is not checked for equality](https://0xsimao.com/findings/mitosis-index-remote-advance-equality): Mitosis
- [Cap::_checkRemoteStateAndAdvance() may be optimized by returning early as soon as a different epoch is found in a remote domain](https://0xsimao.com/findings/mitosis-remote-returning-soon-epoch): Mitosis
- [Unnecessary user balance check in _withdrawRequest()](https://0xsimao.com/findings/glacier-unnecessary-balance-withdraw-request): Glacier
