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

4 stars 0 forks source link

QA Report #327

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

[QA-1][InfinityExchange.sol] Extra space exists at the comment

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/core/InfinityExchange.sol#L172

@notice Matches one  order to many orders. Example: A buy order with 5 specific NFTs with 5 sell orders with those specific NFTs.

There is 1 additional space between one and order in the comment.


[QA-2] Capital letters are used for PRECISION variable

Throughout the codebase, capital letters are only used for the constant. However, PRECISION is local variable, but its naming is in caplital letters.

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/core/InfinityExchange.sol#L1161

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/core/InfinityOrderBookComplication.sol#L338

It should simply name precision instead of PRECISION.


[QA-3] Non constant state variables have capital letters in their najming

capital letters with underscore should be used for constant according to solidity doc.

Constants should be named with all capital letters with underscores separating words

These variables are not constant, but their namings are for constants. https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/staking/InfinityStaker.sol#L25-L42


[QA-4] content error at unstake function

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/staking/InfinityStaker.sol#L117

require(amount != 0, 'stake amount cant be 0');

It says stake amount but it is in unstake function. Should it be unstake amount?


[QA-5] Unnecessary return variables

Following functions define return statement in its function signature. However, inside the function, it uses return to actually return the value.

For example, calculateConfigId function can be written like this without return variable.

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/TimelockConfig.sol#L76

  function calculateConfigId(string memory name) external pure returns (bytes32) {
    return keccak256(abi.encodePacked(name));
  }

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/InfinityToken.sol#L113

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/InfinityToken.sol#L117

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/InfinityToken.sol#L121

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/InfinityToken.sol#L125

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/InfinityToken.sol#L129

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/InfinityToken.sol#L133

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/TimelockConfig.sol#L76

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/TimelockConfig.sol#L80

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/TimelockConfig.sol#L84

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/TimelockConfig.sol#L88

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/TimelockConfig.sol#L93

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/TimelockConfig.sol#L98

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/TimelockConfig.sol#L102

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/TimelockConfig.sol#L106

https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/TimelockConfig.sol#L111


nneverlander commented 2 years ago

Thanks

HardlyDifficult commented 2 years ago

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