Fix initializing existing mailbox with failing gas estimation #3099
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I had an issue with the
hyperlane deploy core
script and it was caused by trying to initialize the existing mailbox contract. The deploy script already has an error handling for that specific reason, but it doesn't work if the call fails during the dry run when estimating gas. In that case, the returned error looks like this:Here we can see that the real error reason for the error is nested in
e.error.reason
, but the current error handling for calling initialize on an already initialized mailbox contract only handles situations where the error reason is included ine.message
which is not available when the transaction fails during the gas estimation phase.hyperlane-monorepo/typescript/sdk/src/core/HyperlaneCoreDeployer.ts
Lines 108 to 117 in 2b49baa
Drive-by changes
Add additional check to handle a situation when the transaction fails during the gas estimation phase:
Related issues
No related issue, I discovered the issue during my unsuccessful tries of invoking the core deployment script.
Backward compatibility
Yes
Testing
Manual