fix: add 10% gas bump to initialize call in EvmModuleDeployer (#4470)

fix: add 10% gas bump to initialize call in EvmModuleDeployer

---------

Signed-off-by: pbio <10051819+paulbalaji@users.noreply.github.com>
pull/4475/head
Paul Balaji 2 months ago committed by GitHub
parent b94a74534d
commit 518a1bef91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      .changeset/curvy-ligers-drive.md
  2. 12
      typescript/sdk/src/deploy/EvmModuleDeployer.ts

@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': patch
---
add 10% gas bump to initialize call in EvmModuleDeployer

@ -69,8 +69,18 @@ export class EvmModuleDeployer<Factories extends HyperlaneFactories> {
if (initializeArgs) {
this.logger.debug(`Initialize ${contractName} on ${chain}`);
// Estimate gas for the initialize transaction
const estimatedGas = await contract.estimateGas.initialize(
...initializeArgs,
);
// deploy with 10% buffer on gas limit
const overrides = this.multiProvider.getTransactionOverrides(chain);
const initTx = await contract.initialize(...initializeArgs, overrides);
const initTx = await contract.initialize(...initializeArgs, {
gasLimit: estimatedGas.add(estimatedGas.div(10)),
...overrides,
});
await this.multiProvider.handleTx(chain, initTx);
}

Loading…
Cancel
Save