Skip to content

Commit

Permalink
PoC: John's idea
Browse files Browse the repository at this point in the history
Test time
  • Loading branch information
clabby committed Apr 19, 2023
1 parent 66de741 commit bc124c4
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 103 deletions.
35 changes: 33 additions & 2 deletions op-bindings/bindings/l1crossdomainmessenger.go

Large diffs are not rendered by default.

35 changes: 33 additions & 2 deletions op-bindings/bindings/l2crossdomainmessenger.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion op-bindings/bindings/optimismportal.go

Large diffs are not rendered by default.

102 changes: 51 additions & 51 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ Bytes_slice_Test:test_slice_fromZeroIdx_works() (gas: 20826)
Bytes_toNibbles_Test:test_toNibbles_expectedResult128Bytes_works() (gas: 129874)
Bytes_toNibbles_Test:test_toNibbles_expectedResult5Bytes_works() (gas: 6132)
Bytes_toNibbles_Test:test_toNibbles_zeroLengthInput_works() (gas: 944)
CrossDomainMessenger_BaseGas_Test:test_baseGas_succeeds() (gas: 20097)
CrossDomainMessenger_BaseGas_Test:test_baseGas_succeeds() (gas: 20203)
CrossDomainOwnable2_Test:test_onlyOwner_notMessenger_reverts() (gas: 8416)
CrossDomainOwnable2_Test:test_onlyOwner_notOwner2_reverts() (gas: 57254)
CrossDomainOwnable2_Test:test_onlyOwner_notOwner2_reverts() (gas: 57292)
CrossDomainOwnable2_Test:test_onlyOwner_notOwner_reverts() (gas: 16566)
CrossDomainOwnable2_Test:test_onlyOwner_succeeds() (gas: 73282)
CrossDomainOwnable2_Test:test_onlyOwner_succeeds() (gas: 73320)
CrossDomainOwnable3_Test:test_constructor_succeeds() (gas: 10554)
CrossDomainOwnable3_Test:test_crossDomainOnlyOwner_notMessenger_reverts() (gas: 28334)
CrossDomainOwnable3_Test:test_crossDomainOnlyOwner_notOwner2_reverts() (gas: 73730)
CrossDomainOwnable3_Test:test_crossDomainOnlyOwner_notOwner2_reverts() (gas: 73768)
CrossDomainOwnable3_Test:test_crossDomainOnlyOwner_notOwner_reverts() (gas: 31978)
CrossDomainOwnable3_Test:test_crossDomainTransferOwnership_succeeds() (gas: 91287)
CrossDomainOwnable3_Test:test_crossDomainTransferOwnership_succeeds() (gas: 91325)
CrossDomainOwnable3_Test:test_localOnlyOwner_notOwner_reverts() (gas: 13193)
CrossDomainOwnable3_Test:test_localOnlyOwner_succeeds() (gas: 35220)
CrossDomainOwnable3_Test:test_localTransferOwnership_succeeds() (gas: 52128)
Expand All @@ -29,12 +29,12 @@ DeployerWhitelist_Test:test_owner_succeeds() (gas: 7582)
DeployerWhitelist_Test:test_storageSlots_succeeds() (gas: 33395)
FeeVault_Test:test_constructor_succeeds() (gas: 10736)
FeeVault_Test:test_minWithdrawalAmount_succeeds() (gas: 10713)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 266854)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2100005)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 452633)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 3199770)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 353890)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 2634733)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_0() (gas: 346940)
GasBenchMark_L1CrossDomainMessenger:test_sendMessage_benchmark_1() (gas: 2900083)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_0() (gas: 532719)
GasBenchMark_L1StandardBridge_Deposit:test_depositERC20_benchmark_1() (gas: 4000020)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_0() (gas: 433976)
GasBenchMark_L1StandardBridge_Deposit:test_depositETH_benchmark_1() (gas: 3434811)
GasBenchMark_L1StandardBridge_Finalize:test_finalizeETHWithdrawal_benchmark() (gas: 40409)
GasBenchMark_L2OutputOracle:test_proposeL2Output_benchmark() (gas: 88513)
GasBenchMark_OptimismPortal:test_depositTransaction_benchmark() (gas: 75078)
Expand Down Expand Up @@ -69,42 +69,42 @@ L1BlockTest:test_sequenceNumber_succeeds() (gas: 7630)
L1BlockTest:test_timestamp_succeeds() (gas: 7640)
L1BlockTest:test_updateValues_succeeds() (gas: 60482)
L1CrossDomainMessenger_Test:test_messageVersion_succeeds() (gas: 24715)
L1CrossDomainMessenger_Test:test_relayMessage_legacyOldReplay_reverts() (gas: 49394)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterFailureThenSuccess_reverts() (gas: 209286)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterFailure_succeeds() (gas: 203184)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterSuccess_reverts() (gas: 123784)
L1CrossDomainMessenger_Test:test_relayMessage_legacy_succeeds() (gas: 77098)
L1CrossDomainMessenger_Test:test_relayMessage_retryAfterFailure_succeeds() (gas: 197091)
L1CrossDomainMessenger_Test:test_relayMessage_succeeds() (gas: 74034)
L1CrossDomainMessenger_Test:test_relayMessage_legacyOldReplay_reverts() (gas: 49395)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterFailureThenSuccess_reverts() (gas: 209364)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterFailure_succeeds() (gas: 203262)
L1CrossDomainMessenger_Test:test_relayMessage_legacyRetryAfterSuccess_reverts() (gas: 123823)
L1CrossDomainMessenger_Test:test_relayMessage_legacy_succeeds() (gas: 77137)
L1CrossDomainMessenger_Test:test_relayMessage_retryAfterFailure_succeeds() (gas: 197169)
L1CrossDomainMessenger_Test:test_relayMessage_succeeds() (gas: 74073)
L1CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 56540)
L1CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 12365)
L1CrossDomainMessenger_Test:test_replayMessage_withValue_reverts() (gas: 31063)
L1CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 304740)
L1CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 1496124)
L1CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 84563)
L1CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 385038)
L1CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 1656296)
L1CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 84601)
L1CrossDomainMessenger_Test:test_xDomainSender_notSet_reverts() (gas: 24296)
L1ERC721Bridge_Test:test_bridgeERC721To_localTokenZeroAddress_reverts() (gas: 52707)
L1ERC721Bridge_Test:test_bridgeERC721To_remoteTokenZeroAddress_reverts() (gas: 27310)
L1ERC721Bridge_Test:test_bridgeERC721To_succeeds() (gas: 359991)
L1ERC721Bridge_Test:test_bridgeERC721To_succeeds() (gas: 440077)
L1ERC721Bridge_Test:test_bridgeERC721To_wrongOwner_reverts() (gas: 60934)
L1ERC721Bridge_Test:test_bridgeERC721_fromContract_reverts() (gas: 25666)
L1ERC721Bridge_Test:test_bridgeERC721_localTokenZeroAddress_reverts() (gas: 50564)
L1ERC721Bridge_Test:test_bridgeERC721_remoteTokenZeroAddress_reverts() (gas: 25124)
L1ERC721Bridge_Test:test_bridgeERC721_succeeds() (gas: 357571)
L1ERC721Bridge_Test:test_bridgeERC721_succeeds() (gas: 437657)
L1ERC721Bridge_Test:test_bridgeERC721_wrongOwner_reverts() (gas: 60830)
L1ERC721Bridge_Test:test_constructor_succeeds() (gas: 10200)
L1ERC721Bridge_Test:test_finalizeBridgeERC721_notEscrowed_reverts() (gas: 22119)
L1ERC721Bridge_Test:test_finalizeBridgeERC721_notFromRemoteMessenger_reverts() (gas: 19797)
L1ERC721Bridge_Test:test_finalizeBridgeERC721_notViaLocalMessenger_reverts() (gas: 16049)
L1ERC721Bridge_Test:test_finalizeBridgeERC721_selfToken_reverts() (gas: 17615)
L1ERC721Bridge_Test:test_finalizeBridgeERC721_succeeds() (gas: 329083)
L1StandardBridge_BridgeETHTo_Test:test_bridgeETHTo_succeeds() (gas: 424648)
L1StandardBridge_BridgeETH_Test:test_bridgeETH_succeeds() (gas: 411869)
L1StandardBridge_DepositERC20To_Test:test_depositERC20To_succeeds() (gas: 630124)
L1StandardBridge_DepositERC20_Test:test_depositERC20_succeeds() (gas: 627825)
L1ERC721Bridge_Test:test_finalizeBridgeERC721_succeeds() (gas: 409169)
L1StandardBridge_BridgeETHTo_Test:test_bridgeETHTo_succeeds() (gas: 504840)
L1StandardBridge_BridgeETH_Test:test_bridgeETH_succeeds() (gas: 492061)
L1StandardBridge_DepositERC20To_Test:test_depositERC20To_succeeds() (gas: 710316)
L1StandardBridge_DepositERC20_Test:test_depositERC20_succeeds() (gas: 708017)
L1StandardBridge_DepositERC20_TestFail:test_depositERC20_notEoa_reverts() (gas: 22320)
L1StandardBridge_DepositETHTo_Test:test_depositETHTo_succeeds() (gas: 424725)
L1StandardBridge_DepositETH_Test:test_depositETH_succeeds() (gas: 411963)
L1StandardBridge_DepositETHTo_Test:test_depositETHTo_succeeds() (gas: 504917)
L1StandardBridge_DepositETH_Test:test_depositETH_succeeds() (gas: 492155)
L1StandardBridge_DepositETH_TestFail:test_depositETH_notEoa_reverts() (gas: 40780)
L1StandardBridge_FinalizeBridgeETH_Test:test_finalizeBridgeETH_succeeds() (gas: 51674)
L1StandardBridge_FinalizeBridgeETH_TestFail:test_finalizeBridgeETH_incorrectValue_reverts() (gas: 34204)
Expand All @@ -116,32 +116,32 @@ L1StandardBridge_FinalizeERC20Withdrawal_TestFail:test_finalizeERC20Withdrawal_n
L1StandardBridge_FinalizeETHWithdrawal_Test:test_finalizeETHWithdrawal_succeeds() (gas: 61722)
L1StandardBridge_Getter_Test:test_getters_succeeds() (gas: 32173)
L1StandardBridge_Initialize_Test:test_initialize_succeeds() (gas: 22050)
L1StandardBridge_Receive_Test:test_receive_succeeds() (gas: 525438)
L1StandardBridge_Receive_Test:test_receive_succeeds() (gas: 605524)
L2CrossDomainMessenger_Test:test_messageVersion_succeeds() (gas: 8411)
L2CrossDomainMessenger_Test:test_relayMessage_retry_succeeds() (gas: 163159)
L2CrossDomainMessenger_Test:test_relayMessage_succeeds() (gas: 48640)
L2CrossDomainMessenger_Test:test_relayMessage_retry_succeeds() (gas: 163369)
L2CrossDomainMessenger_Test:test_relayMessage_succeeds() (gas: 48745)
L2CrossDomainMessenger_Test:test_relayMessage_toSystemContract_reverts() (gas: 29021)
L2CrossDomainMessenger_Test:test_relayMessage_v2_reverts() (gas: 11711)
L2CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 122508)
L2CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 134826)
L2CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 48139)
L2CrossDomainMessenger_Test:test_sendMessage_succeeds() (gas: 122932)
L2CrossDomainMessenger_Test:test_sendMessage_twice_succeeds() (gas: 135038)
L2CrossDomainMessenger_Test:test_xDomainMessageSender_reset_succeeds() (gas: 48177)
L2CrossDomainMessenger_Test:test_xDomainSender_senderNotSet_reverts() (gas: 10590)
L2ERC721Bridge_Test:test_bridgeERC721To_localTokenZeroAddress_reverts() (gas: 26431)
L2ERC721Bridge_Test:test_bridgeERC721To_remoteTokenZeroAddress_reverts() (gas: 21814)
L2ERC721Bridge_Test:test_bridgeERC721To_succeeds() (gas: 147041)
L2ERC721Bridge_Test:test_bridgeERC721To_succeeds() (gas: 147147)
L2ERC721Bridge_Test:test_bridgeERC721To_wrongOwner_reverts() (gas: 29449)
L2ERC721Bridge_Test:test_bridgeERC721_fromContract_reverts() (gas: 22148)
L2ERC721Bridge_Test:test_bridgeERC721_localTokenZeroAddress_reverts() (gas: 24310)
L2ERC721Bridge_Test:test_bridgeERC721_remoteTokenZeroAddress_reverts() (gas: 19628)
L2ERC721Bridge_Test:test_bridgeERC721_succeeds() (gas: 144643)
L2ERC721Bridge_Test:test_bridgeERC721_succeeds() (gas: 144749)
L2ERC721Bridge_Test:test_bridgeERC721_wrongOwner_reverts() (gas: 29258)
L2ERC721Bridge_Test:test_constructor_succeeds() (gas: 10110)
L2ERC721Bridge_Test:test_finalizeBridgeERC721_alreadyExists_reverts() (gas: 29128)
L2ERC721Bridge_Test:test_finalizeBridgeERC721_interfaceNotCompliant_reverts() (gas: 236012)
L2ERC721Bridge_Test:test_finalizeBridgeERC721_interfaceNotCompliant_reverts() (gas: 236118)
L2ERC721Bridge_Test:test_finalizeBridgeERC721_notFromRemoteMessenger_reverts() (gas: 19874)
L2ERC721Bridge_Test:test_finalizeBridgeERC721_notViaLocalMessenger_reverts() (gas: 16104)
L2ERC721Bridge_Test:test_finalizeBridgeERC721_selfToken_reverts() (gas: 17659)
L2ERC721Bridge_Test:test_finalizeBridgeERC721_succeeds() (gas: 168970)
L2ERC721Bridge_Test:test_finalizeBridgeERC721_succeeds() (gas: 169076)
L2OutputOracleTest:test_computeL2Timestamp_succeeds() (gas: 37298)
L2OutputOracleTest:test_constructor_badTimestamp_reverts() (gas: 70947)
L2OutputOracleTest:test_constructor_l2BlockTimeZero_reverts() (gas: 45954)
Expand Down Expand Up @@ -171,22 +171,22 @@ L2OutputOracleUpgradeable_Test:test_initValuesOnProxy_succeeds() (gas: 26208)
L2OutputOracleUpgradeable_Test:test_initializeImpl_alreadyInitialized_reverts() (gas: 15149)
L2OutputOracleUpgradeable_Test:test_initializeProxy_alreadyInitialized_reverts() (gas: 20175)
L2OutputOracleUpgradeable_Test:test_upgrading_succeeds() (gas: 180481)
L2StandardBridge_BridgeERC20To_Test:test_bridgeERC20To_succeeds() (gas: 389773)
L2StandardBridge_BridgeERC20To_Test:test_withdrawTo_withdrawingERC20_succeeds() (gas: 390006)
L2StandardBridge_BridgeERC20_Test:test_bridgeERC20_succeeds() (gas: 385280)
L2StandardBridge_BridgeERC20_Test:test_bridgeLegacyERC20_succeeds() (gas: 393552)
L2StandardBridge_BridgeERC20_Test:test_withdrawLegacyERC20_succeeds() (gas: 393878)
L2StandardBridge_BridgeERC20To_Test:test_bridgeERC20To_succeeds() (gas: 389943)
L2StandardBridge_BridgeERC20To_Test:test_withdrawTo_withdrawingERC20_succeeds() (gas: 390176)
L2StandardBridge_BridgeERC20_Test:test_bridgeERC20_succeeds() (gas: 385449)
L2StandardBridge_BridgeERC20_Test:test_bridgeLegacyERC20_succeeds() (gas: 393722)
L2StandardBridge_BridgeERC20_Test:test_withdrawLegacyERC20_succeeds() (gas: 394048)
L2StandardBridge_BridgeERC20_Test:test_withdraw_notEOA_reverts() (gas: 251758)
L2StandardBridge_BridgeERC20_Test:test_withdraw_withdrawingERC20_succeeds() (gas: 385508)
L2StandardBridge_BridgeERC20_Test:test_withdraw_withdrawingERC20_succeeds() (gas: 385677)
L2StandardBridge_Bridge_Test:test_finalizeBridgeETH_incorrectValue_reverts() (gas: 23843)
L2StandardBridge_Bridge_Test:test_finalizeBridgeETH_sendToMessenger_reverts() (gas: 23982)
L2StandardBridge_Bridge_Test:test_finalizeBridgeETH_sendToSelf_reverts() (gas: 23870)
L2StandardBridge_Bridge_Test:test_finalizeDeposit_depositingERC20_succeeds() (gas: 93824)
L2StandardBridge_Bridge_Test:test_finalizeDeposit_depositingETH_succeeds() (gas: 92700)
L2StandardBridge_FinalizeBridgeETH_Test:test_finalizeBridgeETH_succeeds() (gas: 43155)
L2StandardBridge_Test:test_initialize_succeeds() (gas: 24292)
L2StandardBridge_Test:test_receive_succeeds() (gas: 174011)
L2StandardBridge_Test:test_withdraw_ether_succeeds() (gas: 140478)
L2StandardBridge_Test:test_receive_succeeds() (gas: 174223)
L2StandardBridge_Test:test_withdraw_ether_succeeds() (gas: 140584)
L2StandardBridge_Test:test_withdraw_insufficientValue_reverts() (gas: 16485)
L2ToL1MessagePasserTest:test_burn_succeeds() (gas: 112572)
L2ToL1MessagePasserTest:test_initiateWithdrawal_fromContract_succeeds() (gas: 70445)
Expand Down Expand Up @@ -402,15 +402,15 @@ ResourceMetering_Test:test_meter_updateTenEmptyBlocks_succeeds() (gas: 21713)
ResourceMetering_Test:test_meter_updateTwoEmptyBlocks_succeeds() (gas: 21669)
ResourceMetering_Test:test_meter_useMax_succeeds() (gas: 20018715)
ResourceMetering_Test:test_meter_useMoreThanMax_reverts() (gas: 17505)
SafeCall_call_Test:test_callWithMinGas_noLeakageHigh_succeeds() (gas: 2075873614)
SafeCall_call_Test:test_callWithMinGas_noLeakageLow_succeeds() (gas: 753665282)
SafeCall_Test:test_callWithMinGas_noLeakageHigh_succeeds() (gas: 1015173257)
SafeCall_Test:test_callWithMinGas_noLeakageLow_succeeds() (gas: 1091637088)
Semver_Test:test_behindProxy_succeeds() (gas: 506748)
Semver_Test:test_version_succeeds() (gas: 9418)
SequencerFeeVault_Test:test_constructor_succeeds() (gas: 5526)
SequencerFeeVault_Test:test_minWithdrawalAmount_succeeds() (gas: 5442)
SequencerFeeVault_Test:test_receive_succeeds() (gas: 17373)
SequencerFeeVault_Test:test_withdraw_notEnough_reverts() (gas: 9331)
SequencerFeeVault_Test:test_withdraw_succeeds() (gas: 163228)
SequencerFeeVault_Test:test_withdraw_succeeds() (gas: 163334)
SetPrevBaseFee_Test:test_setPrevBaseFee_succeeds() (gas: 11515)
StandardBridge_Stateless_Test:test_isCorrectTokenPair_succeeds() (gas: 49936)
StandardBridge_Stateless_Test:test_isOptimismMintableERC20_succeeds() (gas: 33072)
Expand Down
5 changes: 1 addition & 4 deletions packages/contracts-bedrock/contracts/L1/OptimismPortal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,7 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
// 2. The amount of gas provided to the call to the target contract is at least the gas
// limit specified by the user. If there is not enough gas in the callframe to
// accomplish this, `callWithMinGas` will revert.
// Additionally, we use 0 `_reservedGas` here because it does not matter if this context
// reverts with "Out of Gas." This is because the user will be able to re-attempt
// finalization of the withdrawal with a higher gas limit.
bool success = SafeCall.callWithMinGas(_tx.target, _tx.gasLimit, _tx.value, 0, _tx.data);
bool success = SafeCall.callWithMinGas(_tx.target, _tx.gasLimit, _tx.value, _tx.data);

// Reset the l2Sender back to the default value.
l2Sender = Constants.DEFAULT_L2_SENDER;
Expand Down
16 changes: 7 additions & 9 deletions packages/contracts-bedrock/contracts/libraries/SafeCall.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,20 @@ library SafeCall {
* will revert if the call cannot be performed with the specified minimum
* gas.
*
* @param _target Address to call
* @param _minGas The minimum amount of gas that may be passed to the call
* @param _value Amount of value to pass to the call
* @param _reservedGas The amount of gas to reserve on top of the 40_000 gas base buffer
* @param _calldata Calldata to pass to the call
* @param _target Address to call
* @param _minGas The minimum amount of gas that may be passed to the call
* @param _value Amount of value to pass to the call
* @param _calldata Calldata to pass to the call
*/
function callWithMinGas(
address _target,
uint256 _minGas,
uint256 _value,
uint256 _reservedGas,
bytes memory _calldata
) internal returns (bool) {
bool _success;
assembly {
// Assertion: gasleft() >= (_minGas * 64) / 63 + (40_000 + _reservedGas)
// Assertion: gasleft() >= (_minGas * 64) / 63 + 40_000
//
// Because EIP-150 ensures that a maximum of 63/64ths of the remaining gas in the call
// frame may be passed to a subcontext, we need to ensure that the gas will not be
Expand All @@ -69,7 +67,7 @@ library SafeCall {
// still possible to self-rekt by passing a minimum gas limit that does not account
// for the `memory_expansion_cost + code_execution_cost` factors of the dynamic
// cost of the `CALL` opcode.
if lt(gas(), add(div(mul(_minGas, 64), 63), add(40000, _reservedGas))) {
if lt(gas(), add(div(mul(_minGas, 64), 63), 40000)) {
// Store the "Error(string)" selector in scratch space.
mstore(0, 0x08c379a0)
// Store the pointer to the string length in scratch space.
Expand All @@ -96,7 +94,7 @@ library SafeCall {
// factors of the dynamic cost of the `CALL` opcode), the call will receive at least
// the minimum amount of gas specified.
_success := call(
sub(gas(), _reservedGas), // gas
gas(), // gas
_target, // recipient
_value, // ether value
add(_calldata, 32), // inloc
Expand Down
11 changes: 5 additions & 6 deletions packages/contracts-bedrock/contracts/test/SafeCall.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ contract SafeCall_Test is CommonTest {

vm.expectCallMinGas(to, value, minGas, data);
vm.prank(from);
bool success = SafeCall.callWithMinGas(to, minGas, value, 0, data);
bool success = SafeCall.callWithMinGas(to, minGas, value, data);

assertTrue(success, "call not successful");
if (from == to) {
Expand All @@ -90,9 +90,9 @@ contract SafeCall_Test is CommonTest {
for (uint64 i = 40_000; i < 100_000; i++) {
uint256 snapshot = vm.snapshot();

// 65_879 is the exact amount of gas required to make the safe call
// 65_867 is the exact amount of gas required to make the safe call
// successfully.
if (i < 65_879) {
if (i < 65_867) {
assertFalse(caller.makeSafeCall(i, 25_000));
} else {
vm.expectCallMinGas(
Expand All @@ -114,9 +114,9 @@ contract SafeCall_Test is CommonTest {
for (uint64 i = 15_200_000; i < 15_300_000; i++) {
uint256 snapshot = vm.snapshot();

// 15,278_578 is the exact amount of gas required to make the safe call
// 15_278_566 is the exact amount of gas required to make the safe call
// successfully.
if (i < 15_278_578) {
if (i < 15_278_566) {
assertFalse(caller.makeSafeCall(i, 15_000_000));
} else {
vm.expectCallMinGas(
Expand Down Expand Up @@ -152,7 +152,6 @@ contract SimpleSafeCaller {
address(this),
minGas,
0,
0,
abi.encodeWithSelector(this.setA.selector, 1)
);
}
Expand Down
Loading

0 comments on commit bc124c4

Please sign in to comment.