Skip to content

Commit

Permalink
Show precompile error message (#70)
Browse files Browse the repository at this point in the history
* Log precompile errors

* Remove
  • Loading branch information
ferranbt authored Mar 27, 2024
1 parent 1c7c09d commit 961d91f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/forge/Connector.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.8;

import "forge-std/Vm.sol";
import "forge-std/Test.sol";

contract Connector is Test {
Expand All @@ -20,8 +21,13 @@ contract Connector is Test {
inputs[5] = addrHex;
inputs[6] = dataHex;

bytes memory res = vm.ffi(inputs);
return res;
VmSafe.FfiResult memory result = vm.tryFfi(inputs);
if (result.exitCode == 0) {
return result.stdout;
}

console.log(string.concat("Precompile reverted: ", string(result.stderr)));
revert(string(result.stderr));
}

function iToHex(bytes memory buffer) public pure returns (string memory) {
Expand Down

0 comments on commit 961d91f

Please sign in to comment.