Omniscia Evergon Labs Audit

DelegateCallee Manual Review Findings

DelegateCallee Manual Review Findings

DCE-01M: Redundant Emission of Caller

Description:

The DelegateCallee::onlyExternalDelegateCall modifier will emit the msg.sender that has been mandated as being equal to address(this), thereby emitting the same value each time.

Example:

packages/contracts/contracts/helpers/DelegateCallee.sol
46/**
47 * @notice Restricts access to functions that should only be invoked via "external" delegate calls
48 * (calls originating from an admin or other external caller targeting the diamond).
49 * This modifier is mainly used to ensure that initialization operations cannot be executed directly
50 * by the diamond contract itself.
51 *
52 * @dev This modifier checks that the caller is not the contract itself (i.e., the diamond).
53 * If the function is called by the diamond, the transaction will revert.
54 */
55modifier onlyExternalDelegateCall() {
56 if (msg.sender == address(this)) {
57 revert OnlyExternalDelegateCall(msg.sender);
58 }
59 _;
60}

Recommendation:

We advise the argument of the OnlyExternalDelegateCall error to be omitted, and potentially replaced by a more useful contextual variable such as the msg.sig that was invoked.

Alleviation (b64b659786cf3c84bea52feb3a69f546ba3601f0):

The redundant emission of the caller has been replaced with an emission of the function signature instead, increasing the usability of the error and thus addressing this exhibit.