You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 20, 2025. It is now read-only.
If you run it, the second test will log 1 instead of the expected 42.
Expected behavior
Newly deployed contracts don't have their functions mocked, even if their address match the address of a previously deployed and mocked contract.
Additional context
See this issue in Hardhat's repo.
Possible solutions
I'm not sure what's the right solution here, but some ideas:
Just drop all the fakes/mocks when hardhat_revert is called. We emit an event in the provider when this happens, so you should be able to listen for it.
If you think the user should handle this, then add something like Allow mock/fake.resetAll() #129 would help, but it should be a global function instead that just clears everything.