Commit 83cd4177 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge pull request #4246 from ethereum-optimism/jm/ctb-test-cleanup/4

Rename L2Standard bridge tests
parents df6a65de b62149a0
...@@ -18,15 +18,15 @@ CrossDomainOwnable2_Test:test_revertNotSetOnlyOwner2() (gas: 14565) ...@@ -18,15 +18,15 @@ CrossDomainOwnable2_Test:test_revertNotSetOnlyOwner2() (gas: 14565)
CrossDomainOwnable2_Test:test_revertOnlyOwner() (gas: 61712) CrossDomainOwnable2_Test:test_revertOnlyOwner() (gas: 61712)
DeployerWhitelist_Test:test_owner() (gas: 7516) DeployerWhitelist_Test:test_owner() (gas: 7516)
DeployerWhitelist_Test:test_storageSlots() (gas: 33395) DeployerWhitelist_Test:test_storageSlots() (gas: 33395)
FeeVault_Test:test_constructor() (gas: 10623) FeeVault_Test:test_constructor_succeeds() (gas: 10601)
FeeVault_Test:test_minWithdrawalAmount() (gas: 10689) FeeVault_Test:test_minWithdrawalAmount_succeeds() (gas: 10668)
GasPriceOracle_Test:test_baseFee() (gas: 8281) GasPriceOracle_Test:test_baseFee_succeeds() (gas: 8291)
GasPriceOracle_Test:test_gasPrice() (gas: 8315) GasPriceOracle_Test:test_gasPrice_succeeds() (gas: 8294)
GasPriceOracle_Test:test_l1BaseFee() (gas: 10635) GasPriceOracle_Test:test_l1BaseFee_succeeds() (gas: 10656)
GasPriceOracle_Test:test_overhead() (gas: 10568) GasPriceOracle_Test:test_overhead_succeeds() (gas: 10546)
GasPriceOracle_Test:test_scalar() (gas: 10610) GasPriceOracle_Test:test_scalar_succeeds() (gas: 10611)
GasPriceOracle_Test:test_setGasPriceReverts() (gas: 5888) GasPriceOracle_Test:test_setGasPrice_doesNotExist_reverts() (gas: 5910)
GasPriceOracle_Test:test_setL1BaseFeeReverts() (gas: 5909) GasPriceOracle_Test:test_setL1BaseFee_doesNotExist_reverts() (gas: 5910)
Hashing_Test:test_hashDepositSource_succeeds() (gas: 650) Hashing_Test:test_hashDepositSource_succeeds() (gas: 650)
L1BlockTest:test_basefee() (gas: 7531) L1BlockTest:test_basefee() (gas: 7531)
L1BlockTest:test_hash() (gas: 7553) L1BlockTest:test_hash() (gas: 7553)
...@@ -110,16 +110,16 @@ L2OutputOracleUpgradeable_Test:test_cannotInitImpl() (gas: 15171) ...@@ -110,16 +110,16 @@ L2OutputOracleUpgradeable_Test:test_cannotInitImpl() (gas: 15171)
L2OutputOracleUpgradeable_Test:test_cannotInitProxy() (gas: 20152) L2OutputOracleUpgradeable_Test:test_cannotInitProxy() (gas: 20152)
L2OutputOracleUpgradeable_Test:test_initValuesOnProxy() (gas: 26052) L2OutputOracleUpgradeable_Test:test_initValuesOnProxy() (gas: 26052)
L2OutputOracleUpgradeable_Test:test_upgrading() (gas: 180457) L2OutputOracleUpgradeable_Test:test_upgrading() (gas: 180457)
L2StandardBridge_Test:test_cannotWithdrawEthWithoutSendingIt() (gas: 19621) L2StandardBridge_Test:test_finalizeBridgeETH_incorrectValue_reverts() (gas: 23788)
L2StandardBridge_Test:test_finalizeBridgeETH_incorrectValueReverts() (gas: 23733) L2StandardBridge_Test:test_finalizeBridgeETH_sendToMessenger_reverts() (gas: 23927)
L2StandardBridge_Test:test_finalizeBridgeETH_sendToMessengerReverts() (gas: 23960) L2StandardBridge_Test:test_finalizeBridgeETH_sendToSelf_reverts() (gas: 23838)
L2StandardBridge_Test:test_finalizeBridgeETH_sendToSelfReverts() (gas: 23793) L2StandardBridge_Test:test_finalizeDeposit_succeeds() (gas: 89396)
L2StandardBridge_Test:test_finalizeDeposit() (gas: 89363) L2StandardBridge_Test:test_initialize_succeeds() (gas: 10537)
L2StandardBridge_Test:test_initialize() (gas: 10536) L2StandardBridge_Test:test_receive_succeeds() (gas: 131905)
L2StandardBridge_Test:test_receive() (gas: 131862) L2StandardBridge_Test:test_withdrawTo_succeeds() (gas: 344670)
L2StandardBridge_Test:test_withdraw() (gas: 343984) L2StandardBridge_Test:test_withdraw_insufficientValue_reverts() (gas: 19630)
L2StandardBridge_Test:test_withdrawTo() (gas: 344713) L2StandardBridge_Test:test_withdraw_notEOA_reverts() (gas: 251798)
L2StandardBridge_Test:test_withdraw_onlyEOA() (gas: 251816) L2StandardBridge_Test:test_withdraw_succeeds() (gas: 343975)
L2ToL1MessagePasserTest:test_burn_succeeds() (gas: 112572) L2ToL1MessagePasserTest:test_burn_succeeds() (gas: 112572)
L2ToL1MessagePasserTest:test_initiateWithdrawal_fromContract_succeeds() (gas: 70423) L2ToL1MessagePasserTest:test_initiateWithdrawal_fromContract_succeeds() (gas: 70423)
L2ToL1MessagePasserTest:test_initiateWithdrawal_fromEOA_succeeds() (gas: 75874) L2ToL1MessagePasserTest:test_initiateWithdrawal_fromEOA_succeeds() (gas: 75874)
......
...@@ -21,12 +21,12 @@ contract FeeVault_Test is Bridge_Initializer { ...@@ -21,12 +21,12 @@ contract FeeVault_Test is Bridge_Initializer {
vm.etch(Predeploys.L1_FEE_VAULT, address(new L1FeeVault(recipient)).code); vm.etch(Predeploys.L1_FEE_VAULT, address(new L1FeeVault(recipient)).code);
} }
function test_constructor() external { function test_constructor_succeeds() external {
assertEq(baseFeeVault.RECIPIENT(), recipient); assertEq(baseFeeVault.RECIPIENT(), recipient);
assertEq(l1FeeVault.RECIPIENT(), recipient); assertEq(l1FeeVault.RECIPIENT(), recipient);
} }
function test_minWithdrawalAmount() external { function test_minWithdrawalAmount_succeeds() external {
assertEq(baseFeeVault.MIN_WITHDRAWAL_AMOUNT(), 10 ether); assertEq(baseFeeVault.MIN_WITHDRAWAL_AMOUNT(), 10 ether);
assertEq(l1FeeVault.MIN_WITHDRAWAL_AMOUNT(), 10 ether); assertEq(l1FeeVault.MIN_WITHDRAWAL_AMOUNT(), 10 ether);
} }
......
...@@ -50,31 +50,32 @@ contract GasPriceOracle_Test is CommonTest { ...@@ -50,31 +50,32 @@ contract GasPriceOracle_Test is CommonTest {
}); });
} }
function test_l1BaseFee() external { function test_l1BaseFee_succeeds() external {
assertEq(gasOracle.l1BaseFee(), basefee); assertEq(gasOracle.l1BaseFee(), basefee);
} }
function test_gasPrice() external { function test_gasPrice_succeeds() external {
vm.fee(100); vm.fee(100);
uint256 gasPrice = gasOracle.gasPrice(); uint256 gasPrice = gasOracle.gasPrice();
assertEq(gasPrice, 100); assertEq(gasPrice, 100);
} }
function test_baseFee() external { function test_baseFee_succeeds() external {
vm.fee(64); vm.fee(64);
uint256 gasPrice = gasOracle.baseFee(); uint256 gasPrice = gasOracle.baseFee();
assertEq(gasPrice, 64); assertEq(gasPrice, 64);
} }
function test_scalar() external { function test_scalar_succeeds() external {
assertEq(gasOracle.scalar(), l1FeeScalar); assertEq(gasOracle.scalar(), l1FeeScalar);
} }
function test_overhead() external { function test_overhead_succeeds() external {
assertEq(gasOracle.overhead(), l1FeeOverhead); assertEq(gasOracle.overhead(), l1FeeOverhead);
} }
function test_setGasPriceReverts() external { // Removed in bedrock
function test_setGasPrice_doesNotExist_reverts() external {
(bool success, bytes memory returndata) = address(gasOracle).call( (bool success, bytes memory returndata) = address(gasOracle).call(
abi.encodeWithSignature("setGasPrice(uint256)", 1) abi.encodeWithSignature("setGasPrice(uint256)", 1)
); );
...@@ -83,7 +84,8 @@ contract GasPriceOracle_Test is CommonTest { ...@@ -83,7 +84,8 @@ contract GasPriceOracle_Test is CommonTest {
assertEq(returndata, hex""); assertEq(returndata, hex"");
} }
function test_setL1BaseFeeReverts() external { // Removed in bedrock
function test_setL1BaseFee_doesNotExist_reverts() external {
(bool success, bytes memory returndata) = address(gasOracle).call( (bool success, bytes memory returndata) = address(gasOracle).call(
abi.encodeWithSignature("setL1BaseFee(uint256)", 1) abi.encodeWithSignature("setL1BaseFee(uint256)", 1)
); );
......
...@@ -14,7 +14,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -14,7 +14,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
super.setUp(); super.setUp();
} }
function test_initialize() external { function test_initialize_succeeds() external {
assertEq(address(L2Bridge.messenger()), address(L2Messenger)); assertEq(address(L2Bridge.messenger()), address(L2Messenger));
assertEq(address(L2Bridge.OTHER_BRIDGE()), address(L1Bridge)); assertEq(address(L2Bridge.OTHER_BRIDGE()), address(L1Bridge));
...@@ -22,7 +22,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -22,7 +22,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
// receive // receive
// - can accept ETH // - can accept ETH
function test_receive() external { function test_receive_succeeds() external {
assertEq(address(messagePasser).balance, 0); assertEq(address(messagePasser).balance, 0);
vm.expectEmit(true, true, true, true); vm.expectEmit(true, true, true, true);
...@@ -41,7 +41,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -41,7 +41,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
// withrdraw // withrdraw
// - requires amount == msg.value // - requires amount == msg.value
function test_cannotWithdrawEthWithoutSendingIt() external { function test_withdraw_insufficientValue_reverts() external {
assertEq(address(messagePasser).balance, 0); assertEq(address(messagePasser).balance, 0);
vm.expectRevert("StandardBridge: bridging ETH must include sufficient ETH value"); vm.expectRevert("StandardBridge: bridging ETH must include sufficient ETH value");
...@@ -53,7 +53,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -53,7 +53,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
// - token is burned // - token is burned
// - emits WithdrawalInitiated // - emits WithdrawalInitiated
// - calls Withdrawer.initiateWithdrawal // - calls Withdrawer.initiateWithdrawal
function test_withdraw() external { function test_withdraw_succeeds() external {
// Alice has 100 L2Token // Alice has 100 L2Token
deal(address(L2Token), alice, 100, true); deal(address(L2Token), alice, 100, true);
assertEq(L2Token.balanceOf(alice), 100); assertEq(L2Token.balanceOf(alice), 100);
...@@ -66,7 +66,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -66,7 +66,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
assertEq(L2Token.balanceOf(alice), 0); assertEq(L2Token.balanceOf(alice), 0);
} }
function test_withdraw_onlyEOA() external { function test_withdraw_notEOA_reverts() external {
// This contract has 100 L2Token // This contract has 100 L2Token
deal(address(L2Token), address(this), 100, true); deal(address(L2Token), address(this), 100, true);
...@@ -78,7 +78,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -78,7 +78,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
// - token is burned // - token is burned
// - emits WithdrawalInitiated w/ correct recipient // - emits WithdrawalInitiated w/ correct recipient
// - calls Withdrawer.initiateWithdrawal // - calls Withdrawer.initiateWithdrawal
function test_withdrawTo() external { function test_withdrawTo_succeeds() external {
deal(address(L2Token), alice, 100, true); deal(address(L2Token), alice, 100, true);
vm.prank(alice, alice); vm.prank(alice, alice);
...@@ -93,7 +93,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -93,7 +93,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
// - only callable by l1TokenBridge // - only callable by l1TokenBridge
// - supported token pair emits DepositFinalized // - supported token pair emits DepositFinalized
// - invalid deposit calls Withdrawer.initiateWithdrawal // - invalid deposit calls Withdrawer.initiateWithdrawal
function test_finalizeDeposit() external { function test_finalizeDeposit_succeeds() external {
// TODO: events and calls // TODO: events and calls
vm.mockCall( vm.mockCall(
...@@ -116,7 +116,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -116,7 +116,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
L2Bridge.finalizeDeposit(address(L1Token), address(L2Token), alice, alice, 100, hex""); L2Bridge.finalizeDeposit(address(L1Token), address(L2Token), alice, alice, 100, hex"");
} }
function test_finalizeBridgeETH_incorrectValueReverts() external { function test_finalizeBridgeETH_incorrectValue_reverts() external {
vm.mockCall( vm.mockCall(
address(L2Bridge.messenger()), address(L2Bridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
...@@ -128,7 +128,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -128,7 +128,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
L2Bridge.finalizeBridgeETH{ value: 50 }(alice, alice, 100, hex""); L2Bridge.finalizeBridgeETH{ value: 50 }(alice, alice, 100, hex"");
} }
function test_finalizeBridgeETH_sendToSelfReverts() external { function test_finalizeBridgeETH_sendToSelf_reverts() external {
vm.mockCall( vm.mockCall(
address(L2Bridge.messenger()), address(L2Bridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
...@@ -140,7 +140,7 @@ contract L2StandardBridge_Test is Bridge_Initializer { ...@@ -140,7 +140,7 @@ contract L2StandardBridge_Test is Bridge_Initializer {
L2Bridge.finalizeBridgeETH{ value: 100 }(alice, address(L2Bridge), 100, hex""); L2Bridge.finalizeBridgeETH{ value: 100 }(alice, address(L2Bridge), 100, hex"");
} }
function test_finalizeBridgeETH_sendToMessengerReverts() external { function test_finalizeBridgeETH_sendToMessenger_reverts() external {
vm.mockCall( vm.mockCall(
address(L2Bridge.messenger()), address(L2Bridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector), abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment