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

Open
code423n4 opened this issue Jun 24, 2022 · 2 comments
Open

QA Report #187

code423n4 opened this issue Jun 24, 2022 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax

Comments

@code423n4
Copy link
Contributor

2022-06-nibbl

1 missing validations for the length of arrays.

The following parameters are array and the length of them must be checked before executing a function if the length is the same or not.

https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/Basket.sol#L41
https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/Basket.sol#L68

https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/NibblVault.sol#L504
https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/NibblVault.sol#L545

require(a.length == b.length, “error message”);

2 use safeTransfer instead of transfer or check the return value of the transfer

transfer is used to send ERC20 tokens. The return value must be checked if the transfer is successful or not. Otherwise, safeTrasfer must be used as an alternative.

https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/NibblVault.sol#L517
https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/NibblVault.sol#L526
https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/Basket.sol#L87
https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/Basket.sol#L94

Consider using safeTransfer or check the return value of the transfer.

3 use receivingAddress.call{value: amount}(""); instead of transfer

https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/Basket.sol#L80

(bool success, )= receivingAddress.call{value:amount}("");
require(success, “Error message”);

4 missing event for updateCurator.

Curator is a state variable. Event could be emitted in updateCurator with the arguments previousCurator and newCurator.

https://github.com/code-423n4/2022-06-nibbl/blob/main/contracts/NibblVault.sol#L485-L488

Event CuratorUpdated(address oldCurator, address newCurator);

address oldCurator = curator;
curator = _newCurator;

emit CuratorUpdated(oldCurator, _newCurator);

@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 24, 2022
code423n4 added a commit that referenced this issue Jun 24, 2022
@mundhrakeshav mundhrakeshav added the duplicate This issue or pull request already exists label Jun 26, 2022
@HardlyDifficult
Copy link
Collaborator

Merging with #179

@HardlyDifficult
Copy link
Collaborator

Good best practices to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists 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