Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

1.5x the estimated gas when sending a message #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 estimated gas, e.g. with the default public Goerli provider.
gasLimit: estimatedGas.mul(15).div(10),
}
);

await tx.wait();
Expand Down