Closed code423n4 closed 2 years ago
defsec
This does not directly impact the smart contract in anyway besides cost. This is a gas optimization to reduce cost of smart contract. Calling each function, we can see that the public function uses 496 gas, while the external function uses only 261.
According to Slither Analyzer documentation (https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-external), there are functions in the contract that are never called. These functions should be declared as external in order to save gas.
Slither Detector:
external-function:
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L532
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L516
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L500
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L487
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L455
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L417
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L377
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L365
Slither
dupe of #260
Handle
defsec
Vulnerability details
Impact
This does not directly impact the smart contract in anyway besides cost. This is a gas optimization to reduce cost of smart contract. Calling each function, we can see that the public function uses 496 gas, while the external function uses only 261.
Proof of Concept
According to Slither Analyzer documentation (https://github.com/crytic/slither/wiki/Detector-Documentation#public-function-that-could-be-declared-external), there are functions in the contract that are never called. These functions should be declared as external in order to save gas.
Slither Detector:
external-function:
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L532
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L516
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L500
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L487
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L455
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L417
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L377
https://github.com/code-423n4/2021-11-streaming/blob/main/Streaming/src/Locke.sol#L365
Tools Used
Slither
Recommended Mitigation Steps