Open PatrickAlphaC opened 1 year ago
This was an attempted workaround for https://github.com/a16z/halmos/issues/214
We can implement vm.readFile, in the mean time you can approximate the behavior with
string[] memory command = new string[](2);
command[0] = "cat";
command[1] = "compiled_huff.txt";
bytes memory bytecode = vm.ffi(command);
⚠️ heads up though, foundry's ffi will parse the hex string and turn it into the equivalent bytes but halmos' ffi will just return the hex string which can't be deployed directly. We will also need to support that for compatibility
@PatrickAlphaC As soon as this is merged, it would be a nicer workaround: https://github.com/a16z/halmos/pull/215
Awesome!
Describe the bug I am attempting to use my compiled huff contract without hard-coding it into my scripts. I have compiled my huff to
compiled_huff.txt
. Foundry has a cheatcode calledreadFile
that allows you to read the file in. However, it looks like Halmos doesn't expect this and reverts when this happens.When running a halmos test, you get this output:
To Reproduce
Create a new forge project
Put really anything into a file at the root dir called
compiled_huff.txt
.Add this file to the test dir
import {Test, console2} from "forge-std/Test.sol";
contract Base_Test is Test { function setUp() public virtual { string memory path = "compiled_huff.txt"; string memory huffString = vm.readFile(path); }
}
halmos --function check_storeAndReadAreIdentical
halmos==0.1.9 z3-solver==4.12.2.0