code-423n4 / 2022-06-nibbl-findings

1 stars 0 forks source link

QA Report #240

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

1.Use a single modifier to check the same condition in mutliple functions

modifier isApprovedOnwer() {
    require(_isApprovedOrOwner(msg.sender, 0), "withdraw:not allowed")
}

function withdrawERC721(....) isApprovedOnwer{ ..}
function withdrawMultipleERC721(....) isApprovedOnwer{ ..}
function withdrawERC721Unsafe(....) isApprovedOnwer{ ..}
function withdrawERC1155(....) isApprovedOnwer{ ..}
........
......

2. Add descriptive revert string in "require()"

Some require statements dont have revert strings, using short descriptive message is good practice

./contracts/NibblVaultFactory.sol:114:        require(_success);

./contracts/Bancor/BancorFormula.sol:259:        require(_baseN < MAX_NUM);
./contracts/Bancor/BancorFormula.sol:356:        require(false);

3. Unbounded loops with external calls

Some external function take arrays from users and iterate thorugh them. If a user sends very large loop the transaction may be too big to fit in a single block. Checking for a resonable array size in such case is a best pracitce.

4. Address(0) checks while setting adderss in initialize() in NibblVault.sol

Check for zero address in the initialize function, so it doesn't gets set to 0 accidently.

5. Address(0) checks for withdraw methods for ERC20, ERC721 and ERC1155

The token withdraw methods for ERC20, ERC721 and ERC1155 take _to address to which these tokens are transferred, but this address may be accidently sent to zero address and the tokens may be lost forever.

This is very important for critical role changes such as updateCurator()

6. buy() function is not making any external calls, so reentrancy guard lock maynot be needed

7. Unused receive() should revert

8. floating pragma in AccessControlMechanism.sol

mundhrakeshav commented 2 years ago

https://github.com/code-423n4/2022-06-nibbl-findings/issues/2, https://github.com/code-423n4/2022-06-nibbl-findings/issues/3, https://github.com/code-423n4/2022-06-nibbl-findings/issues/6, https://github.com/code-423n4/2022-06-nibbl-findings/issues/7, https://github.com/code-423n4/2022-06-nibbl-findings/issues/8, https://github.com/code-423n4/2022-06-nibbl-findings/issues/15

HardlyDifficult commented 2 years ago

Merging with https://github.com/code-423n4/2022-06-nibbl-findings/issues/248

HardlyDifficult commented 2 years ago

Merging with https://github.com/code-423n4/2022-06-nibbl-findings/issues/253

HardlyDifficult commented 2 years ago

Good & relevant feedback. Low & NC suggestions.