Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
daejunpark opened this issue Aug 22, 2023 · 0 comments
Open

Comments

@daejunpark
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant