Skip to content

Add the way to make an external call to targets from any place in solidity #560

@igorganich

Description

@igorganich

Is your feature request related to a problem? Please describe.
In invariant testing we have some set of contracts and selectors as targets from setUp(). But we cannot force this set of targets to be called from, for example, a symbolic callback handler.

Describe the solution you'd like
Add new cheatcode callTargetFromHere().
Reference is from here

fallback() external payable {
  ...
  executeSymbolicallyAllTargets("fallback_target");
  ...
}

In the case of invariant testing callbacks processing may look like

fallback() external payable {
  ...
  svm.callTargetFromHere()
  ...
}

This way we can access registered targets and call them from anywhere, minimizing mocks and pseudo-copies.
Describe alternatives you've considered
Add the --only_target_symbolic_address halmos parameter, which will force halmos to only substitute registered targets in the case of call to symbolic address. This is much harder, because you will also have to process symbolic calldata (replace symbolic bytes array with all constraints with bytes from createCalldata())

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions