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

5 stars 3 forks source link

`msg.sender` will always be account owner, unnecessary function cost more gas #37

Closed sherlock-admin4 closed 5 months ago

sherlock-admin4 commented 5 months ago

msg.sender will always be account owner, unnecessary function cost more gas

Low/Info issue submitted by kgothatso

Summary

msg.sender will always be account owner

Vulnerability Detail

Impact

gas optimization

Code Snippet

this function are doing the same thing

     function invoke(Invocation[] calldata invocations) external payable {
        _invoke(msg.sender, invocations);
    }

    function invoke(address account, Invocation[] calldata invocations) external payable {
        _invoke(account, invocations);
    }

msg.sender will always be account owner because of this check

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

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

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

Tool used

manual Manual Review

Recommendation

remove one of the functions