<!-- canonical: https://0xsimao.com/findings/m-0-current-epoch-zero-threshold -->

# Unnecessary currentEpoch zero check in StandardGovernor and ThresholdGovernor

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

Finding 3S-M^0-N09 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 currentEpoch value is derived from [BatchGovernor._clock](https://github.com/MZero-Labs/ttg/blob/a8127901fa1f24a2e821cf4d9854a1aa6ac8088c/src/abstract/BatchGovernor.sol#L419-L421), which can never be zero.
But the execute functions of both StandardGovernor and ThresholdGovernor check if
currentEpoch is zero.

### Recommendation

Since the epoch implementation being used doesn't allow for a zero value returned by
_clock, consider removing these zero checks.

### Status

Addressed in [#1c7576f](https://github.com/MZero-Labs/ttg/commit/1c7576ff2a32fe37b095c79d1d5262beb92b6f52).

---

Related findings:

- [The current epoch will never advance if there are no other domains](https://0xsimao.com/findings/mitosis-current-epoch-advance-domains): Mitosis
- [KeyringCoreV2Base::_createCredential() could use currentTime instead of block.timestamp on the creatBefore check](https://0xsimao.com/findings/keyring-ii-credential-current-timestamp-creat): Keyring Credentials
- [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
- [Missing key zero value check](https://0xsimao.com/findings/codeup-missing-key-zero-value): CODEUP
