hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

Implement `hardhat_setChainId`

Open alcuadrado opened this issue 3 years ago • 4 comments

We should implement this method, as it's useful for testing things like EIP-712 related functionality

alcuadrado avatar Aug 24 '22 18:08 alcuadrado

This issue is also being tracked on Linear.

We use Linear to manage our development process, but we keep the conversations on Github.

LINEAR-ID: 0f6a69b7-ab70-4c75-9353-c1888ff77420

github-actions[bot] avatar Aug 24 '22 18:08 github-actions[bot]

This comes from a conversation with Ryan about https://github.com/NomicFoundation/hardhat/pull/3060 — I think hardhat_setChainId would be a better alternative to #3060

alcuadrado avatar Aug 24 '22 18:08 alcuadrado

Following up on this. hardhat_setChainId approach would be better as it would allow setting the chain id without resetting state (simulation of a network fork), but is quite a bit more invasive. I believe that both approaches would be ideal as the most often use-case to set the chainId is with a network reset. Having #3060 functionality would be better than requiring two rpc calls to reset network with a new chainId.

arr00 avatar Aug 29 '22 18:08 arr00

Agreed with having a hardhat_setChainId. EIP-712 is pretty common and it would be useful to have tests for network-fork-proofing.

nataouze avatar Sep 13 '22 01:09 nataouze