OZ-GSN Relayer Ganache - Unacceptable RelayMaxNonce on Subsequent Contract Deploys

I ran into an error in Truffle JavaScript test files using Ganache and OZ-GSN Relayer.
Unacceptable RelayMaxNonce

I wanted to post this because the only other article that references Unacceptable RelayMaxNonce says it was solved by msg.sender usage. That isn’t the cause for me.

It happens when I deploy a contract using contract scope in the mocha tests. I know contract scope is suppose to create a clean room for testing - but I would assume I can deploy my contract a second time and use GSN to interact with it. Instead, I get RelayMaxNonce error.

Changing my tests to use describe context instead of contract context solves the issue - but I thought it unnecessary when repeatedly deploying the same contract and using GSN to interact with it.

Here are the steps to replicate the error

  1. Start ganache-cli
  2. start oz-gsn relayer
  3. deploy GSNRecipient via migration (functions will call contract A and B below)
  4. deploy contractA using Truffle .new() via contractA.js test file
  5. Call functions on contractA via GSN (successful) via contractA.js test file
  6. deploy contractB using Truffle .new() via contractB.js test file - same contract as step #4 again (meant to be deployed multiple times)
  7. Call functions on contractB via GSN (failure - Unacceptable RelayMaxNonce ) via contractB.js test file

Truffle v5.1.19
@openzeppelin/gsn-helpers v0.2.3
Ganache-Cli 6.9.1

1 Like

Hi @amaurer,

Welcome to the community :wave:

If you are still in the development phase of your project, you may want to look at the improvements in GSNv2 which is in development at OpenGSN.

I assume that this only impacts your testing as assume that you will only be deploying your contract once. Let me know and I can try reproducing.

GSN Provider and GSN Helpers are in maintenance mode. We are no longer actively developing new features for these projects, and will only be releasing fixes for high severity issues until July 2020. Read here for more info.

Got it. Thanks for letting me know, @abcoathup about the updates for v2 and deprecation of v1. I’ll update my dependencies.

1 Like

Hi @amaurer,

You can still use and develop for GSNv1. You may want to run your own relayer to ensure that there is always an available relayer.

GSNv2 is in development, so I would check it out to see if it matches your roadmap.