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

10 stars 6 forks source link

Gas Optimizations #709

Open code423n4 opened 1 year ago

code423n4 commented 1 year 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 1 year ago

200 gas