Yarn sign is throwing Error: call revert exception

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.

:computer: Environment
I am using Autotasks and Relayers to perform meta-transactions from our dapps on Goerli

:memo: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.
:1234: Code to reproduce
Been following this tutorial https://docs.openzeppelin.com/defender/guide-metatx

2 Likes

I am having exactly the same issue here!
Any update on that?

2 Likes

Same here. Did anyone solve it? I am using Node 16 with a Macbook Pro M1, Mac OS Ventura

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

I have created another HardHat project from scratch and did the following:

  1. Installed latest version of dependencies manually (dotenv and defender ones)
  2. Copied code from the original workshop project https://github.com/OpenZeppelin/workshops/tree/master/25-defender-metatx-api
  3. Created a custom MinimalForwarder contract with another name (in order to not interfere with OpenZeppelin's one)
  4. 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.
  5. Installed the library hardhat-etherscan, verified the source code of both contracts and called the getNonce() function using Etherscan. I worked fine
  6. Followed all the instructions from the workshop, except Deploy Using Relayer.
  7. Applied the code from this pull request
  8. Created a /tmp directory

Everything worked fine. I am using MacOS and v16.13.2.

I hope that helps!

Hey y'all,

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.

Let me know if I can help you with anything else :slight_smile:

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 :frowning:
I would love to have my post here also because I invested some time in writing it.

Hey @jmsofarelli, can you send it to me in private? I'm surprised it was deleted.

Also, I just tried with an alchemy account, and it still works.
Is it the same error as before? Where did you use your Alchemy URL?

@ernestognw I don't have the text anymore, because I did not save locally :frowning:

Yes, the error was the same.
The Alchemy URL was set in hardhat.config.js

What I basically did was:

  1. created a hardhat project from scratch,
  2. created a custom MinimalForwarder contract with another name (to not interfere with OZ's one),
  3. deployed contract using a regular wallet (not Relayer one).
  4. copied the code from the workshop (except the deployment-related)
  5. followed instructions of guide (except the deployment part)
  6. fixed something in app (https://github.com/OpenZeppelin/workshops/pull/25)
  7. created /tmp dir

Everything is working now

1 Like

Happy to hear it's working now!
There might be some change laying around and impeding getting the call done.

Let me know if you need any help :slight_smile:

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?