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 #119

Closed
code423n4 opened this issue May 20, 2022 · 2 comments
Closed

Gas Optimizations #119

code423n4 opened this issue May 20, 2022 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists G (Gas Optimization) sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Using requirement instead of modifier for authorization consumes more gas:

Seven functions at :https://github.com/code-423n4/2022-05-aura/blob/main/contracts/AuraStakingProxy.sol contract checks if the msg.sender is the owner using the require instead of using modifier this consumes gas more,

Uses modifier will consumes less gas, one of the functions as example:

    function setPendingOwner(address _po) external {
        require(msg.sender == owner, "!auth");
        pendingOwner = _po;
    }

change it to :

    modifier isOwner() {
       require(msg.sender==owner,"not owner");
}

    function setPendingOwner(address _po) external isOwner{
        pendingOwner = _po;
    }
@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels May 20, 2022
code423n4 added a commit that referenced this issue May 20, 2022
@0xMaharishi 0xMaharishi added invalid This doesn't seem right sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue labels May 26, 2022
@0xMaharishi
Copy link

This is so insignifcant - it's an admin fn so has no impact

@dmvt dmvt added duplicate This issue or pull request already exists and removed invalid This doesn't seem right labels Jul 4, 2022
@dmvt
Copy link
Collaborator

dmvt commented Jul 8, 2022

Grouping this with the warden’s gas report, #109

@dmvt dmvt closed this as completed Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists 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