<!-- canonical: https://0xsimao.com/findings/m-0-unnecessary-conditional-threshold-governance -->

# Unnecessary conditional check in ThresholdGovernance.execute

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

Finding 3S-M^0-N11 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 function [ThresholdGovernor.execute](https://github.com/MZero-Labs/ttg/blob/a8127901fa1f24a2e821cf4d9854a1aa6ac8088c/src/abstract/ThresholdGovernor.sol#L41-L56) executes a successful proposal. Among other
things, the function executes the following lines:

```solidity
if (currentEpoch_ == 0) revert InvalidEpoch();
// Proposals have voteStart=N and voteEnd=N+1, and can be executed
only during epochs N and N+1.
uint16 latestPossibleVoteStart_ = currentEpoch_;
uint16 earliestPossibleVoteStart_ = latestPossibleVoteStart_ > 0 ? latestPossibleVoteStart_ - 1 : 0;
```

The execute function will revert if currentEpoch_ == 0, and then it assigns this value to
latestPossibleVoteStart_. Considering this last variable can never be zero, the
conditional check in the following line is unnecessary.

### Recommendation

Replace the last lined shown above with the following:
uint16 earliestPossibleVoteStart_ = latestPossibleVoteStart_ - 1;

### Status

Acknowledged

---

Related findings:

- [Unnecessary user balance check in _withdrawRequest()](https://0xsimao.com/findings/glacier-unnecessary-balance-withdraw-request): Glacier
- [OstiumTrading::executeAutomationOrder() and _getLimitOrdersToTrigger() should check isPaused for open limit orders](https://0xsimao.com/findings/ostium-automation-orders-trigger-paused): Ostium
- [Missing Pausability Check in OstiumTrading::executeAutomationOrder() for Opening Orders](https://0xsimao.com/findings/ostium-pausability-automation-opening-orders): Ostium
- [OstiumTrading::canExecute() should also be checked in OstiumTradesUpKeep::checkCallback()](https://0xsimao.com/findings/ostium-trading-checked-trades-callback): Ostium
