Skip to content

New cheatcode for making arbitrary external calls with ABI info #3

@daejunpark

Description

@daejunpark

Problem

Currently, an arbitrary external call can be made using a low-level call, e.g.,

data = svm.createBytes(1024, "data");
address(target).call(data);

However, if the target contract contains an external function that takes dynamic arrays as input, then the above will fail due to the symbolic calldataload offset error.

The current solution requires explicitly constructing calldata for functions that take dynamic arrays, which is cumbersome.

Proposal

Introduce a new cheatcode, say callAny(target, abi), that takes a target contract and the contract's ABI information. It will invoke all the external functions of the target, automatically constructing calldata based on the ABI.

The sizes of dynamic arrays can be specified as arguments within the cheatcode, or they will be implicitly set to a default value.

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