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

QA Report #229

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

QA Report #229

code423n4 opened this issue Jun 19, 2022 · 1 comment
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

FINDINGS

Open todos left in the code
File: BridgeFacet.sol line 492

      // TODO: do we want to store a mapping of custodied token balances here?

File: BridgeFacet.sol line 579

      // TODO: do we need to keep this

File: BridgeFacet.sol line 594

    // FIXME: routers can repay any-amount out-of-band using the `repayAavePortal` method

File: BridgeFacet.sol line 1027

    // TODO: Should we call approve(0) and approve(totalRepayAmount) instead? or with a try catch to not affect gas on all cases?

Commented code should be deleted

File:DiamondLoupeFacet.sol line 20-23

  // struct Facet {
  //     address facetAddress;
  //     bytes4[] functionSelectors;
  // }

TYPO

File:ProposedOwnableFacet.sol line 163

    // Contract as sournce of truth

sournce instead of source

File:ProposedOwnableFacet.sol line 176

    // Contract as sournce of truth

sournce instead of source

File: ProposedOwnableUpgradeable.sol line 170, see also line 198, line 212

    // Contract as sournce of truth

File: RelayerFacet.sol line 35

   * @notice Emitted when a rlayer is added or removed from whitelists

rlayer instead of relayer

Get rid of safemath as the over/underflow checks are in built in solidity 0.8+

We can save on some gas by getting rid of safemath library and using unchecked blocks for arithmetic operations that can never overflow/underflow
SafeMath is no longer needed starting with Solidity 0.8. The compiler now has built in overflow checking.

If we get rid of safemath we can optimize some functions to save on gas. Since the compiler will check for under/overflows by default, we can disable this checks for arithmetic operations that are guaranteed to never over/underflow. This would include the following

File:AmplificationUtils.sol line 15

  using SafeMath for uint256;

File:SwapUtils.sol line 20

@code423n4 code423n4 added bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax labels Jun 19, 2022
code423n4 added a commit that referenced this issue Jun 19, 2022
@0xleastwood
Copy link
Collaborator

This submissions is really just typos and TODOs. Last suggestion is a gas optimisation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Projects
None yet
Development

No branches or pull requests

2 participants