Open code423n4 opened 2 years ago
G-1 Don't Initialize Variables with Default Values Unititialized variables are assigned with the type default. When you initializing a variable with its default value cost unnecasary gas. OperatorResolver.sol L#40 OperatorResolver.sol L#60 OperatorResolver.sol L#75 NestedFactory.sol L#124 NestedFactory.sol L#136 [NestedFactory.sol L#196]https://github.com/code-423n4/2022-06-nested/blob/main/contracts/NestedFactory.sol#:~:text=_msgSender()%2C%20_originalTokenId)%3B-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20batchedOrdersLength%3B%20i%2B%2B)%20%7B,-(uint256%20fees NestedFactory.sol L#256 [NestedFactory.sol L#315]https://github.com/code-423n4/2022-06-nested/blob/main/contracts/NestedFactory.sol#:~:text=NF%3A%20RESERVE_MISMATCH%22)%3B-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20batchedOrdersLength%3B%20i%2B%2B)%20%7B,-(uint256%20fees [NestedFactory.sol L#333]https://github.com/code-423n4/2022-06-nested/blob/main/contracts/NestedFactory.sol#:~:text=NF%3A%20RESERVE_MISMATCH%22)%3B-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20batchedOrdersLength%3B%20i%2B%2B)%20%7B,-(uint256%20feesAmount
G-2 Unnecessary checked arithmetic in for loops Usually there is no risk that the loop counter can overflow. Using Solidity unchecked block saves the overflow checks. By using unchecked { ++i } OperatorResolver.sol L#40 OperatorResolver.sol L#75 [NestedFactory.sol L#196]https://github.com/code-423n4/2022-06-nested/blob/main/contracts/NestedFactory.sol#:~:text=_msgSender()%2C%20_originalTokenId)%3B-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20batchedOrdersLength%3B%20i%2B%2B)%20%7B,-(uint256%20fees NestedFactory.sol L#256
unchecked
unchecked { ++i }
Duplicated of #2 at For loop optimizaion
G-1 Don't Initialize Variables with Default Values Unititialized variables are assigned with the type default. When you initializing a variable with its default value cost unnecasary gas. OperatorResolver.sol L#40 OperatorResolver.sol L#60 OperatorResolver.sol L#75 NestedFactory.sol L#124 NestedFactory.sol L#136 [NestedFactory.sol L#196]https://github.com/code-423n4/2022-06-nested/blob/main/contracts/NestedFactory.sol#:~:text=_msgSender()%2C%20_originalTokenId)%3B-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20batchedOrdersLength%3B%20i%2B%2B)%20%7B,-(uint256%20fees NestedFactory.sol L#256 [NestedFactory.sol L#315]https://github.com/code-423n4/2022-06-nested/blob/main/contracts/NestedFactory.sol#:~:text=NF%3A%20RESERVE_MISMATCH%22)%3B-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20batchedOrdersLength%3B%20i%2B%2B)%20%7B,-(uint256%20fees [NestedFactory.sol L#333]https://github.com/code-423n4/2022-06-nested/blob/main/contracts/NestedFactory.sol#:~:text=NF%3A%20RESERVE_MISMATCH%22)%3B-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20batchedOrdersLength%3B%20i%2B%2B)%20%7B,-(uint256%20feesAmount
G-2 Unnecessary checked arithmetic in for loops Usually there is no risk that the loop counter can overflow. Using Solidity
unchecked
block saves the overflow checks. By usingunchecked { ++i }
OperatorResolver.sol L#40 OperatorResolver.sol L#75 [NestedFactory.sol L#196]https://github.com/code-423n4/2022-06-nested/blob/main/contracts/NestedFactory.sol#:~:text=_msgSender()%2C%20_originalTokenId)%3B-,for%20(uint256%20i%20%3D%200%3B%20i%20%3C%20batchedOrdersLength%3B%20i%2B%2B)%20%7B,-(uint256%20fees NestedFactory.sol L#256