EIP-1380: Reduced gas cost for call to self

One simple test (for CALL only) https://github.com/ethereum/tests/commit/b7dfd94d252714f53557260421e52eed8d76c0e2

As requested by @axic here, an example of where such a change would be useful is for our Smart Contract Wallet implementation. Basically, every method in the wallet has a modifier called onlySelf() and each method needs to be executed from a function called execute():

/**
 * @notice Allow wallet owner to execute an action
 * @param _txs        Transactions to process
 * @param _nonce      Signature nonce (may contain an encoded space)
 * @param _signature  Encoded signature
 */
function execute(
  Transaction[] memory _txs,
  uint256 _nonce,
  bytes memory _signature
) {
   ...
}

This simplifies the writing of this contract because we donā€™t want to have to pass these arguments to every method in the if these methods can only be called within execute().

This allows us to write the remaining methods with the onlySelf() modifier instead of also passing a signature + nonce arguments there as well. Hereā€™s an example:

/**
 * @notice Adds a new hook to handle a given function selector
 * @param _signature Signature function linked to the hook
 * @param _implementation Hook implementation contract
 */
function addHook(bytes4 _signature, address _implementation) external onlySelf {
  require(hooks[_signature] == address(0), "ModuleHooks#addHook: HOOK_ALREADY_REGISTERED");
  hooks[_signature] = _implementation;
}

Where onlySelf() is defined as

modifier onlySelf() {
  require(msg.sender == address(this), "ModuleBase#onlySelf: NOT_AUTHORIZED");
  _;
}

Unfortunately, while this is a simpler implementation, it does end-up being more costly for the exact reasons outlined in EIP-1380, which is unfortunate as this added cost shouldnā€™t be present.