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
32e59853
Commit
32e59853
authored
Nov 30, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: standard bridge pausable withdrawals
parent
65821936
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
59 deletions
+33
-59
StandardBridge.sol
packages/contracts-bedrock/src/universal/StandardBridge.sol
+2
-3
L1StandardBridge.t.sol
packages/contracts-bedrock/test/L1/L1StandardBridge.t.sol
+31
-56
No files found.
packages/contracts-bedrock/src/universal/StandardBridge.sol
View file @
32e59853
...
@@ -234,6 +234,7 @@ abstract contract StandardBridge is Initializable {
...
@@ -234,6 +234,7 @@ abstract contract StandardBridge is Initializable {
payable
payable
onlyOtherBridge
onlyOtherBridge
{
{
require(paused() == false, "StandardBridge: paused");
require(msg.value == _amount, "StandardBridge: amount sent does not match amount required");
require(msg.value == _amount, "StandardBridge: amount sent does not match amount required");
require(_to != address(this), "StandardBridge: cannot send to self");
require(_to != address(this), "StandardBridge: cannot send to self");
require(_to != address(MESSENGER), "StandardBridge: cannot send to messenger");
require(_to != address(MESSENGER), "StandardBridge: cannot send to messenger");
...
@@ -267,6 +268,7 @@ abstract contract StandardBridge is Initializable {
...
@@ -267,6 +268,7 @@ abstract contract StandardBridge is Initializable {
public
public
onlyOtherBridge
onlyOtherBridge
{
{
require(paused() == false, "StandardBridge: paused");
if (_isOptimismMintableERC20(_localToken)) {
if (_isOptimismMintableERC20(_localToken)) {
require(
require(
_isCorrectTokenPair(_localToken, _remoteToken),
_isCorrectTokenPair(_localToken, _remoteToken),
...
@@ -301,7 +303,6 @@ abstract contract StandardBridge is Initializable {
...
@@ -301,7 +303,6 @@ abstract contract StandardBridge is Initializable {
)
)
internal
internal
{
{
require(paused() == false, "StandardBridge: paused");
require(msg.value == _amount, "StandardBridge: bridging ETH must include sufficient ETH value");
require(msg.value == _amount, "StandardBridge: bridging ETH must include sufficient ETH value");
// Emit the correct events. By default this will be _amount, but child
// Emit the correct events. By default this will be _amount, but child
...
@@ -335,8 +336,6 @@ abstract contract StandardBridge is Initializable {
...
@@ -335,8 +336,6 @@ abstract contract StandardBridge is Initializable {
)
)
internal
internal
{
{
require(paused() == false, "StandardBridge: paused");
if (_isOptimismMintableERC20(_localToken)) {
if (_isOptimismMintableERC20(_localToken)) {
require(
require(
_isCorrectTokenPair(_localToken, _remoteToken),
_isCorrectTokenPair(_localToken, _remoteToken),
...
...
packages/contracts-bedrock/test/L1/L1StandardBridge.t.sol
View file @
32e59853
...
@@ -71,85 +71,60 @@ contract L1StandardBridge_Pause_TestFail is Bridge_Initializer {
...
@@ -71,85 +71,60 @@ contract L1StandardBridge_Pause_TestFail is Bridge_Initializer {
vm.prank(superchainConfig.guardian());
vm.prank(superchainConfig.guardian());
superchainConfig.pause("identifier");
superchainConfig.pause("identifier");
assertTrue(l1StandardBridge.paused());
assertTrue(l1StandardBridge.paused());
}
function test_pause_bridgeETH_reverts() external {
vm.deal(address(l1StandardBridge.messenger()), 1 ether);
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.bridgeETH({ _minGasLimit: 0, _extraData: hex"" });
}
function test_pause_bridgeETHTo_reverts() external {
vm.mockCall(
vm.expectRevert("StandardBridge: paused");
address(l1StandardBridge.messenger()),
vm.prank(alice, alice);
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
l1StandardBridge.bridgeETHTo({ _to: address(1), _minGasLimit: 0, _extraData: hex"" });
abi.encode(address(l1StandardBridge.otherBridge()))
}
);
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 {
function test_pause_finalizeBridgeETH_reverts() external {
vm.prank(address(l1StandardBridge.messenger()));
vm.expectRevert("StandardBridge: paused");
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.finalizeBridgeETH{ value: 100 }({
l1StandardBridge.bridgeERC20({
_from: address(2),
_localToken: address(1),
_to: address(3),
_remoteToken: address(2),
_amount: 100,
_amount: 0,
_minGasLimit: 0,
_extraData: hex""
_extraData: hex""
});
});
}
}
function test_pause_bridgeERC20To_reverts() external {
function test_pause_finalizeETHWithdrawal_reverts() external {
vm.prank(address(l1StandardBridge.messenger()));
vm.expectRevert("StandardBridge: paused");
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.finalizeETHWithdrawal{ value: 100 }({
l1StandardBridge.bridgeERC20To({
_from: address(2),
_localToken: address(1),
_remoteToken: address(2),
_to: address(3),
_to: address(3),
_amount: 0,
_amount: 100,
_minGasLimit: 0,
_extraData: hex""
_extraData: hex""
});
});
}
}
function test_pause_depositERC20_reverts() external {
function test_pause_finalizeERC20Withdrawal_reverts() external {
vm.prank(address(l1StandardBridge.messenger()));
vm.expectRevert("StandardBridge: paused");
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.finalizeERC20Withdrawal({
l1StandardBridge.depositERC20({
_l1Token: address(0),
_l1Token: address(1),
_l2Token: address(0),
_l2Token: address(2),
_from: address(0),
_to: address(0),
_amount: 0,
_amount: 0,
_minGasLimit: 0,
_extraData: hex""
_extraData: hex""
});
});
}
}
function test_pause_depositERC20To_reverts() external {
function test_pause_finalizeBridgeERC20_reverts() external {
vm.prank(address(l1StandardBridge.messenger()));
vm.expectRevert("StandardBridge: paused");
vm.expectRevert("StandardBridge: paused");
vm.prank(alice, alice);
l1StandardBridge.finalizeBridgeERC20({
l1StandardBridge.depositERC20To({
_localToken: address(0),
_
l1Token: address(1
),
_
remoteToken: address(0
),
_
l2Token: address(2
),
_
from: address(0
),
_to: address(
3
),
_to: address(
0
),
_amount: 0,
_amount: 0,
_minGasLimit: 0,
_extraData: hex""
_extraData: hex""
});
});
}
}
...
...
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