From 0e60c225ff7596fbc36549e591760543e5beb354 Mon Sep 17 00:00:00 2001 From: Andrijan Ostrun Date: Fri, 22 Dec 2023 17:30:24 +0100 Subject: [PATCH] Fix initializing existing mailbox with failing gas estimation (#3099) ### Description Add additional check to handle a situation when the transaction fails during the gas estimation phase. ### Backward compatibility Yes ### Testing Manual --- typescript/sdk/src/core/HyperlaneCoreDeployer.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/typescript/sdk/src/core/HyperlaneCoreDeployer.ts b/typescript/sdk/src/core/HyperlaneCoreDeployer.ts index 674c7b61b..6e1226b6f 100644 --- a/typescript/sdk/src/core/HyperlaneCoreDeployer.ts +++ b/typescript/sdk/src/core/HyperlaneCoreDeployer.ts @@ -109,7 +109,10 @@ export class HyperlaneCoreDeployer extends HyperlaneDeployer< if ( !e.message.includes('already initialized') && // Some RPC providers dont return the revert reason (nor allow ethers to parse it), so we have to check the message - !e.message.includes('Reverted 0x08c379a') + !e.message.includes('Reverted 0x08c379a') && + // Handle situation where the gas estimation fails on the call function, + // then the real error reason is not available in `e.message`, but rather in `e.error.reason` + !e.error?.reason?.includes('already initialized') ) { throw e; }