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

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

QA Report #3

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

Comments

@code423n4
Copy link
Contributor

code423n4 commented Aug 1, 2022

1. Use of addrSet variable in HomeFi.sol

The addrSet variable in HomeFi.sol, does not look to have any significant use other than checking if the address is already set.
This can be also achieved by checking for already set addresses such as projectFactoryInstance or communityContract or even checking the length of wrappedToken[].
The addrSet variable can be safely removed with small code modification.
Code:
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/HomeFi.sol#L50

2. tokenCurrent1-3 can an array

In HomeFi.sol, three separate variables are defined for tokenCurrent(1-3). These variables are primarily used as indexes and it seems the number of currencies is always 3. In this case, instead of defining 3 separate variables, one array of length 3 can be defined to store all three currencies. This will save some storage gas.
Additionally, these 3 variables can be completely removed and directly referenced when populating the wrappedToken map at line 148
This will make the code a little smaller and much more readable.

Code:
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/HomeFi.sol#L50

3. Remove unused code:

The below code is never used and can be safely removed to save some gas

Code:
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/Community.sol#L910-918
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/HomeFi.sol#L314-322

4 bool parameter for delegateContractor can be removed

Code:
https://github.com/code-423n4/2022-08-rigor/blob/main/contracts/delegateContractor.sol#L148

The function delegateContractor(bool _bool) take bool parameter. However, this parameter can be removed as I am assuming when the function is called, the contractDelegated will either be true or false and that can be determined by evaluating the existing value of contractDelegated.
The code can be changed to contractDelegated = !contractDelegated;

@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 Aug 1, 2022
code423n4 added a commit that referenced this issue Aug 1, 2022
@zgorizzo69
Copy link
Collaborator

zgorizzo69 commented Aug 7, 2022

Thx for the findings
3. It is used for meta transaction and we need to override as it is present in both ContextUpgradeable and ERC2771ContextUpgradeable
4. then maybe a more suitable name would be toggleContractorDelegation

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

No branches or pull requests

3 participants