NomicFoundation / hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
https://hardhat.org
Other
7k stars 1.35k forks source link

Add debug logs for provider creation #5478

Closed fvictorio closed 1 day ago

fvictorio commented 2 days ago

Now and then, there are some timeouts in EDR Hardhat tests (example) related to the provider initialization in a beforeEach hook.

This seems super weird to me. That before each only has two async operations: a call to createHardhatNetworkProvider and a server.listen() call a bit below that. I'm completely sure that the alchemy provider (which is the one with the timeout) doesn't use the server, so the only async operation is the provider creation.

But createHardhatNetworkProvider is async just because it calls the makeTracingConfig function, which loads some build info files. I doubt that this is the function that is causing a 50s timeout, so the alternative is that there's something weird going on now and then with EdrProviderWrapper.create.

The easiest way to evaluate this theory is to add some debug logs, and to add DEBUG="hardhat:core:hardhat-network:*" in EDR's CI. This won't produce any results until a new version of Hardhat is released and a new timeout is hit (it doesn't happen often), but this is not urgent so this is fine.

vercel[bot] commented 2 days ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 3, 2024 2:35pm
changeset-bot[bot] commented 2 days ago

🦋 Changeset detected

Latest commit: f6ddc92e46c3031367c4cb7c549964169ccfb9c3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------- | ----- | | hardhat | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR