Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gas Optimizations #178

Open
code423n4 opened this issue Jun 3, 2022 · 2 comments
Open

Gas Optimizations #178

code423n4 opened this issue Jun 3, 2022 · 2 comments
Labels
bug Something isn't working G (Gas Optimization) sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

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(..., "")

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Jun 3, 2022
code423n4 added a commit that referenced this issue Jun 3, 2022
@chase-manning chase-manning added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Jun 6, 2022
@chase-manning
Copy link
Collaborator

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

@GalloDaSballo
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization) sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

3 participants