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

Open
code423n4 opened this issue Mar 30, 2022 · 2 comments
Open

Gas Optimizations #212

code423n4 opened this issue Mar 30, 2022 · 2 comments
Assignees
Labels
bug Something isn't working G (Gas Optimization)

Comments

@code423n4
Copy link
Contributor

1. Functions visibility

2. Unnecessary storage retrieval

  • Summary: Storage values retrieved repeatedly in the same function can be cached to optimize gas usage.
  • Details: In _startBridge, 6 storage calls are made that can be replaced by chaching 1 variables, reducing gas usage significantly. For example, _bridge(hopData.asset).token can be replaced by s.hopBridges[hopData.asset] where s is stored in memory.
  • Github Permalinks: _startBridge, _bridge, and getStorage
  • Mitigation: Output of getStorage can be cahced in memory and later calls to _bridge can be replaced with queries to the Storage struct saved in the cache.
@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Mar 30, 2022
code423n4 added a commit that referenced this issue Mar 30, 2022
@H3xept
Copy link
Collaborator

H3xept commented Apr 1, 2022

  1. Fixed by lifinance/lifi-contracts@26443af0142afdb131b6b3ab278fac29670b7b0e
    Duplicate of QA Report #197

@H3xept H3xept self-assigned this Apr 1, 2022
@ezynda3 ezynda3 closed this as completed Apr 1, 2022
@H3xept
Copy link
Collaborator

H3xept commented Apr 11, 2022

Re Unnecessary storage retrieval

Duplicate of #196

@H3xept H3xept reopened this Apr 11, 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 G (Gas Optimization)
Projects
None yet
Development

No branches or pull requests

2 participants