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
- Start ganache-cli
- start oz-gsn relayer
- deploy GSNRecipient via migration (functions will call contract A and B below)
- deploy contractA using Truffle .new() via contractA.js test file
- Call functions on contractA via GSN (successful) via contractA.js test file
- deploy contractB using Truffle .new() via contractB.js test file - same contract as step #4 again (meant to be deployed multiple times)
- 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