Skip to content

Commit

Permalink
Check Mailbox, IGP, and ISM in HyperlaneRouterChecker (#1490)
Browse files Browse the repository at this point in the history
  • Loading branch information
asaj authored Jan 3, 2023
1 parent a79cb50 commit 5bf7d0d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions typescript/sdk/src/deploy/router/HyperlaneRouterChecker.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ethers } from 'ethers';

import { Ownable } from '@hyperlane-xyz/core';
import { utils } from '@hyperlane-xyz/utils';

Expand All @@ -22,10 +24,25 @@ export class HyperlaneRouterChecker<
}

async checkChain(chain: Chain): Promise<void> {
await this.checkHyperlaneConnectionClient(chain);
await this.checkEnrolledRouters(chain);
await this.checkOwnership(chain);
}

async checkHyperlaneConnectionClient(chain: Chain): Promise<void> {
const router = this.app.getContracts(chain).router;
const mailbox = await router.mailbox();
const igp = await router.interchainGasPaymaster();
const ism = await router.interchainSecurityModule();
utils.assert(mailbox, this.configMap[chain].mailbox);
utils.assert(igp, this.configMap[chain].interchainGasPaymaster);
utils.assert(
ism,
this.configMap[chain].interchainSecurityModule ||
ethers.constants.AddressZero,
);
}

async checkEnrolledRouters(chain: Chain): Promise<void> {
const router = this.app.getContracts(chain).router;

Expand Down

2 comments on commit 5bf7d0d

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forge Coverage Report

Coverage for this commit
14.60% 0.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
../node_modules/@openzeppelin/contracts-upgradeable/access
   OwnableUpgradeable.sol61.90%50%57.14%70%30, 34, 56, 67, 75
../node_modules/@openzeppelin/contracts-upgradeable/proxy/utils
   Initializable.sol0%0%0%0%145, 145, 145–146, 146, 146–148, 156, 163
../node_modules/@openzeppelin/contracts-upgradeable/token/ERC20
   ERC20Upgradeable.sol66%54.55%55%74.14%100, 187–189, 207–209, 209, 209, 211, 214, 236–237, 242, 265, 291, 296, 326–327, 56, 60–61, 68, 76, 93
../node_modules/@openzeppelin/contracts-upgradeable/utils
   AddressUpgradeable.sol0%0%0%0%100, 119, 134, 134, 134–136, 146, 160–161, 176, 176, 176–177, 177, 177, 180, 180, 180, 182, 184, 199, 199, 199–200, 202, 208, 208, 208, 216, 41, 61, 61, 61, 63–64, 64, 64, 86
   ContextUpgradeable.sol33.33%100%25%50%28
../node_modules/@openzeppelin/contracts/access
   Ownable.sol0%0%0%0%44, 51, 51, 51, 62, 70, 70, 70–71, 79–81
../node_modules/@openzeppelin/contracts/proxy
   Proxy.sol0%100%0%0%59–60, 68
../node_modules/@openzeppelin/contracts/proxy/ERC1967
   ERC1967Proxy.sol0%100%0%0%30
   ERC1967Upgrade.sol0%0%0%0%117, 124, 124, 124–125, 134–135, 153, 160, 160, 160–161, 161, 161, 165, 179–181, 181, 181–182, 39, 46, 46, 46–47, 56–57, 70–71, 71, 71–72, 89, 89, 89–90, 92, 97
../node_modules/@openzeppelin/contracts/proxy/transparent
   ProxyAdmin.sol0%0%0%0%24–25, 25, 25–26, 39–40, 40, 40–41, 52, 63, 79
   TransparentUpgradeableProxy.sol0%0%0%0%107, 114, 121, 121, 121–122, 63, 76, 87, 96
../node_modules/@openzeppelin/contracts/utils
   Address.sol0%0%0%0%100, 119, 134, 134, 134–136, 146, 160–161, 171, 185–186, 201, 201, 201–202, 202, 202, 205, 205, 205, 207, 209, 224, 224, 224–225, 227, 233, 233, 233, 241, 41, 61, 61, 61, 63–64, 64, 64, 86
   Context.sol0%100%0%0%18, 22
   Create2.sol0%0%0%0%35, 35, 35–36, 36, 36, 39, 41, 41, 41, 49, 80
   StorageSlot.sol0%100%0%0%55, 65, 75, 85
   Strings.sol0%0%0%0%20–22, 25, 28, 33–34, 34, 34, 36, 45, 53–58, 60, 60, 60–61, 68
../node_modules/@openzeppelin/contracts/utils/cryptography
   ECDSA.sol0%0%0%0%106–108, 121–123, 147, 147, 147–148, 152–153, 153, 153–154, 157, 170–172, 186, 198, 211, 24, 24, 24–26, 26, 26–28, 28, 28–30, 30, 30–31, 56, 56, 56–59, 64–66, 68, 70, 89–91
../node_modules/@openzeppelin/contracts/utils/math
   Math.sol0%0%0%0%102, 105, 108, 112, 117, 121–126, 132–133, 146–147, 147, 147–148, 150, 159, 159, 159–160, 173, 180–187, 196–197, 20, 206, 208, 208, 208–210, 212, 212, 212–214, 216, 216, 216–218, 220, 220, 220–222, 224, 224, 224–226, 228, 228, 228–230, 232, 232, 232–234, 236, 236, 236–237, 240, 249–250, 259, 261, 261, 261–263, 265, 265, 265–267, 269, 269, 269, 27, 270–271, 273, 273, 273–275, 277, 277, 277–279, 281, 281, 281–283, 285, 285, 285–286, 289, 298–299, 310, 312, 312, 312–314, 316, 316, 316–318, 320, 320, 320–322, 324, 324, 324–326, 328, 328, 328–329, 332,

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardhat Coverage Report

Coverage for this commit
57.85% 0.00%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
solidity/contracts
   Call.sol100%100%100%100%
   Create2Factory.sol0%0%0%0%101, 110, 110, 110, 112, 33, 58, 64–65, 65, 65, 77–78, 98, 98, 98
   HyperlaneConnectionClient.sol64.71%75%63.64%63.16%119, 151–152, 58, 76–77, 85–86
   InterchainGasPaymaster.sol92.31%50%100%100%72
   Mailbox.sol97.06%100%92.31%97.56%232
   OwnableMulticall.sol0%0%0%0%15, 19, 23–24, 27, 27, 27–28, 39–41, 44, 44, 44–45, 51–53, 53, 53–54
   PausableReentrancyGuard.sol95.65%83.33%100%100%30
   Router.sol89.80%87.50%85.71%92.59%111, 53, 64
solidity/contracts/isms
   MultisigIsm.sol97.12%86.36%100%100%102, 155, 263
solidity/contracts/libs
   EnumerableMapExtended.sol53.33%100%57.14%50%45, 61, 69–70
   Merkle.sol97.14%87.50%100%98.25%30, 44
   Message.sol90.91%100%90.91%90.91%109
   MinimalProxy.sol0%100%0%0%14
   MultisigIsmMetadata.sol92.31%100%90.91%93.33%152
   TypeCasts.sol44.44%100%66.67%33.33%11–13, 17
solidity/contracts/middleware
   InterchainAccountRouter.sol0%0%0%0%101–103, 117, 130–132, 132, 132–136, 138, 152, 165, 178, 182, 39, 41–42, 57, 74, 86
   InterchainQueryRouter.sol0%0%0%0%100–103, 117–121, 134, 134, 134, 138, 142, 155–156, 156, 156–157, 163–164, 168–169, 169–170, 174–175, 65, 82, 99
solidity/contracts/middleware/liquidity-layer
   LiquidityLayerRouter.sol0%0%0%0%111, 116, 124, 137–138, 146, 148, 148, 148, 28, 40, 51, 56, 56, 56, 64, 72, 82, 99
solidity/contracts/middleware/liquidity-layer/adapters
   CircleBridgeAdapter.sol0%0%0%0%100, 100, 100, 107, 107, 107, 112, 119–120, 131, 135, 141–142, 142, 142, 147–148, 148, 148, 157, 157, 157, 159, 169, 176, 178, 185, 185, 185, 191–192, 192, 192, 194–195, 195, 195, 200–201, 203, 211–212, 212, 212, 214–215, 215, 215, 221–222, 224, 240, 58, 58, 58–59, 75, 77–78, 81, 90–91, 91, 91, 96, 99
solidity/contracts/middleware/liquidity-layer/interfaces
   ILiquidityLayerAdapter.sol100%100%100%100%
solidity/contracts/middleware/liquidity-layer/interfaces/circle
   ICircleBridge.sol100%100%100%100%
   ICircleMessageTransmitter.sol100%100%100%100%
solidity/contracts/mock
   MockCircleBridge.sol0%0%0%0%12, 21–23, 23, 23–25, 35–36
   MockCircleMessageTransmitter.sol0%100%0%0%12, 20, 28, 36–37, 41
   MockHyperlaneEnvironment.sol0%100%0%0%21–22, 24–25, 27–28, 30–31, 33–34, 36–37, 39–40, 42, 47, 53, 57, 62–63, 67, 71
   MockMailbox.sol94.74%50%100%100%41
   MockToken.sol0%100%0%0%12, 8
solidity/contracts/upgrade
   ProxyAdmin.sol100%100%100%100%
   TransparentUpgradeableProxy.sol100%100%100%100%
   Versioned.sol100%100%100%100%

Please sign in to comment.