code-423n4 / 2022-09-nouns-builder-findings

10 stars 6 forks source link

Gas Optimizations #709

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Repeated call to proposalThreshold():

  // Get the current proposal threshold
  uint256 currentProposalThreshold = proposalThreshold();

  // Cannot realistically underflow and `getVotes` would revert
  unchecked {
    // Ensure the caller's voting weight is greater than or equal to the threshold
    if (getVotes(msg.sender, block.timestamp - 1) < proposalThreshold()) revert BELOW_PROPOSAL_THRESHOLD();
  }
GalloDaSballo commented 2 years ago

200 gas