Transaction fails unexpectedly

Hi Team,

I have defender autotask running every 10 mins and have only 1 transaction to execute.
The defender sometimes shows a success message in the console but the transaction would have failed on the blockchain and when I try to invoke a transaction manually right after the failure and it succeeds. Can I know the reason why this happens?
Also, I see we are getting out of gas error in explorer, are you invoking the transaction with higher gas limits with defender autotask?
We tried to debug the issue from our end and it works absolutely fine without any errors.

Sharing a few of the failed transaction links here

Thanks,
Harish Gunjalli

Hi @HarishGunjalli,

I think it would be helpful to get a little more information.

For one, your email would be helpful so we can analyze these specific Defender components. Please send it to: defender-support@openzeppelin.com.

Also was this Relayer run with the sendTransaction API call or was it configured within the Defender console?

Hi @dan_oz ,

Thanks for the reply.
I've mailed the details to the specified mail id.
Also, the relayer was configured within the Defender console as a corn job autotask.

Thanks,
Harish Gunjalli

Hi Harish,

It looks like this autotask is using ethers.js to create a contract and make the function call. Without an explicit gasLimit defined, an estimate is used, but this can have issues, for instance if the function is non-gas deterministic, such as:

function someFunction() public {
  for(uint256 i = 0; i < someInternalState.length; i++){
    ...
  }
}

I'd recommend setting the gasLimit explicitly as an option to the contract method (you could provide 20% more than the estimated gas for instance to be safe).

As far as the transaction that was reverted for a different reason than gas, this would likely pertain to code executed within the contract itself.

Please let us know if you have any other issues.