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

0 stars 0 forks source link

Revert string > 32 bytes #241

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

sirhashalot

Vulnerability details

Impact

Strings are broken into 32 byte chunks for operations. Revert error strings over 32 bytes therefore consume extra gas as documented publicly

Proof of Concept

There are multiple examples of this gas optimization opportunity, including but not limited to:

Recommended Mitigation Steps

Reducing revert error strings to under 32 bytes decreases deployment time gas and runtime gas when the revert condition is met. Alternatively, the code could be modified to use custom errors, introduced in Solidity 0.8.4: https://blog.soliditylang.org/2021/04/21/custom-errors/

ColaM12 commented 2 years ago

Duplicate to #6