From 77df0b63a24c7d0fe7e1c093d8d2202d25e57d73 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Mon, 12 Dec 2022 11:45:34 +0000 Subject: [PATCH 1/2] 1.5x the estimated gas --- hardhat.config.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 719d829..89d87ba 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -25,7 +25,7 @@ const hyperlaneCoreAddresses = HyperlaneCoreAddresses as Record; // passphrase: "", // } // ... or a direct private key -const accounts = ["YOUR PRIVATE KEY"]; +const accounts = ["901ea2e6e326628f82740869bebcb38b7d60349bcba1840763c01e9198af4678"]; const config: HardhatUserConfig = { solidity: "0.8.17", @@ -85,10 +85,24 @@ task("send-message", "sends a message") `Sending message "${taskArgs.message}" from ${hre.network.name} to ${taskArgs.remote}` ); + const recipientBytes32 = utils.addressToBytes32(recipient); + const messageBody = hre.ethers.utils.arrayify(hre.ethers.utils.toUtf8Bytes(taskArgs.message)); + + const estimatedGas = await outbox.estimateGas.dispatch( + remoteDomain, + recipientBytes32, + messageBody, + ); + const tx = await outbox.dispatch( remoteDomain, - utils.addressToBytes32(recipient), - hre.ethers.utils.arrayify(hre.ethers.utils.toUtf8Bytes(taskArgs.message)) + recipientBytes32, + messageBody, + { + // Increase the gas limit by 1.5x - there has been some inconsistency + // in Goerli estimated gas. + gasLimit: estimatedGas.mul(15).div(10), + } ); await tx.wait(); From f4beb8d4af1b39ed59a942dcbe6ee54c4b1056e5 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Mon, 12 Dec 2022 11:50:03 +0000 Subject: [PATCH 2/2] Better comment --- hardhat.config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index 89d87ba..1b8e21e 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -25,7 +25,7 @@ const hyperlaneCoreAddresses = HyperlaneCoreAddresses as Record; // passphrase: "", // } // ... or a direct private key -const accounts = ["901ea2e6e326628f82740869bebcb38b7d60349bcba1840763c01e9198af4678"]; +const accounts = ["YOUR PRIVATE KEY"]; const config: HardhatUserConfig = { solidity: "0.8.17", @@ -100,7 +100,7 @@ task("send-message", "sends a message") messageBody, { // Increase the gas limit by 1.5x - there has been some inconsistency - // in Goerli estimated gas. + // in estimated gas, e.g. with the default public Goerli provider. gasLimit: estimatedGas.mul(15).div(10), } );