Last 3 Keeper transactions return out of gas

my relay

last 3 transactions return an out of gas. the logs didn’t display the error my logs. as you can see here.

but when I am running the same code without the while(). I can see the full error message.

it’s look like await don’t wait for the result

while (Date.now() - start < duration) {
      if (await workIfNeeded(contract, job)) return;
      await sleep(duration / 11);
    }
1 Like

Hi @Bolo,

I am sorry you have run into this issue. I have reported to the development team.

Hey @Bolo! As you say, sending a tx like await contract.function(), or even via a regular await signer.sendTransaction({ from, to, ... }) does not wait for the tx to be mined, it just waits for the tx to be signed and sent to the network. Note that this is the behaviour not just for Defender Relayers, but in general when using ethers.js - otherwise, you would be stuck awaiting for the time until the tx gets mined, which could be minutes.

Keep in mind that gas estimation is tricky for contracts with a lot of activity: the amount of gas you're sending may be enough at the time when you're sending the tx, but then the contract state may change, causing more gas to be required by the time your tx gets actually mined, thus leading to the out-of-gas error.

My suggestion would be to add a manual gasLimit to the calls where you see this happening most often, like await contract.function(...params, { gasLimit: GAS_LIMIT }). Remember than unused gas gets returned to you after the tx is mined, so there is (in general) not much harm in setting a gas limit higher than needed.

If you want to read more about trickiness behind gas estimation, this may help: https://gist.github.com/spalladino/a349f0ca53dbb5fc3914243aaf7ea8c6#about-gas

1 Like

make sense. ty a lot

1 Like

2 posts were split to a new topic: How to check if work has been done?