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

Factory.sol#constructor Remove redundant code can save gas #66

Closed
code423n4 opened this issue Oct 10, 2021 · 1 comment
Closed

Factory.sol#constructor Remove redundant code can save gas #66

code423n4 opened this issue Oct 10, 2021 · 1 comment
Labels
bug Warden finding duplicate Another warden found this issue G (Gas Optimization) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Handle

WatchPug

Vulnerability details

As per the Solidity documenation:

Before the constructor code is executed, state variables are initialised to their specified value if you initialise them inline, or their default value if you do not.

Setting ownerSplit to 0 in the constructor is redundant.

Removing ownerSplit = 0; can make the code simpler and save some gas.

https://github.com/code-423n4/2021-10-defiprotocol/blob/7ca848f2779e2e64ed0b4756c02f0137ecd73e50/contracts/contracts/Factory.sol#L18-L22

constructor (IAuction _auctionImpl, IBasket _basketImpl) {
        auctionImpl = _auctionImpl;
        basketImpl = _basketImpl;
        ownerSplit = 0; //TODO: needed?
    }

Recommendation

Remove the redundant code.

code423n4 added a commit that referenced this issue Oct 10, 2021
@frank-beard frank-beard added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Nov 6, 2021
@GalloDaSballo
Copy link
Collaborator

Duplicate of #70

@GalloDaSballo GalloDaSballo marked this as a duplicate of #70 Dec 19, 2021
@CloudEllie CloudEllie added the duplicate Another warden found this issue label Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Warden finding duplicate Another warden found this issue G (Gas Optimization) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

4 participants