I've been following this tutorial https://docs.openzeppelin.com/defender/guide-metatx I had gone through step by step, I've deployed the smart contract using relayer. But after creating the autotask, and saving webhook in my .env when I use the command yarn sign it is giving this error
C:\Users\ABC\Desktop\\relayer\workshops\25-defender-metatx-api> yarn sign
yarn run v1.22.19
$ hardhat run scripts/sign.js --network goerli
Signing registration of sign-test as 0xBB8587Cadd961bDE6596ef93c71BDB8d75D1928B...
Error: call revert exception (method="getNonce(address)", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.12)
at Logger.makeError (C:\Users\JAY\Desktop\relayer\workshops\25-defender-metatx-api\node_modules\@ethersproject\logger\src.ts\index.ts:205:28)
at Logger.throwError (C:\Users\JAY\Desktop\relayer\workshops\25-defender-metatx-api\node_modules\@ethersproject\logger\src.ts\index.ts:217:20)
at Interface.decodeFunctionResult (C:\Users\JAY\Desktop\relayer\workshops\25-defender-metatx-api\node_modules\@ethersproject\abi\src.ts\interface.ts:326:23)
at Contract.<anonymous> (C:\Users\JAY\Desktop\relayer\workshops\25-defender-metatx-api\node_modules\@ethersproject\contracts\src.ts\index.ts:309:44)
at step (C:\Users\JAY\Desktop\relayer\workshops\25-defender-metatx-api\node_modules\@ethersproject\contracts\lib\index.js:46:23)
at Object.next (C:\Users\JAY\Desktop\relayer\workshops\25-defender-metatx-api\node_modules\@ethersproject\contracts\lib\index.js:27:53)
at fulfilled (C:\Users\JAY\Desktop\relayer\workshops\25-defender-metatx-api\node_modules\@ethersproject\contracts\lib\index.js:18:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: null,
code: 'CALL_EXCEPTION',
method: 'getNonce(address)',
errorSignature: null,
errorArgs: [ null ],
address: '0x8a61f5959FECE20a53cb5e9AC537722FD4D00298',
args: [ '0xBB8587Cadd961bDE6596ef93c71BDB8d75D1928B' ],
transaction: {
data: '0x2d0335ab000000000000000000000000bb8587cadd961bde6596ef93c71bdb8d75d1928b',
to: '0x8a61f5959FECE20a53cb5e9AC537722FD4D00298',
from: '0xBB8587Cadd961bDE6596ef93c71BDB8d75D1928B'
}
}
error Command failed with exit code 1.
Environment
I am using Autotasks and Relayers to perform meta-transactions from our dapps on Goerli
Details
I have verified my MinimalForwarder contract address, to check if there was any error in calling contract, but it is deployed in the correct address. Code to reproduce
Been following this tutorial https://docs.openzeppelin.com/defender/guide-metatx
I might be wrong at this, but the issue seems to be on how we are calculating the nonce. If I manually set it up to '0' the transaction is sent but failing from the relayer
AUTOTASK START
2022-11-10T02:17:17.758Z INFO Relaying {
value: 0,
gas: 1000000,
nonce: '0',
to: '0x64DbAe09084aDd6b14512D931f3E13078E0Eb7b3',
from: '0x30Cd379534cE6C15eC08f00FF156166A2C7D1541',
data: '0xf2c298be0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a7261676761726167676100000000000000000000000000000000000000000000'
}
2022-11-10T02:17:19.077Z ERROR Invoke Error {"errorType":"Error","errorMessage":"Invalid request","stack":["Error: Invalid request"," at relay (/var/task/index.js:34:21)"," at processTicksAndRejections (node:internal/process/task_queues:96:5)"," at async handler (/var/task/index.js:54:14)"," at async Runtime.handler (/opt/nodejs/autotask-wrapper.js:71:20)"]}
END RequestId: f938b6ac-aa1c-4048-bcce-7b0402caa2e1
AUTOTASK COMPLETE
Created a custom MinimalForwarder contract with another name (in order to not interfere with OpenZeppelin's one)
Created a custom deploy script for my MinimalForwarder and Registry contracts. I have deployed not using Defender, but a regular wallet (I don't think it makes any difference). I saved the contract addresses on deploy.json just like in the workshop.
Installed the library hardhat-etherscan, verified the source code of both contracts and called the getNonce() function using Etherscan. I worked fine
Followed all the instructions from the workshop, except Deploy Using Relayer.
Sorry for the late reply, I was able to trace this error and seems like the Hardhat provider we have for goerli is not answering the getNonce call (and maybe neither others too), so the way to fix this is just replacing the goerli.url in hardhat.config.js.
I used an Infura URL and everything worked as expected.
I use Alchemy and it was not working as well.
Actually, I have written another answer for that post that was hidden by Akismet. I don't know the reason
I would love to have my post here also because I invested some time in writing it.
I am getting the same error but I am using Polygon Mumbai. Was this a problem only for Goerli or is it possible that the same is happening on Mumbai? Any idea on how to solve it?