opengsn / gsn

GSN v3.0.0-beta.10 - Ethereum Gas Station Network
https://opengsn.org/
592 stars 210 forks source link

Handle ganache evm reverts in tests on the relayer #194

Closed spalladino closed 5 years ago

spalladino commented 5 years ago

Truffle tests running on ganache often issue an evm_revert to roll back to an earlier clean state. This causes issues with nonce management on the relayer, which tracks its own nonce, and falls out of sync with that of ganache.

relayTransaction: the tx doesn't have the correct nonce. 
account has nonce of:  7 tx has nonce of:  9

We could add a flag -SkipNonceCaching to disable this behaviour on the relayer, so it plays nicely with testing environments. It would change the following logic, to always use the nonce obtained from the node, instead of the cached one if it is larger.

https://github.com/tabookey/tabookey-gasless/blob/198c76f16a06dd06219ca55481ee77cfd551377c/server/src/librelay/relay_server.go#L720-L724

shahafn commented 5 years ago

Fixed by you in #199