Hi I have a question about the failure of calling defender

Hi I am using defender as a relayer to call our contract's function. For some reasons, 70% of the transactions sent from relayer fails. 30% succeeds. I am not sure why it happens.
I can say the arguments are alright and contract is fine but maybe something is wrong with my transaction's gas setting up?

It is on Avalanche Fuji.

I am in trouble of doing this.
Could anyone help me manage to do this?

  • What is the best practice about setting up gas and gas limit?
  • Should I set the gas manually?

This is the error:
I've deleted the address in it.

AUTOTASK START
2023-10-05T05:01:53.314Z	INFO	contractAddress: 0xd4ea092F34644885Be7dAFD8d7F428a3AE382FCC
2023-10-05T05:01:53.314Z	INFO	organizerAddress: 0x9ae65c7eC6F0A2201dfd16212D694d0b71499e7f
2023-10-05T05:01:53.333Z	INFO	starting setContest
2023-10-05T05:01:54.165Z	ERROR	Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (error={"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":{"code":3,"data":"0x537f6a15"},"method":"estimateGas","transaction":{"from":"","to":"0xd4ea092F34644885Be7dAFD8d7F428a3AE382FCC","data":"0xccf4f8e50000000000000000000000009ae65c7ec6f0a2201dfd16212d694d0b71499e7f603450b92085fc0393ff161126d6b221edc6d6c58f67841ed209563da5088a820000000000000000000000000000000000000000000000000000000065432d3f0000000000000000000000000feaaeae572c9f392c819ec2ca5736f97fd31e01","accessList":null}}, tx={"data":"0xccf4f8e50000000000000000000000009ae65c7ec6f0a2201dfd16212d694d0b71499e7f603450b92085fc0393ff161126d6b221edc6d6c58f67841ed209563da5088a820000000000000000000000000000000000000000000000000000000065432d3f0000000000000000000000000feaaeae572c9f392c819ec2ca5736f97fd31e01","to":{},"from":"","gasLimit":{},"speed":"fastest"}, code=UNPREDICTABLE_GAS_LIMIT, version=defender-relay-client)
2023-10-05T05:01:54.165Z	ERROR	Error cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (error={"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":{"code":3,"data":"0x537f6a15"},"method":"estimateGas","transaction":{"from":"","to":"0xd4ea092F34644885Be7dAFD8d7F428a3AE382FCC","data":"0xccf4f8e50000000000000000000000009ae65c7ec6f0a2201dfd16212d694d0b71499e7f603450b92085fc0393ff161126d6b221edc6d6c58f67841ed209563da5088a820000000000000000000000000000000000000000000000000000000065432d3f0000000000000000000000000feaaeae572c9f392c819ec2ca5736f97fd31e01","accessList":null}}, tx={"data":"0xccf4f8e50000000000000000000000009ae65c7ec6f0a2201dfd16212d694d0b71499e7f603450b92085fc0393ff161126d6b221edc6d6c58f67841ed209563da5088a820000000000000000000000000000000000000000000000000000000065432d3f0000000000000000000000000feaaeae572c9f392c819ec2ca5736f97fd31e01","to":{},"from":"","gasLimit":{},"speed":"fastest"}, code=UNPREDICTABLE_GAS_LIMIT, version=defender-relay-client)
2023-10-05T05:01:54.166Z	ERROR	Stack: Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (error={"reason":"cannot estimate gas; transaction may fail or may require manual gas limit","code":"UNPREDICTABLE_GAS_LIMIT","error":{"code":3,"data":"0x537f6a15"},"method":"estimateGas","transaction":{"from":"","to":"0xd4ea092F34644885Be7dAFD8d7F428a3AE382FCC","data":"0xccf4f8e50000000000000000000000009ae65c7ec6f0a2201dfd16212d694d0b71499e7f603450b92085fc0393ff161126d6b221edc6d6c58f67841ed209563da5088a820000000000000000000000000000000000000000000000000000000065432d3f0000000000000000000000000feaaeae572c9f392c819ec2ca5736f97fd31e01","accessList":null}}, tx={"data":"0xccf4f8e50000000000000000000000009ae65c7ec6f0a2201dfd16212d694d0b71499e7f603450b92085fc0393ff161126d6b221edc6d6c58f67841ed209563da5088a820000000000000000000000000000000000000000000000000000000065432d3f0000000000000000000000000feaaeae572c9f392c819ec2ca5736f97fd31e01","to":{},"from":"","gasLimit":{},"speed":"fastest"}, code=UNPREDICTABLE_GAS_LIMIT, version=defender-relay-client)
    at Logger.makeError (/opt/nodejs/node_modules/@ethersproject/logger/lib/index.js:233:21)
    at Logger.throwError (/opt/nodejs/node_modules/@ethersproject/logger/lib/index.js:242:20)
    at /opt/nodejs/node_modules/defender-relay-client/lib/ethers/signer.js:152:31
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 3)

I want to call defender on my backend to call a function of my contract but it keeps failing.

:computer: Environment

It is on Avalanche Fuji using defender and writing the code in the CODE section of the defender app.

:memo:Details

This is the gas setting part of the script.

  const provider = new DefenderRelayProvider(event);
  const signer = new DefenderRelaySigner(event, provider, { speed: 'fastest' });

I think I've found the reason why this happened. thanks!