code4rena-2022-08-nounsdao-g19

[G‑19] Don’t compare boolean expressions to boolean literals

보고서

Summary

if (<x> == true)if (<x> == false) 대신 if (<x>) , if (!<x>) 를 사용해야 한다.

Keyword

gas optimization

Vulnerability

File: contracts/governance/NounsDAOLogicV1.sol
 
505:          require(receipt.hasVoted == false, 'NounsDAO::castVoteInternal: voter already voted');
File: contracts/governance/NounsDAOLogicV2.sol
 
597:          require(receipt.hasVoted == false, 'NounsDAO::castVoteInternal: voter already voted');

if (<x> == true)if (<x> == false) 대신 if (<x>) , if (!<x>) 를 사용해야 한다.

Impact

gas가 낭비된다.

Mitigation

if (<x>) , if (!<x>) 를 사용한다.

Memo

왜인지 모르겠다만… 실험해봐야 할듯.


tags: bughunting, nouns dao, smart contract, solidity, gas optimization, severity gas