sherlock-audit / 2024-05-kwenta-x-perennial-integration-update-judging

5 stars 3 forks source link

Informational 02 Unused Function #39

Closed sherlock-admin3 closed 5 months ago

sherlock-admin3 commented 5 months ago

Informational 02 Unused Function

Low/Info issue submitted by 1337web3

Summary

During the audit of the smart contract code, an unused overridden function _raiseKeeperFee was identified. This function is defined but not utilized anywhere within the contract, raising concerns regarding potential code bloat and clarity of contract functionality.

Vulnerability Detail

The function _raiseKeeperFee is defined in the contract but is not called or utilized anywhere in the contract's logic. Additionally, it is mentioned that this function is overridden, suggesting that it is meant to replace a function defined in a parent contract. However, due to its lack of usage, it serves no purpose in the current implementation of the contract.

https://github.com/sherlock-audit/2024-05-kwenta-x-perennial-integration-update/blob/main/perennial-v2/packages/perennial-extensions/contracts/MultiInvoker.sol#L414-L420

Impact

The presence of unused code can lead to confusion for developers reviewing the contract and can potentially introduce unnecessary gas costs for deploying and executing the contract on the blockchain. Furthermore, unused code poses a security risk as it may contain vulnerabilities that could be exploited if accidentally invoked in the future.

Code Snippet

function _raiseKeeperFee(UFixed18 keeperFee, bytes memory data) internal virtual override returns (UFixed18) {
    (address account, IMarket market, UFixed6 fee) = abi.decode(data, (address, IMarket, UFixed6));
    UFixed6 raisedKeeperFee = UFixed6Lib.from(keeperFee, true).min(fee);
    _marketWithdraw(market, account, raisedKeeperFee);

    return UFixed18Lib.from(raisedKeeperFee);
}

Tool used

Manual Review

Recommendation

Consider removing the _raiseKeeperFee function entirely from the contract if it serves no purpose in the current design.