Skip to content

Commit

Permalink
test: use staticcall
Browse files Browse the repository at this point in the history
  • Loading branch information
dcposch committed Sep 11, 2023
1 parent d4230d2 commit 0fb9a92
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/P256Verifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ contract P256VerifierTest is Test {
bytes memory input = abi.encodePacked(hash, r, s, x, y);

uint gasBefore = gasleft();
(bool success, bytes memory result) = address(verifier).call(input);
(bool success, bytes memory res) = address(verifier).staticcall(input);
gasUsed = gasBefore - gasleft();

assertEq(success, true, "call failed");
assertEq(result.length, 32, "invalid result length");
uint256 res = abi.decode(result, (uint256));
assertTrue(res == 1 || res == 0, "invalid result");
assertEq(res.length, 32, "invalid result length");
uint256 result = abi.decode(res, (uint256));
assertTrue(result == 1 || result == 0, "invalid result");

return (res == 1, gasUsed);
return (result == 1, gasUsed);
}

// Sanity check. Demonstrate input and output handling.
Expand Down

0 comments on commit 0fb9a92

Please sign in to comment.