Skip to content
Request an audit

‹ All findings

Unnecessary conditional check in ThresholdGovernance.execute

Low/InfoM^0 Minter Gateway·Three Sigma · Stablecoin framework · 8th January, 2024Codebase3S-M^0-N11

Description

The function ThresholdGovernor.execute 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