Feature Request: Support Custom Networks on Relayers

:computer: Environment

:memo:Details

Hi, we use OZ Defender Relayers a fair amount in our app, specifically for signing certain transactions. We also run a private mainnet forking environment in the cloud (using hardhat), which we use for internal testing.
A key issue though is that hardhat returns a chain id of 31337 when doing mainnet-forking (not 1, as in normal mainnet). And of course, the relayers right now don't know that they're operating in a mainnet-forking environment, so they can't return us the right chain ID, and then the signatures break because chain-id is typically included in signatures.

Thus we are forced to either 1.) Skip relayers entirely on mainet-forking and do signing locally, pr 2.) Have a conditional codepath in the relayer for things like "if (mainnetForking) { do this other thing }).

Clearly neither of these are great, since it means we can't really test the same codepath as production except in production itself.

Potential Solution

  • Support custom networks on Relayers. -> This would mean we pass in a URL for our private mainnet fork, and that is really it. Our front-ends can point at the relayer according to network, just like we would for a testnet.

Related Questions
I asked Santiago about this, and he had these followup questions
1.) This would be just for Relayers, or would you need Admin and Sentinel support as well?
----> For now, just Relayers would be sufficient. I could see in the future Admin or Sentinel support being cool as well, so we could test some full security flows or emergency situation training. But not required for this particular issue we're facing.

2.) Also, let's say that Defender supported mainnet forks on its own, to which you could connect to from wherever you need - would that work for you, or would you want to run the fork on your own end?
-----> Depends on the details. When we're using mainnet forks, we're often testing out new contracts or changes to contracts, which may involve fairly complex migrations and setup code. We even actually run a node server on the same machine so that our front-ends can call out and do things like impersonate accounts (eg. to fund your wallet with money from whales), and all sorts of other arbitrary stuff. So like... ultimately we still need full control and access to the network. We wouldn't want to share it with anyone else. So maybe? But seems like it's probably easier for us to just run our own (which we currently do via GCP), and we can update it with a simple git push.

1 Like