code-423n4 / 2021-12-maple-findings

0 stars 0 forks source link

Long Revert Strings are Waste of Gas #40

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

Meta0xNull

Vulnerability details

Impact

Shortening revert strings to fit in 32 bytes will decrease deployment time gas and will decrease runtime gas when the revert condition has been met.

Revert strings that are longer than 32 bytes require at least one additional mstore, along with additional overhead for computing memory offset, etc.

Proof of Concept

https://github.com/maple-labs/maple-proxy-factory/blob/main/contracts/MapleProxyFactory.sol#L33 https://github.com/maple-labs/maple-proxy-factory/blob/main/contracts/MapleProxyFactory.sol#L42

Tools Used

Manual Review

Recommended Mitigation Steps

Shorten the revert strings to fit in 32 bytes.

Or consider using Custom Errors (solc >=0.8.4).

lucas-manuel commented 2 years ago

Duplicate https://github.com/code-423n4/2021-12-maple-findings/issues/3

pauliax commented 2 years ago

A duplicate of #3