Skip to content

Commit

Permalink
Merge pull request ethereum-optimism#7960 from ethereum-optimism/ctb/…
Browse files Browse the repository at this point in the history
…safecall-test

contracts-bedrock: simplify safecall test
  • Loading branch information
tynes authored Oct 31, 2023
2 parents 59d7a8a + e4b6580 commit 840338d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ ResourceMetering_Test:test_meter_updateTwoEmptyBlocks_succeeds() (gas: 23703)
ResourceMetering_Test:test_meter_useMax_succeeds() (gas: 20020816)
ResourceMetering_Test:test_meter_useMoreThanMax_reverts() (gas: 19549)
SafeCall_Test:test_callWithMinGas_noLeakageHigh_succeeds() (gas: 1021670598)
SafeCall_Test:test_callWithMinGas_noLeakageLow_succeeds() (gas: 1095190710)
SafeCall_Test:test_callWithMinGas_noLeakageLow_succeeds() (gas: 1095190688)
Semver_Test:test_behindProxy_succeeds() (gas: 507558)
Semver_Test:test_version_succeeds() (gas: 9418)
SequencerFeeVault_L2Withdrawal_Test:test_withdraw_toL2_succeeds() (gas: 78333)
Expand Down
13 changes: 5 additions & 8 deletions packages/contracts-bedrock/test/SafeCall.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
pragma solidity 0.8.15;

// Testing utilities
import { CommonTest } from "test/CommonTest.t.sol";
import { Test } from "forge-std/Test.sol";

// Target contract
import { SafeCall } from "src/libraries/SafeCall.sol";

contract SafeCall_Test is CommonTest {
contract SafeCall_Test is Test {
/// @dev Tests that the `send` function succeeds.
function testFuzz_send_succeeds(address from, address to, uint256 gas, uint64 value) external {
vm.assume(from.balance == 0);
Expand All @@ -21,8 +21,7 @@ contract SafeCall_Test is CommonTest {
vm.assume(to != address(0x000000000000000000636F6e736F6c652e6c6f67));
// don't call the create2 deployer
vm.assume(to != address(0x4e59b44847b379578588920cA78FbF26c0B4956C));
// don't call the ffi interface
vm.assume(to != address(0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f));
vm.assume(to != address(this));

assertEq(from.balance, 0, "from balance is 0");
vm.deal(from, value);
Expand Down Expand Up @@ -56,8 +55,7 @@ contract SafeCall_Test is CommonTest {
vm.assume(to != address(0x000000000000000000636F6e736F6c652e6c6f67));
// don't call the create2 deployer
vm.assume(to != address(0x4e59b44847b379578588920cA78FbF26c0B4956C));
// don't call the ffi interface
vm.assume(to != address(0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f));
vm.assume(to != address(this));

assertEq(from.balance, 0, "from balance is 0");
vm.deal(from, value);
Expand Down Expand Up @@ -99,8 +97,7 @@ contract SafeCall_Test is CommonTest {
vm.assume(to != address(0x000000000000000000636F6e736F6c652e6c6f67));
// don't call the create2 deployer
vm.assume(to != address(0x4e59b44847b379578588920cA78FbF26c0B4956C));
// don't call the FFIInterface
vm.assume(to != address(0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f));
vm.assume(to != address(this));

assertEq(from.balance, 0, "from balance is 0");
vm.deal(from, value);
Expand Down

0 comments on commit 840338d

Please sign in to comment.