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

Open
code423n4 opened this issue May 1, 2022 · 1 comment
Open

QA Report #75

code423n4 opened this issue May 1, 2022 · 1 comment
Assignees
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

1. Obsolete usage of SafeMath

Risk

Low

Impact

Contract AaveV3YieldSource is using SafeMath library for uint256. The contract is prepared for solidity 0.8.10 and using SafeMath is obsolete since the overflow/underflow security checks are built-in and done automatically for solidity versions >= 0.8.0 for all calculations unless marked with unchecked {}.

Proof of Concept

Used Tools

Manual Review / VSCode

Recommended Mitigation Steps

It is recommended to remove SafeMath from the contract.

2. Invalid setting decimals

Risk

Low

Impact

Constructor AaveV3YieldSource.constructor allows setting decimals value in constructor. Based on the comments in the code the value of decimals should be equal to the decimals of the token used to deposit into the pool. Setting it by the user who is deploying the contract makes the process prone to errors.

Comment in AaveV3YieldSource contract:

   * @dev This value should be equal to the decimals of the token used to deposit into the pool.

Proof of Concept

Used Tools

Manual Review / VSCode

Recommended Mitigation Steps

It is recommended to set _decimals by making external call to aToken.decimals().

3. Use immutable storage variables

Risk

Non-Critical

Impact

Contract AaveV3YieldSource has multiple storage addresses that are only set in constructor but are not marked as immutable.

Proof of Concept

Used Tools

Manual Review / VSCode

Recommended Mitigation Steps

It is recommended to mark listed storage variables as immutable.

4. Redundant code for checking aToken address

Risk

Non-Critical

Impact

Function AaveV3YieldSource.transferERC20 is checking if the passed _token address argument is not a aToken address. Since there is already defined function _requireNotAToken that performs such a check it is better to reuse existing implementation.

Proof of Concept

Used Tools

Manual Review / VSCode

Recommended Mitigation Steps

It is recommended to use _requireNotAToken in AaveV3YieldSource.transferERC20 function.

@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 May 1, 2022
code423n4 added a commit that referenced this issue May 1, 2022
@PierrickGT PierrickGT self-assigned this May 4, 2022
@PierrickGT
Copy link
Member

  1. Obsolete usage of SafeMath

Duplicate of #11

  1. Invalid setting decimals

As mentioned in a previous issue, we set this value in our deploy script, this way we are sure the Ticket contract and the yield source share the same number of decimals.

  1. Use immutable storage variables

Duplicate of #1

  1. Redundant code for checking aToken address

Duplicate of #4

@PierrickGT PierrickGT added the duplicate This issue or pull request already exists label May 4, 2022
@JeeberC4 JeeberC4 removed the duplicate This issue or pull request already exists label May 6, 2022
@JeeberC4 JeeberC4 reopened this May 6, 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 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

3 participants