Skip to content

Commit

Permalink
Add check to validate that a Suave node is running (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranbt authored Jan 8, 2024
1 parent dfcedc2 commit cb8175f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ import "forge-std/Test.sol";

contract SuaveEnabled is Test {
function setUp() public {
string[] memory inputs = new string[](2);
string[] memory inputs = new string[](3);
inputs[0] = "suave";
inputs[1] = "forge";
inputs[2] = "status";

try vm.ffi(inputs) returns (bytes memory) {}
catch (bytes memory reason) {
try vm.ffi(inputs) returns (bytes memory response) {
// the prefix is 'not-ok'
if (isPrefix(hex"6e6f742d6f6b", response)) {
revert("Local Suave node not detected running");
}
} catch (bytes memory reason) {
revert(detectFFIErrorMessage(reason));
}

Expand Down

0 comments on commit cb8175f

Please sign in to comment.