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
7627d320
Commit
7627d320
authored
Nov 30, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: test coverage for paused functionality
Only impacts deposits
parent
a145d31b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
0 deletions
+94
-0
StandardBridge.sol
packages/contracts-bedrock/src/universal/StandardBridge.sol
+3
-0
L1StandardBridge.t.sol
packages/contracts-bedrock/test/L1/L1StandardBridge.t.sol
+91
-0
No files found.
packages/contracts-bedrock/src/universal/StandardBridge.sol
View file @
7627d320
...
...
@@ -301,6 +301,7 @@ abstract contract StandardBridge is Initializable {
)
internal
{
require(paused() == false, "StandardBridge: paused");
require(msg.value == _amount, "StandardBridge: bridging ETH must include sufficient ETH value");
// Emit the correct events. By default this will be _amount, but child
...
...
@@ -334,6 +335,8 @@ abstract contract StandardBridge is Initializable {
)
internal
{
require(paused() == false, "StandardBridge: paused");
if (_isOptimismMintableERC20(_localToken)) {
require(
_isCorrectTokenPair(_localToken, _remoteToken),
...
...
packages/contracts-bedrock/test/L1/L1StandardBridge.t.sol
View file @
7627d320
...
...
@@ -62,6 +62,97 @@ contract L1StandardBridge_Pause_Test is Bridge_Initializer {
assertTrue(l1StandardBridge.paused());
assertEq(l1StandardBridge.paused(), superchainConfig.paused());
}
}
contract L1StandardBridge_Pause_TestFail is Bridge_Initializer {
function setUp() public override {
super.setUp();
vm.prank(superchainConfig.guardian());
superchainConfig.pause("identifier");
assertTrue(l1StandardBridge.paused());
}
function test_pause_bridgeETH_reverts() external {
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.bridgeETH({ _minGasLimit: 0, _extraData: hex"" });
}
function test_pause_bridgeETHTo_reverts() external {
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.bridgeETHTo({ _to: address(1), _minGasLimit: 0, _extraData: hex"" });
}
function test_pause_depositETH_reverts() external {
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.depositETH({ _minGasLimit: 0, _extraData: hex"" });
}
function test_pause_depositETHTo_reverts() external {
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.depositETHTo({ _to: address(1), _minGasLimit: 0, _extraData: hex"" });
}
function test_pause_fallback_reverts() external {
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
(bool success,) = address(l1StandardBridge).call{ value: 1 ether }(hex"");
assertTrue(success);
}
function test_pause_bridgeERC20_reverts() external {
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.bridgeERC20({
_localToken: address(1),
_remoteToken: address(2),
_amount: 0,
_minGasLimit: 0,
_extraData: hex""
});
}
function test_pause_bridgeERC20To_reverts() external {
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.bridgeERC20To({
_localToken: address(1),
_remoteToken: address(2),
_to: address(3),
_amount: 0,
_minGasLimit: 0,
_extraData: hex""
});
}
function test_pause_depositERC20_reverts() external {
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.depositERC20({
_l1Token: address(1),
_l2Token: address(2),
_amount: 0,
_minGasLimit: 0,
_extraData: hex""
});
}
function test_pause_depositERC20To_reverts() external {
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.depositERC20To({
_l1Token: address(1),
_l2Token: address(2),
_to: address(3),
_amount: 0,
_minGasLimit: 0,
_extraData: hex""
});
}
}
contract L1StandardBridge_Initialize_TestFail is Bridge_Initializer { }
...
...
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