Skip to content

️ deps(dev): Bump hardhat from 2.8.4 to 2.9.0

Yogi Bot requested to merge dependabot-npm_and_yarn-hardhat-2.9.0 into main

Bumps hardhat from 2.8.4 to 2.9.0.

Release notes

Sourced from hardhat's releases.

Hardhat v2.9.0 was released, including multiple performance improvements

This release of Hardhat is packed with performance improvements:

  • Hardhat Network got a new RPC method that lets you mine large amounts of blocks instantly (hardhat_mine).
  • Tests can be run in parallel now thanks to a newer version of Mocha.
  • Forking mainnet and other remote networks is faster — We saw a 2x improvement in our tests!
  • Contracts are now compiled in parallel, decreasing compilation times.

Read on to learn more about these and other changes

Instantly mining multiple blocks with hardhat_mine

This release adds a heavily requested feature: the possibility of mining multiple blocks in constant time.

Hardhat has always let you mine a new block using the evm_mine RPC method. This is useful in several scenarios, but sometimes you want to mine a large number of blocks and the only way to do it is to call evm_mine that many times. For thousands of blocks, this can be prohibitively slow.

Starting from Hardhat v2.9.0, you can use the hardhat_mine instead, which instantly mines any number of blocks:

// mine 256 blocks
await hre.network.provider.send("hardhat_mine", ["0x100"]);

You can also pass a second, optional parameter to specify the interval in seconds between the timestamps of each block:

// mine 1000 blocks with an interval of 1 minute
await hre.network.provider.send("hardhat_mine", ["0x3e8", "0x3c"]);

You can rely on the first and last block of the sequence produced by hardhat_mine being valid blocks, but most of the rest may not technically be so. Specifically, they can have an invalid parent hash, the coinbase account will not have been credited with block rewards, and the baseFeePerGas will be incorrect.

Also note that blocks created via hardhat_mine may not trigger new-block events, such as filters created via eth_newBlockFilter and WebSocket subscriptions to new-block events.

Faster remote network forking

We’ve optimized how we query data from remote nodes when forking from them. This led to [mainnet forking](https://hardhat.org/hardhat-network/guides/mainnet-forking.html) working significantly faster.

You don't need to do anything to benefit from this improvement.

Running tests in parallel

The test task now supports three new options: --parallel, --bail and --grep.

The --parallel flag runs your tests in parallel. Most of the time, this should produce the same results as running your tests serially, but there are some scenarios where tests run in parallel will behave differently. You can learn more in our [parallel tests](https://hardhat.org/guides/parallel-tests.html) guide.

The --bail flag can be used to stop the test runner as soon as some test fails. Keep in mind that this is best-effort when used in combination with parallel mode, as some tests from other test workers might continue to be executed after the first failure.

The --grep parameter can be used to filter which tests will be executed. For example, if you run hh test --grep foo, only tests and suites that have the string foo in their descriptions will be run.

... (truncated)

Commits
  • dffdfd0 Version Packages
  • 8d2c577 Merge pull request #2422 from NomicFoundation/fix-core-tests
  • 10291cb Merge pull request #2423 from NomicFoundation/dependabot/npm_and_yarn/prismjs...
  • 1909666 Merge pull request #2430 from NomicFoundation/dependabot/npm_and_yarn/url-par...
  • 153515e Bump url-parse from 1.5.7 to 1.5.10
  • dd2ee0f Bump prismjs from 1.25.0 to 1.27.0
  • 7188f06 Use a low keepAlive in the tests http provider
  • 9598650 Merge pull request #2414 from NomicFoundation/test-http-provider
  • bd7d4e3 Ensure that TOO_MANY_REQUESTs is rcvd by client
  • 8dcbc21 Use a fresh MockPool for each test case
  • Additional commits viewable in compare view

Merge request reports