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
pull/3100/head
Andrijan Ostrun 11 months ago committed by GitHub
parent 2b49baab02
commit 0e60c225ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      typescript/sdk/src/core/HyperlaneCoreDeployer.ts

@ -109,7 +109,10 @@ export class HyperlaneCoreDeployer extends HyperlaneDeployer<
if ( if (
!e.message.includes('already initialized') && !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 // 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; throw e;
} }

Loading…
Cancel
Save