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
7bf66c06
Unverified
Commit
7bf66c06
authored
Dec 01, 2023
by
Mark Tyneway
Committed by
Maurelian
Dec 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: tests
parent
22649472
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
L1ERC721Bridge.t.sol
packages/contracts-bedrock/test/L1/L1ERC721Bridge.t.sol
+62
-0
L2ERC721Bridge.t.sol
packages/contracts-bedrock/test/L2/L2ERC721Bridge.t.sol
+6
-0
No files found.
packages/contracts-bedrock/test/L1/L1ERC721Bridge.t.sol
View file @
7bf66c06
...
...
@@ -8,6 +8,8 @@ import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
// Target contract dependencies
import { L2ERC721Bridge } from "src/L2/L2ERC721Bridge.sol";
import { Predeploys } from "src/libraries/Predeploys.sol";
import { SuperchainConfig } from "src/L1/SuperchainConfig.sol";
import { CrossDomainMessenger } from "src/universal/CrossDomainMessenger.sol";
// Target contract
import { L1ERC721Bridge } from "src/L1/L1ERC721Bridge.sol";
...
...
@@ -65,6 +67,7 @@ contract L1ERC721Bridge_Test is Bridge_Initializer {
assertEq(address(l1ERC721Bridge.OTHER_BRIDGE()), Predeploys.L2_ERC721_BRIDGE);
assertEq(address(l1ERC721Bridge.messenger()), address(l1CrossDomainMessenger));
assertEq(address(l1ERC721Bridge.otherBridge()), Predeploys.L2_ERC721_BRIDGE);
assertEq(address(l1ERC721Bridge.superchainConfig()), address(superchainConfig));
}
/// @dev Tests that the ERC721 can be bridged successfully.
...
...
@@ -295,3 +298,62 @@ contract L1ERC721Bridge_Test is Bridge_Initializer {
l1ERC721Bridge.finalizeBridgeERC721(address(localToken), address(remoteToken), alice, alice, tokenId, hex"5678");
}
}
contract L1ERC721Bridge_Pause_Test is Bridge_Initializer {
/// @dev Verifies that the `paused` accessor returns the same value as the `paused` function of the
/// `superchainConfig`.
function test_paused_succeeds() external {
assertEq(l1ERC721Bridge.paused(), superchainConfig.paused());
}
/// @dev Ensures that the `paused` function of the bridge contract actually calls the `paused` function of the
/// `superchainConfig`.
function test_pause_callsSuperchainConfig_succeeds() external {
vm.expectCall(address(superchainConfig), abi.encodeWithSelector(SuperchainConfig.paused.selector));
l1ERC721Bridge.paused();
}
/// @dev Checks that the `paused` state of the bridge matches the `paused` state of the `superchainConfig` after
/// it's been changed.
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 L1ERC721Bridge_Pause_TestFail is Bridge_Initializer {
/// @dev Sets up the test by pausing the bridge, giving ether to the bridge and mocking
/// the calls to the xDomainMessageSender so that it returns the correct value.
function setUp() public override {
super.setUp();
vm.prank(superchainConfig.guardian());
superchainConfig.pause("identifier");
assertTrue(l1ERC721Bridge.paused());
vm.mockCall(
address(l1ERC721Bridge.messenger()),
abi.encodeWithSelector(CrossDomainMessenger.xDomainMessageSender.selector),
abi.encode(address(l1ERC721Bridge.otherBridge()))
);
}
// @dev Ensures that the `bridgeERC721` function reverts when the bridge is paused.
function test_pause_finalizeBridgeERC721_reverts() external {
vm.prank(address(l1ERC721Bridge.messenger()));
vm.expectRevert("L1ERC721Bridge: paused");
l1ERC721Bridge.finalizeBridgeERC721({
_localToken: address(0),
_remoteToken: address(0),
_from: address(0),
_to: address(0),
_tokenId: 0,
_extraData: hex""
});
}
}
packages/contracts-bedrock/test/L2/L2ERC721Bridge.t.sol
View file @
7bf66c06
...
...
@@ -79,6 +79,12 @@ contract L2ERC721Bridge_Test is Bridge_Initializer {
assertEq(address(l2ERC721Bridge.otherBridge()), address(l1ERC721Bridge));
}
/// @dev Ensures that the L2ERC721Bridge is always not paused. The pausability
/// happens on L1 and not L2.
function test_paused_succeeds() external {
assertFalse(l2ERC721Bridge.paused());
}
/// @dev Tests that `bridgeERC721` correctly bridges a token and
/// burns it on the origin chain.
function test_bridgeERC721_succeeds() public {
...
...
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