-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hardhat is replaying all blocks when forking mainnet #4358
Comments
Also, it seems like those events are only emitted outside of the Hardhat environment. |
Thanks @antoinedc! I honestly have no idea how this is even possible. The second execution shouldn't "know" that there was a previous execution with a lower block number :/ I'll try to look into this as soon as I have some time. |
Thanks! Good to know at least that this is actually a bug and not a hidden feature ahah |
Actually, I believe this might be a feature of ethers 😬 |
Oh wow, great find! And here is the reason: ethers-io/ethers.js#3924 (comment) |
Makes sense. I don't think there's much we can do on our side though, right? Do you mind if we close this? |
Yes, we can definitely close this. I'm opening an issue on their end. Thanks a lot for tracking this down though, it was super helpful! |
Version of Hardhat
2.17.2
What happened?
When starting/stopping a node setup with a mainnet fork multiple times, instead of emitting the
block
event only for the latest, Hardhat is going to emit it for all past events since the last emitted one.For example:
I don't know if this is expected, but this is annoying as the main purpose of mainnet forks is to get the state, not to synchronize blocks & transactions. For my specific use case (Ethernal), this causes issues for users, as when they reset their node, they end up with tons of mainnet blocks/transactions in their backend, instead of just theirs.
Interestingly, this doesn't happen when a block number is specified for the fork.
Minimal reproduction steps
Here is a repo that reproduces the issue, instructions are in the README: https://github.com/tryethernal/repro-hardhat-bug
Search terms
replay, blocks, fork, mainnet
The text was updated successfully, but these errors were encountered: