[Dev Tools] Impersonating account when using anvil-zksync with mainnet fork #1024
-
Team or ProjectRedStone ZK chainEra EnvironmentMainnet Select the Dev Tool you are usingHardhat Plugins Provide the version of the tool (if applicable)No response Provide a brief description of the functionality you're trying to implement and the issue you are running into.I'd like to run tests on a mainnet fork using Hardhat together with an anvil-zksync node. These tests involve contract upgrades, which require impersonation functionality. However, when attempting to impersonate accounts, we encounter the following error: This appears to be caused by a check in the hardhat-zksync-ethers package, specifically this line. The code currently checks whether the chain ID matches the local network ID (240). When using a mainnet fork, the chain ID is 324 (zkSync mainnet), which causes the impersonation feature to fail, even though we are running on a local forked environment. Repo Link (Optional)No response Additional DetailsNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Appreciate the post, will check on this and get back to you. |
Beta Was this translation helpful? Give feedback.
You can pass --chain-id to anvil-zksync to override.