Skip to content

Should execute revert if data is not empty while calling a target with empty code? #14

Open
@darwintree

Description

@darwintree

Currently, the reference implementation will execute call regardless of target

    function execute(
        address _target,
        uint256 _value,
        bytes calldata _data,
        uint256 _operation
    ) external payable override returns (bytes memory _result) {
        require(_isValidSigner(msg.sender), "Caller is not owner");
        require(_operation == 0, "Only call operations are supported");
        ++state;
        bool success;
        // solhint-disable-next-line avoid-low-level-calls
        (success, _result) = _target.call{value: _value}(_data);
        require(success, string(_result));
        return _result;
    }

However, it is problem-pone if the _target is set to a wrong address: nothing will happen after the unexpected call. Should the interface revert if data is not empty and target is not a contract?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions