Redundant updateIndex Call in notifyRewardAmount Function
Summary
The notifyRewardAmount function in the contract contains a redundant call to updateIndex.
Vulnerability Detail
The notifyRewardAmount function calls updateIndex(reward) even though updateIndex is already invoked within the internal notifyRewardAmount function.
function notifyRewardAmount(IERC20 reward, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) {
updateIndex(reward); // @audit not needed
notifyRewardAmount(reward, amount, msg.sender);
}
Impact
The redundant call to updateIndex results in unnecessary computation and gas usage. While it does not cause a critical issue, it is an inefficiency that can be optimized to save gas costs and improve the overall performance of the contract.
Code Snippet
function notifyRewardAmount(IERC20 reward, uint256 amount) external onlyRole(DEFAULT_ADMIN_ROLE) {
updateIndex(reward); // @audit not needed
notifyRewardAmount(reward, amount, msg.sender);
}
Tool Used
Manual Review
Recommendation
Remove the redundant call to updateIndex in the notifyRewardAmount function, as it is already being called in the internal notifyRewardAmount function.
Odd Opaque Fox
Low/Info
Redundant
updateIndex
Call innotifyRewardAmount
FunctionSummary
The
notifyRewardAmount
function in the contract contains a redundant call toupdateIndex
.Vulnerability Detail
The
notifyRewardAmount
function callsupdateIndex(reward)
even thoughupdateIndex
is already invoked within the internalnotifyRewardAmount
function.Impact
The redundant call to
updateIndex
results in unnecessary computation and gas usage. While it does not cause a critical issue, it is an inefficiency that can be optimized to save gas costs and improve the overall performance of the contract.Code Snippet
Tool Used
Manual Review
Recommendation
Remove the redundant call to
updateIndex
in thenotifyRewardAmount
function, as it is already being called in the internalnotifyRewardAmount
function.