feat: check-deploy multiple specified chains (#4494)

feat: check-deploy multiple specified chains
- resolves
https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/4491
pull/4502/head
Paul Balaji 2 months ago committed by GitHub
parent 5a0d68bdce
commit 739af9a34b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      .changeset/flat-seals-prove.md
  2. 11
      typescript/infra/scripts/check/check-deploy.ts
  3. 32
      typescript/infra/scripts/check/check-utils.ts
  4. 4
      typescript/infra/scripts/check/check-warp-deploy.ts
  5. 4
      typescript/infra/src/govern/HyperlaneAppGovernor.ts
  6. 6
      typescript/infra/src/govern/HyperlaneHaasGovernor.ts
  7. 31
      typescript/sdk/src/deploy/HyperlaneAppChecker.ts

@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---
Support providing multiple chains for checking in HyperlaneAppChecker

@ -10,7 +10,7 @@ async function main() {
context,
environment,
asDeployer,
chain,
chains,
fork,
govern,
warpRouteId,
@ -22,7 +22,7 @@ async function main() {
environment,
asDeployer,
warpRouteId,
chain,
chains,
fork,
govern,
);
@ -32,13 +32,8 @@ async function main() {
if (govern) {
await governor.govern(false, fork);
}
} else if (chain) {
await governor.checkChain(chain);
if (govern) {
await governor.govern(true, chain);
}
} else {
await governor.check();
await governor.check(chains);
if (govern) {
await governor.govern();
}

@ -37,7 +37,7 @@ import {
getArgs as getRootArgs,
getWarpAddresses,
withAsDeployer,
withChain,
withChains,
withContext,
withFork,
withGovern,
@ -50,7 +50,7 @@ import { getHelloWorldApp } from '../helloworld/utils.js';
export function getCheckBaseArgs() {
return withAsDeployer(
withGovern(withChain(withFork(withContext(getRootArgs())))),
withGovern(withChains(withFork(withContext(getRootArgs())))),
);
}
@ -68,7 +68,7 @@ export async function getGovernor(
environment: DeployEnvironment,
asDeployer: boolean,
warpRouteId?: string,
chain?: string,
chains?: string[],
fork?: string,
govern?: boolean,
) {
@ -217,20 +217,24 @@ export async function getGovernor(
multiProvider,
);
// log error and return if foreign deployment chain is specifically checked
if (
(chain && foreignDeployments[chain]) ||
(fork && foreignDeployments[fork])
) {
// log error and return if requesting check on foreign deployment
const nonEvmChains = chains
? chains.filter((c) => foreignDeployments[c])
: fork && foreignDeployments[fork]
? [fork]
: [];
if (nonEvmChains.length > 0) {
const chainList = nonEvmChains.join(', ');
console.log(
`${
chain ?? fork
} is non evm and it not compatible with warp checker tooling`,
`${chainList} ${
nonEvmChains.length > 1 ? 'are' : 'is'
} non-EVM and not compatible with warp checker tooling`,
);
throw Error(
`${
chain ?? fork
} is non evm and it not compatible with warp checker tooling`,
`${chainList} ${
nonEvmChains.length > 1 ? 'are' : 'is'
} non-EVM and not compatible with warp checker tooling`,
);
}

@ -13,7 +13,7 @@ import {
} from './check-utils.js';
async function main() {
const { environment, asDeployer, chain, fork, context, pushMetrics } =
const { environment, asDeployer, chains, fork, context, pushMetrics } =
await getCheckWarpDeployArgs().argv;
const metricsRegister = new Registry();
@ -36,7 +36,7 @@ async function main() {
environment,
asDeployer,
warpRouteId,
chain,
chains,
fork,
);

@ -70,8 +70,8 @@ export abstract class HyperlaneAppGovernor<
}
}
async check() {
await this.checker.check();
async check(chainsToCheck?: ChainName[]) {
await this.checker.check(chainsToCheck);
}
async checkChain(chain: ChainName) {

@ -70,9 +70,9 @@ export class HyperlaneHaasGovernor extends HyperlaneAppGovernor<
}
}
async check() {
await this.icaChecker.check();
await this.coreChecker.check();
async check(chainsToCheck?: ChainName[]) {
await this.icaChecker.check(chainsToCheck);
await this.coreChecker.check(chainsToCheck);
}
async checkChain(chain: ChainName) {

@ -45,26 +45,33 @@ export abstract class HyperlaneAppChecker<
abstract checkChain(chain: ChainName): Promise<void>;
async check(): Promise<void[]> {
const appChains = this.app.chains();
async check(chainsToCheck?: ChainName[]): Promise<void[]> {
// Get all EVM chains from config
const evmChains = Object.keys(this.configMap).filter(
(chain) =>
this.multiProvider.getChainMetadata(chain).protocol ===
ProtocolType.Ethereum,
);
Object.keys(this.configMap)
.filter(
(chain) =>
this.multiProvider.getChainMetadata(chain).protocol ===
ProtocolType.Ethereum && !appChains.includes(chain),
)
.forEach((chain: string) =>
// Mark any EVM chains that are not deployed
const appChains = this.app.chains();
for (const chain of evmChains) {
if (!appChains.includes(chain)) {
this.addViolation({
type: ViolationType.NotDeployed,
chain,
expected: '',
actual: '',
}),
);
});
}
}
// Finally, check the chains that were explicitly requested
// If no chains were requested, check all app chains
const chains =
!chainsToCheck || chainsToCheck.length === 0 ? appChains : chainsToCheck;
return Promise.all(
appChains
chains
.filter(
(chain) =>
this.multiProvider.getChainMetadata(chain).protocol ===

Loading…
Cancel
Save