code-423n4 / 2022-01-behodler-findings

1 stars 0 forks source link

Gas savings #217

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

csanuragjain

Vulnerability details

Impact

Gas savings

Proof of Concept

  1. Navigate to contract at https://github.com/code-423n4/2022-01-behodler/blob/main/contracts/DAO/LimboDAO.sol

  2. Observe that in burnAsset function, fateCreated can be initialized with 0 instead of fateState[_msgSender()].fateBalance which takes more gas. Actual value of fateCreated is decided by if-else condition

  3. Observe that in vote function isLive modifier should be before incrementFate as if contract is not live then there is no meaning of incrementFate

  4. Observe that in vote function below nested condition can be placed beforehand as if this happens further execution is not required

if (block.timestamp - currentProposalState.start > proposalConfig.votingDuration)
  1. Observe that previousProposalState is never used and can be removed
gititGoro commented 2 years ago

some of these are correct but I'm confirming for previousProposalState removal.

gititGoro commented 2 years ago

https://github.com/Behodler/limbo/pull/33