code-423n4 / 2022-05-backd-findings

0 stars 0 forks source link

Gas Optimizations #178

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Using solidity 0.8 new custom errors instead of old require(..., "") because it provide better gas optimized in both contract size and gas cost

Many part of code still using old require(..., "") for example

require(addressProvider.isStakerVault(msg.sender, lpToken), Error.UNAUTHORIZED_ACCESS);

You can replace this part with solidity 0.8 custom errors as follow

error Unauthorized();

This part above contract definition

if (!addressProvider.isStakerVault(msg.sender, lpToken)) {
revert Unauthorized();
}

This part replace require(..., "")

chase-manning commented 2 years ago

As a styling choice we will leave as the current revert messages

GalloDaSballo commented 2 years ago

Using solidity 0.8 new custom errors instead of old require(..., "") because it provide better gas optimized in both contract size and gas cost

In lack of any POC am going to give it 0 gas saved