Defender error

Am facing error in autotask while trying meta txns with relayer

I am trying to use test meta txns with defender, I configured auto task and relayer in defender and gave those API keys in front end app, am not getting any error in the front end txn is submitted, but getting error in autotask. The error is as below,

{“errorType”:“Error”,“errorMessage”:“VM execution error.”,“code”:-32015,“data”:“Reverted 0x”,“stack”:[“Error: VM execution error.”," at DefenderRelayProvider.send (/opt/nodejs/node_modules/defender-relay-client/lib/ethers/provider.js:58:31)"," at processTicksAndRejections (internal/process/task_queues.js:97:5)"]}
END RequestId

:computer: Environment

Auto task and relayer
:memo:Details

I am trying to use test meta txns with defender, I configured auto task and relayer in defender and gave those API keys in front end app, am not getting any error in the front end txn is submitted, but getting error in autotask. The error is as below,

{“errorType”:“Error”,“errorMessage”:“VM execution error.”,“code”:-32015,“data”:“Reverted 0x”,“stack”:[“Error: VM execution error.”," at DefenderRelayProvider.send (/opt/nodejs/node_modules/defender-relay-client/lib/ethers/provider.js:58:31)"," at processTicksAndRejections (internal/process/task_queues.js:97:5)"]}
END RequestId

:1234: Code to reproduce

Trying from code from this repo for meta txns using defender with opengsn trusted forwarder in kovan network,

Hey @kbhargav5! It seems like a revert when trying to relay the tx in the Autotask, most likely on this line. I’d suggest you try to manually call verify on the forwarder to see if it succeeds. Also, keep in mind that the workshop was set up with OpenZeppelin Contracts MinimalForwarder, not with OpenGSN’s TrustedForwarder - it may be the case that the OpenGSN’s forwarder behaves slightly differently.

Thanks.

Also I believe relayers can be used without the use of autotask as all we need for meta txn is the relayer to pay for the gas fee. Autotask may need relayer but relayer doesnt need autotask. Am I correct? If so, Is it a good thing to remove autotask in meta txns ?

You’re right: you can use a Relayer directly with an API key/secret. However, keep in mind that whoever has an API key/secret for your Relayer, can freely send any txs through it - so it’s not a good idea to embed your API key/secret in your frontend, if you intend to implement meta-txs. Now, if you have your own backend, where you receive your users’ requests for forwarding meta-txs, then yes, you can have your backend interact directly with your Relayer.

@spalladino, I tried using the minimalForwarder from openzeppelin, which is also part of the workshop repo I mentioned, but still am getting the same error. Am able to send the transaction using “yarn relay” which sends the txn without autotask

Is it possible that you have connected the Autotask to the wrong relayer by any chance? The code executed by the autotask and the yarn relay is the same, the only difference is the environment and setup. Also, can you share what you are POSTing to the webhook?

Thanks @spalladino, that was the issue, I was pointing to the different autotask.

1 Like