Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
83cd4177
Unverified
Commit
83cd4177
authored
Dec 06, 2022
by
mergify[bot]
Committed by
GitHub
Dec 06, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4246 from ethereum-optimism/jm/ctb-test-cleanup/4
Rename L2Standard bridge tests
parents
df6a65de
b62149a0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
38 deletions
+40
-38
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+19
-19
FeeVault.t.sol
packages/contracts-bedrock/contracts/test/FeeVault.t.sol
+2
-2
GasPriceOracle.t.sol
...ges/contracts-bedrock/contracts/test/GasPriceOracle.t.sol
+9
-7
L2StandardBridge.t.sol
...s/contracts-bedrock/contracts/test/L2StandardBridge.t.sol
+10
-10
No files found.
packages/contracts-bedrock/.gas-snapshot
View file @
83cd4177
...
@@ -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: 828
1)
GasPriceOracle_Test:test_baseFee
_succeeds() (gas: 829
1)
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_setGasPrice
Reverts() (gas: 5888
)
GasPriceOracle_Test:test_setGasPrice
_doesNotExist_reverts() (gas: 5910
)
GasPriceOracle_Test:test_setL1BaseFee
Reverts() (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_sendTo
MessengerReverts() (gas: 23960
)
L2StandardBridge_Test:test_finalizeBridgeETH_sendTo
Self_reverts() (gas: 23838
)
L2StandardBridge_Test:test_finalize
BridgeETH_sendToSelfReverts() (gas: 23793
)
L2StandardBridge_Test:test_finalize
Deposit_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_withdraw
To() (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)
...
...
packages/contracts-bedrock/contracts/test/FeeVault.t.sol
View file @
83cd4177
...
@@ -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);
}
}
...
...
packages/contracts-bedrock/contracts/test/GasPriceOracle.t.sol
View file @
83cd4177
...
@@ -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)
);
);
...
...
packages/contracts-bedrock/contracts/test/L2StandardBridge.t.sol
View file @
83cd4177
...
@@ -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_incorrectValue
R
everts() external {
function test_finalizeBridgeETH_incorrectValue
_r
everts() 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_sendToSelf
R
everts() external {
function test_finalizeBridgeETH_sendToSelf
_r
everts() 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_sendToMessenger
R
everts() external {
function test_finalizeBridgeETH_sendToMessenger
_r
everts() external {
vm.mockCall(
vm.mockCall(
address(L2Bridge.messenger()),
address(L2Bridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment