Skip to content

Commit

Permalink
Add headless execution
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranbt committed Feb 2, 2024
1 parent 264f908 commit 7cd156a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[profile.ci.fuzz]
runs = 10_000
solc_version = "0.8.23"
solc_version = "0.8.23"
[profile.suave]
whitelist = ["*"]
2 changes: 2 additions & 0 deletions src/Test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ contract SuaveEnabled is Test {
inputs[2] = "status";

try vm.ffi(inputs) returns (bytes memory response) {
/*
// the status call of the `suave-geth forge` command fails with the 'not-ok' prefix
// which is '6e6f742d6f6b' in hex
if (isPrefix(hex"6e6f742d6f6b", response)) {
revert("Local Suave node not detected running");
}
*/
} catch (bytes memory reason) {
revert(detectErrorMessage(reason));
}
Expand Down
12 changes: 9 additions & 3 deletions src/forge/Connector.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ import "forge-std/Test.sol";

contract Connector is Test {
function forgeIt(bytes memory addr, bytes memory data) internal returns (bytes memory) {
string memory root = vm.projectRoot();
string memory foundryToml = string.concat(root, "/", "foundry.toml");

string memory addrHex = iToHex(addr);
string memory dataHex = iToHex(data);

string[] memory inputs = new string[](4);
string[] memory inputs = new string[](7);
inputs[0] = "suave-geth";
inputs[1] = "forge";
inputs[2] = addrHex;
inputs[3] = dataHex;
inputs[2] = "--local";
inputs[3] = "--config";
inputs[4] = foundryToml;
inputs[5] = addrHex;
inputs[6] = dataHex;

bytes memory res = vm.ffi(inputs);
return res;
Expand Down

0 comments on commit 7cd156a

Please sign in to comment.