From 05a943b4ad4cf717704162fafe2e3529815ec65f Mon Sep 17 00:00:00 2001 From: J M Rossy Date: Wed, 20 Dec 2023 12:11:23 -0500 Subject: [PATCH] CLI pre-flight check fix (#3089) ### Description Only check origin balances for CLI send commands ### Related issues Fixes https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/3079 ### Backward compatibility Yes ### Testing Tested command locally --- .changeset/witty-jobs-sit.md | 5 +++++ typescript/cli/src/deploy/utils.ts | 14 +++++++++++++- typescript/cli/src/send/message.ts | 1 + typescript/cli/src/send/transfer.ts | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .changeset/witty-jobs-sit.md diff --git a/.changeset/witty-jobs-sit.md b/.changeset/witty-jobs-sit.md new file mode 100644 index 0000000000..f748f0689e --- /dev/null +++ b/.changeset/witty-jobs-sit.md @@ -0,0 +1,5 @@ +--- +'@hyperlane-xyz/cli': patch +--- + +Skip mandatory balance check for remotes in send commands" diff --git a/typescript/cli/src/deploy/utils.ts b/typescript/cli/src/deploy/utils.ts index e239584a4c..477c50d30f 100644 --- a/typescript/cli/src/deploy/utils.ts +++ b/typescript/cli/src/deploy/utils.ts @@ -20,12 +20,14 @@ export async function runPreflightChecks({ signer, multiProvider, minGas, + chainsToGasCheck, }: { origin: ChainName; remotes: ChainName[]; signer: ethers.Signer; multiProvider: MultiProvider; minGas: string; + chainsToGasCheck?: ChainName[]; }) { log('Running pre-flight checks...'); @@ -37,6 +39,7 @@ export async function runPreflightChecks({ signer, multiProvider, minGas, + chainsToGasCheck, }); } @@ -45,11 +48,15 @@ export async function runPreflightChecksForChains({ signer, multiProvider, minGas, + chainsToGasCheck, }: { chains: ChainName[]; signer: ethers.Signer; multiProvider: MultiProvider; minGas: string; + // Chains for which to assert a native balance + // Defaults to all chains if not specified + chainsToGasCheck?: ChainName[]; }) { log('Running pre-flight checks...'); @@ -65,7 +72,12 @@ export async function runPreflightChecksForChains({ assertSigner(signer); logGreen('Signer is valid ✅'); - await assertGasBalances(multiProvider, signer, chains, minGas); + await assertGasBalances( + multiProvider, + signer, + chainsToGasCheck ?? chains, + minGas, + ); logGreen('Balances are sufficient ✅'); } diff --git a/typescript/cli/src/send/message.ts b/typescript/cli/src/send/message.ts index dc0a2f29cd..53051d6c08 100644 --- a/typescript/cli/src/send/message.ts +++ b/typescript/cli/src/send/message.ts @@ -60,6 +60,7 @@ export async function sendTestMessage({ multiProvider, signer, minGas: MINIMUM_TEST_SEND_GAS, + chainsToGasCheck: [origin], }); await timeout( diff --git a/typescript/cli/src/send/transfer.ts b/typescript/cli/src/send/transfer.ts index b1a54a5cfb..10a03e47c3 100644 --- a/typescript/cli/src/send/transfer.ts +++ b/typescript/cli/src/send/transfer.ts @@ -97,6 +97,7 @@ export async function sendTestTransfer({ multiProvider, signer, minGas: MINIMUM_TEST_SEND_GAS, + chainsToGasCheck: [origin], }); await timeout(