Commit b4727c47 authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: pause tests

parent 1b84f7d1
......@@ -14,6 +14,7 @@ import { Constants } from "src/libraries/Constants.sol";
import { StandardBridge } from "src/universal/StandardBridge.sol";
import { L2StandardBridge } from "src/L2/L2StandardBridge.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { AddressAliasHelper } from "src/vendor/AddressAliasHelper.sol";
// Target contract
......@@ -38,6 +39,31 @@ contract L1StandardBridge_Initialize_Test is Bridge_Initializer {
}
}
contract L1StandardBridge_Pause_Test is Bridge_Initializer {
/// @dev Test that the accessors return the correct initialized values
function test_paused_succeeds() external {
assertEq(l1StandardBridge.paused(), superchainConfig.paused());
}
/// @dev Tests that the superchain config is called by the messengers paused function
function test_pause_callsSuperchainConfig_succeeds() external {
vm.expectCall(address(superchainConfig), abi.encodeWithSelector(SuperchainConfig.paused.selector));
l1StandardBridge.paused();
}
/// @dev Tests that changing the superchain config paused status changes the return value of the bridge.
function test_pause_matchesSuperchainConfig_succeeds() external {
assertFalse(l1StandardBridge.paused());
assertEq(l1StandardBridge.paused(), superchainConfig.paused());
vm.prank(superchainConfig.guardian());
superchainConfig.pause("identifier");
assertTrue(l1StandardBridge.paused());
assertEq(l1StandardBridge.paused(), superchainConfig.paused());
}
}
contract L1StandardBridge_Initialize_TestFail is Bridge_Initializer { }
contract L1StandardBridge_Receive_Test is Bridge_Initializer {
......
......@@ -28,6 +28,12 @@ contract L2StandardBridge_Test is Bridge_Initializer {
assertEq(address(l2StandardBridge.OTHER_BRIDGE()), address(l1StandardBridge));
}
/// @dev Ensures that the L2StandardBridge is always not paused. The pausability
/// happens on L1 and not L2.
function test_paused_succeeds() external {
assertFalse(l2StandardBridge.paused());
}
/// @dev Tests that the bridge receives ETH and successfully initiates a withdrawal.
function test_receive_succeeds() external {
assertEq(address(l2ToL1MessagePasser).balance, 0);
......
......@@ -112,4 +112,9 @@ contract StandardBridge_Stateless_Test is CommonTest {
vm.expectRevert();
bridge.isCorrectTokenPair(address(erc20), address(1));
}
/// @notice The bridge by default should be unpaused.
function test_paused_succeeds() external {
assertFalse(bridge.paused());
}
}
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