halmos icon indicating copy to clipboard operation
halmos copied to clipboard

Error: setUp() failed: ValueError: constructor failed, error=Unsupported cheat code: vm.envAddress

Open banescusebi opened this issue 1 year ago • 1 comments

Describe the bug

The constructor of the test contract is making use of vm.envAddress in the following way:

usdc = IERC20Metadata(vm.envAddress("USDC_ADDRESS"));

When running halmos I get the following error:

Error: setUp() failed: ValueError: constructor failed, error=Unsupported cheat code: calldata = 0x350d56bf00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000011544553545f555344545f41444452455353000000000000000000000000000000 returndata=None

Environment:

  • OS: macOS Sequoia
  • Python version: 3.9.6
  • Halmos and other dependency versions:
Package                   Version
------------------------- -----------
halmos                    0.1.13
pip                       24.3.1
z3-solver                 4.13.3.0

Is there a recommended workaround for this?

banescusebi avatar Dec 04 '24 14:12 banescusebi

until someone implements vm.envAddress(), the recommended approach is to define the variable in the test

0xkarmacoma avatar Mar 05 '25 17:03 0xkarmacoma

supported in #526

0xkarmacoma avatar Jun 10 '25 15:06 0xkarmacoma