Summary
Unnecessary argument passed to getTimeout function will cost additional gas
Impact
Around 2200 extra gas will be used for storing unnecessary argument
[PASS] testGetTimeout() (gas: 5532)
[PASS] testGetTimeoutWhitounArgument() (gas: 3352)
Tools Used
Observation, foundry unit test
Functions:
function getTimeout(AggregatorV3Interface ) public pure returns (uint256) {
return TIMEOUT;
}
function getTimeoutWhitounArgument() public pure returns (uint256) {
return TIMEOUT;
}
Tests:
function testGetTimeout() public {
uint256 expectedTimeout = 3 hours;
assertEq(OracleLib.getTimeout(AggregatorV3Interface(address(aggregator))), expectedTimeout);
}
function testGetTimeoutWhitounArgument() public {
uint256 expectedTimeout = 3 hours;
assertEq(OracleLib.getTimeoutWhitounArgument(), expectedTimeout);
}
Recommendations
Rewrite function to
function getTimeoutWhitounArgument() public pure returns (uint256) {
return TIMEOUT;
}