code-423n4 / 2022-03-lifinance-findings

6 stars 4 forks source link

Gas Optimizations #149

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Public Function Can Be Changed to External

Description

The public functions that have not been called by the contract itself should be marked as external instead to save more gas and enforce the least privilege principle.

Permalinks

  1. https://github.com/code-423n4/2022-03-lifinance/blob/699c2305fcfb6fe8862b75b26d1d8a2f46a551e6/src/Facets/AnyswapFacet.sol#L35
  2. https://github.com/code-423n4/2022-03-lifinance/blob/699c2305fcfb6fe8862b75b26d1d8a2f46a551e6/src/Facets/CBridgeFacet.sol#L57

Mitigation

It is recommended that to change the function visibility from public to external if there is no plan to be called from the contract itself.

H3xept commented 2 years ago

Fixed in previous commit.

H3xept commented 2 years ago

Duplicate of #197