forked from axieinfinity/ronin-dpos-contracts
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(BridgeManager): add configs test
- Loading branch information
1 parent
85409af
commit cc7177d
Showing
4 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
test/bridge/integration/bridge-manager/set-config/setConfig.MainchainManager.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import "../BridgeManager_IntegrationTest.t.sol"; | ||
|
||
contract SetConfig_MainchainManager_Test is Bridge_Integration_Test { | ||
function setUp() public virtual override { | ||
super.setUp(); | ||
} | ||
|
||
function test_configBridgeContractCorrectly() external { | ||
address bridgeContract = _mainchainBridgeManager.getContract(ContractType.BRIDGE); | ||
assertEq(bridgeContract, address(_bridgeContract)); | ||
} | ||
|
||
function test_configBridgeOperatorsCorrectly() external { | ||
address[] memory bridgeOperators = _mainchainBridgeManager.getBridgeOperators(); | ||
|
||
for (uint256 i; i < bridgeOperators.length; i++) { | ||
assertEq(bridgeOperators[i], _operators[i].addr); | ||
} | ||
} | ||
|
||
function test_configTargetsCorrectly() external { | ||
GlobalProposal.TargetOption[] memory targets = new GlobalProposal.TargetOption[](5); | ||
targets[0] = GlobalProposal.TargetOption.BridgeManager; | ||
targets[1] = GlobalProposal.TargetOption.GatewayContract; | ||
targets[2] = GlobalProposal.TargetOption.BridgeSlash; | ||
targets[3] = GlobalProposal.TargetOption.BridgeReward; | ||
targets[4] = GlobalProposal.TargetOption.BridgeTracking; | ||
|
||
address[] memory results = _mainchainBridgeManager.resolveTargets(targets); | ||
|
||
assertEq(results[0], address(_mainchainBridgeManager)); | ||
assertEq(results[1], address(_bridgeContract)); | ||
assertEq(results[2], address(DEFAULT_ADDRESS)); | ||
assertEq(results[3], address(DEFAULT_ADDRESS)); | ||
assertEq(results[4], address(DEFAULT_ADDRESS)); | ||
} | ||
} |
24 changes: 21 additions & 3 deletions
24
test/bridge/integration/bridge-manager/set-config/setConfig.RoninBridgeManager.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,40 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.19; | ||
|
||
import "../BridgeManager_IntergrationTest.t.sol"; | ||
import "../BridgeManager_IntegrationTest.t.sol"; | ||
|
||
contract SetConfig_RoninBridgeManager_Test is Bridge_Integration_Test { | ||
function setUp() public virtual override { | ||
super.setUp(); | ||
} | ||
|
||
function test_setBridgeContract() external { | ||
function test_configBridgeContractCorrectly() external { | ||
address bridgeContract = _roninBridgeManager.getContract(ContractType.BRIDGE); | ||
assertEq(bridgeContract, address(_bridgeContract)); | ||
} | ||
|
||
function test_setBridgeOperatorsContract() external { | ||
function test_configBridgeOperatorsCorrectly() external { | ||
address[] memory bridgeOperators = _roninBridgeManager.getBridgeOperators(); | ||
|
||
for (uint256 i; i < bridgeOperators.length; i++) { | ||
assertEq(bridgeOperators[i], _operators[i].addr); | ||
} | ||
} | ||
|
||
function test_configTargetsCorrectly() external { | ||
GlobalProposal.TargetOption[] memory targets = new GlobalProposal.TargetOption[](5); | ||
targets[0] = GlobalProposal.TargetOption.BridgeManager; | ||
targets[1] = GlobalProposal.TargetOption.GatewayContract; | ||
targets[2] = GlobalProposal.TargetOption.BridgeSlash; | ||
targets[3] = GlobalProposal.TargetOption.BridgeReward; | ||
targets[4] = GlobalProposal.TargetOption.BridgeTracking; | ||
|
||
address[] memory results = _roninBridgeManager.resolveTargets(targets); | ||
|
||
assertEq(results[0], address(_roninBridgeManager)); | ||
assertEq(results[1], address(_bridgeContract)); | ||
assertEq(results[2], address(_bridgeSlash)); | ||
assertEq(results[3], address(_bridgeReward)); | ||
assertEq(results[4], address(_bridgeTracking)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters