-
Notifications
You must be signed in to change notification settings - Fork 277
Prepare for next hardhat version #796
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,19 +198,19 @@ task("coverage", "Generates a code coverage report for tests") | |
// ============== | ||
// Server launch | ||
// ============== | ||
let network = nomiclabsUtils.setupHardhatNetwork(env, api, ui); | ||
let network = await nomiclabsUtils.setupHardhatNetwork(env, api, ui); | ||
|
||
if (network.isHardhatEVM){ | ||
accounts = await utils.getAccountsHardhat(network.provider); | ||
nodeInfo = await utils.getNodeInfoHardhat(network.provider); | ||
|
||
// Note: this only works if the reset block number is before any transactions have fired on the fork. | ||
// e.g you cannot fork at block 1, send some txs (blocks 2,3,4) and reset to block 2 | ||
env.network.provider.on(HARDHAT_NETWORK_RESET_EVENT, () => { | ||
api.attachToHardhatVM(env.network.provider); | ||
env.network.provider.on(HARDHAT_NETWORK_RESET_EVENT, async () => { | ||
await api.attachToHardhatVM(env.network.provider); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not super confident about this change. I think it's working (I ran coverage in a test that uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @fvictorio Is your concern that the event callback won't be awaited by EventEmitter? Or something else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have a specific concern tbh. It's just that something that used to happen "immediately" after a reset now will not. There might be a hidden assumption that is now broken, but it's hard to know. |
||
}); | ||
|
||
api.attachToHardhatVM(network.provider); | ||
await api.attachToHardhatVM(network.provider); | ||
|
||
ui.report('hardhat-network', [ | ||
nodeInfo.split('/')[1], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍