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

Open
code423n4 opened this issue Jun 15, 2022 · 1 comment
Open

Gas Optimizations #94

code423n4 opened this issue Jun 15, 2022 · 1 comment
Labels
bug Something isn't working G (Gas Optimization)

Comments

@code423n4
Copy link
Contributor

https://github.com/code-423n4/2022-06-connext/blob/main/contracts/contracts/core/connext/libraries/AssetLogic.sol#L226

Function swapFromLocalAssetIfNeededForExactOut: If _amount is 0 then no need to perform any other step in swapFromLocalAssetIfNeededForExactOut function

if (_amount == 0) {
      return (true, _amount, _asset);
    }

https://github.com/code-423n4/2022-06-connext/blob/main/contracts/contracts/core/shared/ProposedOwnable.sol#L161

_setOwner: This function can be defined as private instead of internal

@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Jun 15, 2022
code423n4 added a commit that referenced this issue Jun 15, 2022
@0xleastwood
Copy link
Collaborator

The first optimisation doesn't seem to be possible because this code path is not hit unless _amount != 0. See its use in _reconcileProcessPortal for context on why.

The second optimisation is minor.

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)
Projects
None yet
Development

No branches or pull requests

2 participants