Closed code423n4 closed 2 years ago
WatchPug
Unused function parameters increase contract size and gas usage at deployment.
https://github.com/code-423n4/2021-11-nested/blob/f646002b692ca5fa3631acfff87dda897541cf41/contracts/NestedFactory.sol#L557-L559
function _calculateFees(address _user, uint256 _amount) private view returns (uint256) { return _amount / 100; }
_user is unused.
_user
https://github.com/code-423n4/2021-11-nested/blob/f646002b692ca5fa3631acfff87dda897541cf41/contracts/operators/Flat/FlatOperator.sol#L13-L29
function commitAndRevert( address self, address token, uint256 amount ) external payable override returns (uint256[] memory amounts, address[] memory tokens) { require(amount > 0, "FlatOperator::commitAndRevert: Amount must be greater than zero"); amounts = new uint256[](2); tokens = new address[](2); // Output amounts amounts[0] = amount; amounts[1] = amount; // Output token tokens[0] = token; tokens[1] = token; }
self is unused.
self
The first point is a duplicate of #167
Refute the second point. In fact, every operator needs the self parameter even if it's not used (keep the same interface).
Also comments are wrong (#194)
Handle
WatchPug
Vulnerability details
Unused function parameters increase contract size and gas usage at deployment.
https://github.com/code-423n4/2021-11-nested/blob/f646002b692ca5fa3631acfff87dda897541cf41/contracts/NestedFactory.sol#L557-L559
_user
is unused.https://github.com/code-423n4/2021-11-nested/blob/f646002b692ca5fa3631acfff87dda897541cf41/contracts/operators/Flat/FlatOperator.sol#L13-L29
self
is unused.