code4rena-2022-08-nounsdao-g12
[G‑12] require()/revert() strings longer than 32 bytes cost extra gas
Summary
32바이트보다 긴 에러메시지는 추가 gas를 소모하므로 짧은 에러 문구를 이용하라고 하였다.
Keyword
gas optimization, error message
Vulnerability
- contracts/base/ERC721Checkpointable.sol#L140
- contracts/base/ERC721Enumerable.sol#L62
- contracts/governance/NounsDAOLogicV1.sol#L122
- contracts/governance/NounsDAOLogicV2.sol#L133
- contracts/governance/NounsDAOProxy.sol#L79
32바이트보다 긴 에러메시지는 추가 gas가 필요하므로 짧은 에러 문구를 이용하라고 지적했다. 추가 32바이트마다 MSTORE(3 gas)가 추가 발생한다.
Impact
긴 에러메시지에 의해 가스가 더 소모된다.
Mitigation
긴 에러메시지를 짧게 줄인다.
tags: bughunting, nouns dao, smart contract, solidity, gas optimization, gas, severity gas