Skip to content

Commit 7417c59

Browse files
aman7100Amxxernestognw
authored
Remove redundant getVotes call in Governor (#4940)
Co-authored-by: Hadrien Croubois <[email protected]> Co-authored-by: ernestognw <[email protected]>
1 parent 0a3f880 commit 7417c59

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

contracts/governance/Governor.sol

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,12 @@ abstract contract Governor is Context, ERC165, EIP712, Nonces, IGovernor, IERC72
286286
}
287287

288288
// check proposal threshold
289-
uint256 proposerVotes = getVotes(proposer, clock() - 1);
290289
uint256 votesThreshold = proposalThreshold();
291-
if (proposerVotes < votesThreshold) {
292-
revert GovernorInsufficientProposerVotes(proposer, proposerVotes, votesThreshold);
290+
if (votesThreshold > 0) {
291+
uint256 proposerVotes = getVotes(proposer, clock() - 1);
292+
if (proposerVotes < votesThreshold) {
293+
revert GovernorInsufficientProposerVotes(proposer, proposerVotes, votesThreshold);
294+
}
293295
}
294296

295297
return _propose(targets, values, calldatas, description, proposer);

0 commit comments

Comments
 (0)