code4rena-2022-08-nounsdao-g23

[G‑23] Use custom errors rather than revert()/require() strings to save gas

보고서

Summary

require 나 revert 대신 custom error 를 이용하면 에러 문구를 위한 gas 비용을 절약할 수 있다.

Keyword

gas optimization, custom error, require, revert

Vulnerability

solidity 0.8.4부터 사용 가능한 커스텀 에러를 사용하면 ~50 gas만큼 줄일 수 있다. revert 이유 문자열을 할당하는 작업을 피할 수 있기 때문이다.

Impact

에러 상황에 취소할 때 gas가 더 나간다.

Mitigation

require나 revert 대신 custom error를 사용한다.

Memo

require나 revert 문이면 다 달아놨다..


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