Skip to content
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

Reset ethers provider after a hardhat_reset #1024

Merged
merged 4 commits into from
Nov 26, 2020
Merged

Reset ethers provider after a hardhat_reset #1024

merged 4 commits into from
Nov 26, 2020

Conversation

fvictorio
Copy link
Member

@fvictorio fvictorio commented Nov 16, 2020

Closes #1015

There are a lot of changes in the test file, but they are mostly whitespace because of an extra describe block around them.

@@ -58,6 +58,10 @@ export class HttpProvider extends EventEmitter implements EIP1193Provider {
throw error;
}

if (args.method === "hardhat_reset") {
this.emit("hardhat_reset");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the name of this event.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe hardhatNetwokReset? I'd create a constant.

}

if (args.method === "hardhat_reset") {
this.emit("hardhat_reset");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we emit it in the node and just fwd it in the provider?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, a new node is created on a reset, so that wouldn't be possible, would it?

@fvictorio fvictorio merged commit 76fad5a into master Nov 26, 2020
@fvictorio fvictorio deleted the ethers-reset branch November 26, 2020 13:59
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hardhat-ethers getBlockNumber is wrong after a call to hardhat_reset.
2 participants