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

chore(deps): update dependency hardhat to v2.22.6 #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link

@renovate renovate bot commented Jan 6, 2022

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
hardhat (source) 2.6.8 -> 2.22.6 age adoption passing confidence

Release Notes

nomiclabs/hardhat (hardhat)

v2.22.6: Hardhat v2.22.6

Compare Source

Changes


💡 The Nomic Foundation is hiring! Check our open positions.


v2.22.5: Hardhat v2.22.5

Compare Source

This release re-enables support for hardhat-tracer and adds limited support for blob transactions, along with performance improvements and bug fixes.

Changelog

  • f65dc7c: Improved the validation of network and forking URLs (thanks @​kshyun28!)
  • 5d46baa: Internal changes to allow hardhat-tracer to be re-enabled with Hardhat after the EDR upgrade
  • 6e36f3f: Bump EDR to v0.4.0. This adds support for eth_maxPriorityFeePerGas, limited support for blob transactions, improves performance and fixes some bugs. Check out the v0.4.0 EDR release and v0.3.8 EDR release for more details.

💡 The Nomic Foundation is hiring! Check our open positions.


v2.22.4: Hardhat v2.22.4

Compare Source

This release includes bug fixes, performance enhancements, and an improvement to the task system to support BigInt arguments.

Changelog

  • 22bcbf5: Added BigInt task argument type.
  • 2c533f0: Bumped EDR dependency to 0.3.7.
  • 3203639: Fixed an issue in the solidity source map decoding module.
  • 5d7a604: Fixed an issue with solc version selection.
  • 3c6de8f: Now solcjs is run in a subprocess, which leads to better error reporting and allows it to run multiple compilation jobs at the same time.
  • 6447e80: Improved performance by reducing back-and-forth with EDR when it's not necessary.

💡 The Nomic Foundation is hiring! Check our open positions.


v2.22.3

Compare Source

A small bug fix release that improves the error messaging around failed installs of EDR (Hardhat network).

Changelog

💡 The Nomic Foundation is hiring! Check our open positions.


v2.22.2: Hardhat v2.22.2

Compare Source

This release introduces a small change to the initialization process of Hardhat, which makes the task runner more extensible.

Changelog

  • 7876104: Initialize the Hardhat Runtime Environment before passing the command line arguments. Thanks @​theethernaut!

v2.22.1: Hardhat v2.22.1

Compare Source

This release updates the starter projects available through hardhat init to include Hardhat Ignition as the default deployment system.

v2.22.0: Hardhat v2.22.0

Compare Source

This release sets Cancun as the default hardfork used by the Hardhat Network.

v2.21.0: Hardhat v2.21.0 — Introducing EDR

Compare Source

This version of Hardhat marks the debut of EDR (Ethereum Development Runtime), our new Rust-based runtime that is a complete rewrite of the original TypeScript-based Hardhat Network. This release lays a new long-term foundation for Hardhat's evolution over the coming year.

There are no functional changes, but there are some performance improvements across the board, which we’ll continue to expand in future updates.

Given the significance of this internal change, there’s a possibility of bugs. If you encounter any problems specific to this version, please report them by opening an issue. You should be able to downgrade to v2.20.1 without losing functionality if needed.

solidity-coverage out-of-memory issues

The solidity-coverage plugin works by heavily instrumenting the code, which sometimes causes OOM (out-of-memory) issues. This new version of Hardhat can, in certain cases, make those problems more likely.

If you run into this, you can fix it by using Node.js’s --max-old-space-size flag:

NODE_OPTIONS="--max-old-space-size=8192" npx hardhat coverage
Dropping support for Node.js v16

As part of this release, we are dropping support for Node.js v16. This version of Node.js reached its end-of-life in September of last year. You can learn more about our support guarantees here.

v2.20.1: Hardhat v2.20.1

Compare Source

This release fixes a bug when hardhat_setStorageAt was used in untouched addresses.

v2.20.0: Hardhat v2.20.0 — Cancun

Compare Source

This release adds support for the upcoming cancun hardfork. This hardfork is not enabled by default; if you want to use it, then you have to enable it in your Hardhat config:

module.exports = {
  networks: {
    hardhat: {
      hardfork: "cancun",
    },
  },
}

Keep in mind that blob transactions are not supported yet. If you need this, please upvote or comment on this issue.

In addition, this release adds support for solc 0.8.24.

v2.19.5: Hardhat v2.19.5

Compare Source

This release includes the following changes:

  • Notify users when a new Hardhat version is available
  • Fixed a bug during project initialization when using yarn or pnpm
  • Fixed a race condition that occurred when multiple Hardhat processes ran a compilation at the same time
  • Added a fix to prevent submitting transactions with 0 priority fee (thanks @​itsdevbear!)

v2.19.4: Hardhat v2.19.4

Compare Source

This release changes our telemetry to anonymously report the consent response.

v2.19.3: Hardhat v2.19.3

Compare Source

This release adds support for solc 0.8.23. It also includes a temporary informative message about the ongoing 2023 Solidity Survey.

v2.19.2: Hardhat v2.19.2

Compare Source

This release adds experimental support for ESM in typescript projects.

In addition to that, the hardhat-shorthand tool (hh) now supports scoped tasks.

v2.19.1: Hardhat v2.19.1

Compare Source

This release fixes a couple of issues:

  • A problem in low-traffic chains that resulted in txs using a maxPriorityFeePerGas of 0, which were then rejected by the node.
  • A bug in the compiler downloader that was triggered in big projects that used many different versions of solc.

Besides that, the project initialization now uses the latest version of the Hardhat Toolboxes.

v2.19.0: Hardhat v2.19.0

Compare Source

This new version of Hardhat introduces a new feature: Configuration Variables!

Configuration variables let you use values in a configuration file without making them part of your project. They work as a replacement for environment variables and dotenv, but are more flexible and powerful. Read our guide to learn more.

This version also adds support for solc v0.8.22.

v2.18.3: Hardhat v2.18.3

Compare Source

This release adds ignition deploy to our telemetry-reported tasks.

v2.18.2: Hardhat v2.18.2

Compare Source

This releases fixes a problem with Hardhat's compiler download caused by a fix in the latest version of undici.

v2.18.1: Hardhat v2.18.1

Compare Source

This new version of Hardhat includes a new option when initializing a project: you can now start a project that uses Viem instead of ethers. To learn more about this, check our announcement.

This version also makes a small change to the logs shown during compilation: now the targeted EVM version (or versions) is shown.

v2.18.0: Hardhat v2.18.0

Compare Source

This version of Hardhat adds support for scoped tasks.

You can now create scopes to group multiple tasks that are related in some way:

const myScope = scope("my-scope", "Scope description");

myScope.task("my-task", "Do something")
  .setAction(async () => { ... });

myScope.task("my-other-task", "Do something else")
  .setAction(async () => { ... });

Thanks to @​zemse, who kickstarted the work on this!

v2.17.4: Hardhat v2.17.4

Compare Source

This version of Hardhat adds support for the debug_traceCall method.

Besides that, Hardhat projects are now initialized with npx hardhat init instead of npx hardhat. The latter command still works but it will produce a warning. See https://github.com/NomicFoundation/hardhat/issues/2594 for the rationale behind this change.

v2.17.3: Hardhat v2.17.3

Compare Source

This version of Hardhat changes the default evmVersion to paris for solc versions newer than or equal to 0.8.20.

Starting from version 0.8.20, solc changed the default target EVM version to Shanghai. Among other things, this meant that the generated bytecode could (and most likely would) contain the new PUSH0 opcode.

Up until this point, Hardhat always delegated to solc the decision of which EVM version to target. But there are two things that are different today: many users develop for non-mainnet chains, and not every chain has adopted the Shanghai hardfork yet. This means it's possible that you develop a contract which works locally (Hardhat's default hardfork is still Shanghai, because we follow the current mainnet hardfork) but that then doesn't work after deploying it.

If you are sure you are going to deploy in a network that supports the Shanghai hardfork, you can change the target EVM like this:

module.exports = {
  solidity: {
    version: "0.8.20",
    settings: {
      evmVersion: "shanghai",
    },
  },
};

v2.17.2: Hardhat v2.17.2

Compare Source

This release includes several fixes and some new features:

  • Added support for state overrides in the eth_call RPC method
  • Added an enableTransientStorage option to enable EIP-1153 opcodes
  • Deprecated the TASK_COMPILE_TRANSFORM_IMPORT_NAME subtask, added a new TASK_COMPILE_GET_REMAPPINGS subtask, and added support for remappings in the resolver.
  • Fixed a problem that was causing debug_traceTransaction to return traces where the memory had a lot of empty words
  • Fixed an issue where artifactExists would throw an error for missing artifacts
  • Improved the error message displayed when importing a directory instead of a file
  • Fixed a problem with receipts of remote transactions returning the wrong tx type when fetched through a fork

v2.17.1: Hardhat v2.17.1

Compare Source

This release adds support for solc v0.8.21, allows using console.log in pure functions and improves the output of the flatten task (see https://github.com/NomicFoundation/hardhat/issues/1499).

Besides that, this version:

  • Removed an unnecessary dependency (abort-controller) because it's no longer needed in the versions of node.js supported by Hardhat (thanks @​orlandoortegajr!)
  • Fixed a bug caused by nodes returning 429 responses without a Retry-After header (thanks @​kowalski!)
  • Added logic to throw an error when the debug_traceTransaction method is called with a tracer parameter that is not supported.

v2.17.0: Hardhat v2.17.0

Compare Source

This new minor version of Hardhat drops support for Node.js v14 and adds support for Node v20. To learn about which versions of Node we support, check our Stability guarantees page.

This version also adds support for solc 0.8.19 and 0.8.20 and fixes two bugs:

v2.16.1: Hardhat v2.16.1

Compare Source

This release fixes an issue in the compiler download that happens when Hardhat is used with node v18.16.x (the latest versions of node v18).

v2.16.0: Hardhat v2.16.0 - Extendable providers

Compare Source

This version of Hardhat adds a new extensibility point: you can now wrap Hardhat's network provider with your own logic.

This is done by using the new extendProvider configuration function:

extendProvider(async (provider, config, network) => {
  const newProvider = new MyProviderWrapper(provider);
  return newProvider;
});

Doing this means that all the JSON-RPC calls will go through your custom provider wrapper. You can use this to intercept and handle some requests while forwarding the rest to the original provider.

To learn more about this, read the "Extending the Hardhat provider" section in our docs. If you have questions about how to use this, please open a new discussion.

Other changes

Besides this new feature, this version includes the following changes:

  • console.sol is now memory-safe (thanks @​ZumZoom!)
  • Added optional params to some compilation subtasks to make them more flexible (thanks @​adjisb!)
  • Added a HARDHAT_DISABLE_TELEMETRY_PROMPT environment variable that can be set to true to prevent Hardhat from showing the telemetry consent prompt
  • The opt-in telemetry is now done using Google Analytics 4

v2.15.0: Hardhat v2.15.0

Compare Source

This new version of Hardhat uses the new ethers v6 based Toolbox when initializing a project. Check the release notes of the Toolbox to learn more.

v2.14.1: Hardhat v2.14.1

Compare Source

This release adds better information to Hardhat about which block numbers correspond to which hardforks. Most users won't be affected by this, but it fixes some issues for certain edge cases.

v2.14.0: Hardhat v2.14.0 — Shanghai

Compare Source

This release sets Shanghai as the default hardfork used by the Hardhat Network.

If for some reason you want to keep using the previous hardfork, set it explicitly in your config:

module.exports = {
  networks: {
    hardhat: {
      hardfork: "merge"
    }
  }
}

v2.13.1: Hardhat v2.13.1

Compare Source

This release adds support for the upcoming Shanghai hardfork. This hardfork is not enabled by default; if you want to use it, then you have to enable it in your Hardhat config:

module.exports = {
  networks: {
    hardhat: {
      hardfork: "shanghai"
    }
  }
}

Besides that, this version fixes a problem when importing scoped packages in a Yarn Berry monorepo that uses PnP (thanks @​zouguangxian!)

v2.13.0: Hardhat v2.13.0 — ES Modules and compiling with viaIR

Compare Source

This new version of Hardhat adds two long-awaited features: ES Modules support, and better support for solc’s IR-based compilation pipeline. Besides that, this version includes several other improvements and bug fixes.

Remember to give this repo a star ⭐ if you are enjoying Hardhat!

ES Modules support

Hardhat was designed with CommonJS in mind, but in the last years adoption of ES Modules (ESM) has been growing. This version includes better support for it. You can now write scripts and tests as ESM, but your Hardhat config —and anything imported from it— still needs to use CommonJS.

ES modules let you use import/export and top-level await. This means that instead of writing a script like this:

// script.js
const helpers = require("@​nomicfoundation/hardhat-network-helpers");

async function main() {
  const latestBlockNumber = await helpers.time.latestBlock();
  console.log("Latest block:", latestBlockNumber);
}

main()
  .then(() => process.exit(0))
  .catch(error => {
    console.error(error);
    process.exit(1);
  });

you can now write a less verbose ESM script:

// script.mjs <-- notice the extension
import helpers from "@&#8203;nomicfoundation/hardhat-network-helpers";

const latestBlockNumber = await helpers.time.latestBlock();
console.log("Latest block:", latestBlockNumber);

Check our guide about Using ES modules with Hardhat to learn more.

Huge thanks to @​phated, who started the work on this and helped us along the way.

IR-based compilation pipeline

The solc compiler has a newer, alternative way of generating bytecode through an intermediate representation (IR). Previous versions of Hardhat don’t work well with this compilation mode, especially when the optimizer is fully-enabled.

This release adds better support for the IR compilation pipeline, but you might still get some issues if you use the default settings. We recommend enabling the minimal necessary optimization steps when compiling with IR:

solidity: {
  version: "0.8.18",
  settings: {
    viaIR: true,
    optimizer: {
      enabled: true,
      details: {
        yulDetails: {
          optimizerSteps: "u:",
        },
      },
    },
  },
}

You can learn more about Hardhat and IR here.

Other improvements

In addition to ES Modules and compiling with the IR-based pipeline, this version includes these improvements and bug fixes:

  • Added support for Solidity 0.8.18 (thanks @​taxio!)
  • Hardhat's task runner now allows you to override the arguments passed to subtasks (thanks @​zemse!)
  • The colors used to show errors and warnings are better and more readable (thanks @​frangio!)
  • We now show better error messages when a transaction to a JSON-RPC network reverts (thanks @​orenyomtov!)
  • Hardhat is now more tolerant to Node.js versions that are not officially supported (thanks @​iamrekas!)
  • The resolveJsonModule compiler option is now enabled by default in the sample tsconfig (thanks @​mlshv!)
  • The sample project’s deploy script uses better example values (thanks @​mutedSpectre!)
  • Fixed an issue with a warning showing the same solc version multiple times (thanks @​shark0der!)
  • Fixed an error that could happen when a download failed

v2.12.7

Compare Source

Changes

  • e443b36: Added an option in Hardhat Network to allow mining blocks with the same timestamp

  • c23a1ca: Added support for the http_proxy environment variable. When this variable is set, Hardhat will send its requests through the given proxy for things like JSON-RPC requests, mainnet forking and downloading compilers.

    We also removed support for the HTTP_PROXY and HTTPS_PROXY environment variables, since http_proxy is the most commonly used environment variable for this kind of thing. Those variables could only be used for downloading compilers.

    Finally, we also added support for no_proxy, which accepts a comma separated list of hosts or "*". Any host included in this list will not be proxied.

    Note that requests to "localhost" or "127.0.0.1" are never proxied.

  • 6954665: Added support for sending batch requests through WebSocket to the Hardhat node (thanks @​tenbits!)

  • 6bf1673: Added a config validation for the number of optimizer runs used (thanks @​konarshankar07!)

v2.12.6: Hardhat v2.12.6

Compare Source

Features
  • Added support for pnpm during project creation (thanks @​Hopsken!)
  • Added a version field to the Hardhat Runtime Environment (thanks @​konarshankar07!)
Bug fixes
  • Fixed a problem with impersonated-sender transactions sometimes resulting in duplicate transaction hashes (issue #​1963)
Other changes
  • Added a minor clarification to the help output of the flatten task
  • Upgraded the versions of mocha and @types/mocha used by Hardhat
  • Upgraded the version of undici used by Hardhat.
  • Removed the message linking to the 2022 Solidity Survey
  • Added a new subtask to the compile task that will be used by the hardhat-foundry plugin.

v2.12.5: Hardhat v2.12.5

Compare Source

  • The full return data of unrecognized custom errors is now shown in error messages
  • Fixed a bug that was causing the flatten task to produce non-deterministic results
  • Fixed a bug when gasPrice was set to "auto", which is the default configuration when connecting to a JSON-RPC network. This bug was preventing the results from eth_feeHistory from being used when they should.
  • Added an experimental environment variable flag to disable the local installation check (thanks @​arijoon!)

v2.12.4: Hardhat v2.12.4

Compare Source

This release fixes a small issue that was affecting our VSCode extension in some edge cases.

It also includes a non-intrusive message promoting this year's Solidity Developer Survey.

v2.12.3: Hardhat v2.12.3

Compare Source

  • Added a new hardhat_metadata RPC method
  • Trim leading and trailing spaces in mnemonics (thanks @​winor30!)
  • Pending blocks now include the bloom field (thanks @​InoMurko!)
  • A better error is shown if a Solidity file makes an import through its own package name (thanks @​KaanKC!)
  • Added a getBuildInfoSync function to the hre.artifacts object (thanks @​emretepedev!)
  • Fixed an edge case where Hardhat would hang if debug_traceTransaction was used with an OOG transaction sent to a precompile

v2.12.2: Hardhat v2.12.2

Compare Source

  • Fixed an issue when forking networks like Arbitrum Nitro that use non-standard transaction types (#​2995, #​3194).
  • Fixed an issue that was causing build-info file names to not be deterministic.

v2.12.1: Hardhat v2.12.1

Compare Source

Fixed a problem that was preventing Hardhat from being used in Alpine Linux.

v2.12.0: Hardhat v2.12.0

Compare Source

This new minor version sets the merge hardfork as the default hardfork used by the Hardhat Network. Most users shouldn't be affected by this change.

Besides that, this version fixes a couple of issues related to our compilation pipeline.

v2.11.2: Hardhat v2.11.2

Compare Source

This new version of Hardhat brings several fixes and improvements:

  • Solidity 0.8.17 is now supported and used by default in the sample projects.
  • When forking a network, the disk cache is always used (thanks @​bernard-wagner!)
  • Stack traces are shown by default in CI servers
  • We fixed a problem related to the validation of the eth_getStorageAt being too restrictive (thanks @​aathan!)
  • Reverted an unintentional breaking change in the type of the resolved config
  • Improved the heuristic for detecting that a contract deployment failed because the code size was too large

v2.11.1: Hardhat v2.11.1

Compare Source

This release fixes a couple of bugs in v2.11.0:

  • Some chains, like Polygon, were causing issues when they were forked
  • The WASM version of the solidity compiler, which is used in some machines, was not being correctly downloaded.

v2.11.0: Hardhat v2.11.0 — The Merge support and fast compilation

Compare Source

We are excited to release this new version of Hardhat, as it makes Hardhat Network compatible with The Merge and makes our compilation much faster. Read on to learn more about these and other improvements.

Support for The Merge

Hardhat Network now has support for The Merge. To try it out, use the new merge hardfork setting. This hardfork is not selected by default, but you can enable it in your config:

module.exports = {
  networks: {
    hardhat: {
      hardfork: "merge"
    }
  }  
};

Selecting this new hardfork will introduce a few changes to how Hardhat Network runs, but your contracts should still work without any modification. The rest of this section explains what these changes are.

The DIFFICULTY opcode (now renamed to PREVRANDAO) will return a pseudo-random value. This value is also exposed in the block header as mixHash.

You can use the new hardhat_setPrevRandao RPC method to modify the value returned by DIFFICULTY/PREVRANDAO in the next block. We recommend using the setPrevRandao network helper for this.

Hardhat Network’s JSON-RPC now accepts the new safe and finalized block tags, which in Hardhat Network are just aliases for the latest block tag, and correspond to the latest block.

Faster compilation

We optimized Hardhat’s compilation pipeline, significantly reducing the overhead it adds on top of solc. Compilation takes 40% less in most workflows, with a few taking 90% less!

How much of an impact this has depends on the size of your project, setup, and workflow, so we’ll explore two examples here, running the same benchmarks on each.

We’ll focus on a few different workflows:

  • Clean compilation: compiling the entire codebase from scratch
  • No recompilation: trying to compile when there has been no modification, and everything is cached.
  • Leaf contract: modifying and recompiling a contract with tons of dependencies but that’s not imported by others after a clean compilation.
  • Deep contract: modifying and recompiling a contract used in the entire codebase after a clean compilation
  • Syntax error: introducing a syntax error to the leaf contract and trying to recompile it after a clean compilation
Open Zeppelin Contracts

This project is an example of a large codebase with a JavaScript setup. We expect most JavaScript projects to see similar or better results.

Workflow Time with Hardhat 2.10.12 Time with Hardhat 2.11.0 Time reduction
Clean compilation 15.37s 8.61s 43.98%
No recompilation 0.67s 0.31s 53.73%
Leaf contract 8.02s 3.06s 61.84%
Deep contract 11.9s 6.96s 41.51%
Syntax error 4.77s 0.36s 92.45%
Uniswap v3-core

This project is an example of a mid-size codebase with TypeScript and TypeChain. The benchmarks include both compilation and TypeChain types generation.

Due to the TypeScript changes described later in this document, we expect these results to be even better than those of Open Zeppelin Contracts. We believe these results will be what most Hardhat users will perceive when upgrading to this new version.

Workflow Time with Hardhat 2.10.12 Time with Hardhat 2.11.0 Time reduction
Clean compilation 9.97s 3.87s 61.18%
No recompilation 1.21s 0.41s 66.11%
Leaf contract 9.29s 3.82s 58.88%
Deep contract 9.17 3.82 58.34%
Syntax error 5.79 0.45 92.22%

Before running the benchmarks, we replaced the deprecated typechain-hardhat plugin with TypeChain’s official plugin. If you are still running the old one, upgrading will lead to better compilation times.

These benchmarks were run on an M1 Macbook Pro.

How to get the performance improvements

All you need to do to benefit from these performance improvements is to upgrade Hardhat and its plugins.

TypeScript type-checking is now opt-in

Until this version, if you used TypesScript, Hardhat type-checked your entire codebase every time it was run. While this could be useful to discover type errors quickly, it also meant that Hardhat users were waiting for the TypeScript compiler to run every time, making every Hardhat workflow slower.

Starting with Hardhat v2.11.0 we don’t type check your codebase unless you explicitly ask for it using the new --typecheck flag. This means that, by default, every task will run faster. You won’t get typing errors from Hardhat, but you should still get them in your editor.

Additionally, running without type-checking means using types from TypeChain in your config and tasks without any problem. If they haven’t been generated yet, Hardhat would still run, generating them after compiling.

We recommend using --typecheck in your CI or a similar workflow to ensure that your code is correct.

A new --flamegraph flag was added to profile Hardhat projects

Flamegraphs are a visualization of hierarchical data created to visualize stack traces of profiled software. While the Node.js ecosystem has excellent tools to create them, they aren’t really useful to profile Hardhat, as they lose track of asynchronous execution, which Hardhat uses extensively.

You can now run Hardhat’s CLI with a --flamegraph flag, which will profile the tasks’ execution and construct a flame graph of the stack of Hardhat tasks that were run. Instead of showing the JavaScript functions implementing Hardhat, this flame graph will only show tasks. This leads to a simpler-to-understand graph that can be used to optimize Hardhat, its plugins, and advanced projects overriding tasks.

Artifact paths cache

Hardhat now caches the paths to the artifacts it reads within the same process. This leads to tests taking less time to get started, which can be significant in larger projects like OpenZeppelin Contracts.

If you’re the author of a plugin and were depending on the artifact paths not being cached, please look at our updated Artifacts interface, which allows you to disable this behavior.

v2.10.2: Hardhat v2.10.2

Compare Source

This version adds support for Solidity versions up through 0.8.16. Besides that:

  • Now console.log() prints an empty line instead of printing undefined.
  • The "Unrecognized custom error" message includes the selector of the custom error.

v2.10.1: Hardhat v2.10.1

Compare Source

This version improves how propagated Solidity errors are processed by Hardhat (issue #​2546).

v2.10.0: Hardhat 2.10.0: A refreshed experience

Compare Source

Hardhat 2.10.0 is out, and it marks a change in the product direction that Hardhat has historically taken.

Hardhat’s core values have always been optionality, flexibility and extensibility, enabling it to be used in whatever ways were needed and found to be useful. However, as we described in this thread, the Ethereum and Hardhat development ecosystems grew too large for easy navigation among the many different paths and viable options.

While retaining those core values, Hardhat 2.10.0 now offers a complete and opinionated setup that is ready to start building Ethereum software out-of-the-box. No decisions on plugins, libraries, or dependencies. Just get going.

We’re calling this the Hardhat Toolbox, which is a bundle of plugins and functionality that the Nomic Foundation team considers to be the best way to get started with a new Ethereum project. Read on to learn more about it.

Hardhat Toolbox

You can get our recommended setup by installing the @nomicfoundation/hardhat-toolbox plugin.

When you use this plugin, you'll be able to:

  • Deploy and interact with your contracts using ethers.js and the hardhat-ethers plugin.
  • Test your contracts with Mocha, Chai and our own Hardhat Chai Matchers plugin.
  • Interact with Hardhat Network with our Hardhat Network Helpers.
  • Verify the source code of your contracts with the hardhat-etherscan plugin.
  • Get metrics on the gas used by your contracts with the hardhat-gas-reporter plugin.
  • Measure your tests coverage with solidity-coverage.
  • And, if you are using TypeScript, get type bindings for your contracts with Typechain.

You can learn how to migrate to it here.

Hardhat Chai Matchers

@nomicfoundation/hardhat-chai-matchers is a drop-in replacement of @nomiclabs/hardhat-waffle that integrates more tightly with Hardhat, adds new functionality and improves its error messages. We recommend migrating to it.

Since the very beginning, we’ve recommended that people use Waffle, via hardhat-waffle, and we thank the team at TrueFi for their great work. However, for such a core component of the setup, there were too many recurring issues related to not being integrated deeply enough with Hardhat. For this reason, we decided to fork Waffle and release our own Chai matchers.

Some of its functionality and improvements:

  • All of hardhat-waffle’s matchers are supported
  • Great support for BigNumber and native bigint
    • No need to think about them anymore
    • Our matchers can compare any combination of
      • number
      • Native bigint
      • ethers.BigNumber
      • BN.js
  • Better revert matchers
    • New matchers for reverted transactions: .revertedWithPanic, .revertedWithCustomError, .revertedWithoutReason
    • .revertedWith matches the exact string, not a substring
  • Better matching of events
    • Fixed a bug where .to.emit("A").and.to.emit("B") was ignoring the first event completely
    • Better matching of event arguments
      • You can ignore some argument and only check the rest
      • You can write an arbitrary predicate for each argument
  • Better error messages
  • Multiple stability improvements

You can learn more about it here.

Hardhat Network Helpers

@nomicfoundation/hardhat-network-helpers is a library that provides a set of utility functions to interact with the Hardhat Network. When using this library you don’t have to deal with low-level JSON-RPC calls. No more encoding parameters in hexadecimal nor hard to understand Hardhat Network errors.

It includes utilities for time manipulation, modify contracts and accounts, manipulate the mempool, reuse common testing setups using fixtures, and more.

Using the helpers is as simple as this:

// before: mine 100 blocks
await network.provider.send("hardhat_mine", ["0x64"]);

// now
const helpers = require("@&#8203;nomicfoundation/hardhat-network-helpers");
await helpers.mine(100);

You can learn more about it here.

@​nomiclabs/hardhat-ethers

Our @nomiclabs/hardhat-ethers has a new helper that makes impersonating accounts easier. Now you can do:

const signer = await hre.ethers.getImpersonatedSigner("0x1234567890123456789012345678901234567890");
console.log(await signer.getBalance());

Other Hardhat changes

  • Add support for Node 18
  • Upgrade Mocha to 10.x
  • Upgrade ethereum-cryptography to 1.x (Thanks @​paulmillr!)
  • Removed a workaround to past Ganache's gas estimation problems (Thanks @​JuanuMusic!)
  • Drop support for Node 12

v2.9.9: Hardhat v2.9.9

Compare Source

This release fixes a problem with Hardhat's peer dependencies that was causing some issues for pnpm users.

v2.9.8: Hardhat v2.9.8

Compare Source

This release adds support for custom HTTP headers in the forking configuration. This can be useful to, for example, use nodes that have some kind of authorization mechanism:

module.exports = {
  networks: {
    hardhat: {
      forking: {
        url: "...",
        httpHeaders: {
          Authorization: "Bearer token"
        }
      }
    }
  }
};

Thanks @​TimDaub for implementing this!

This version also exposes the formArtifactPathFromFullyQualifiedName method in the Artifacts public interface.

v2.9.7: Hardhat v2.9.7

Compare Source

This release fixes a bug (#​2742) that was causing block.chainid to be evaluated to 0 inside view functions.

v2.9.6: Hardhat v2.9.6

Compare Source

This release fixes an issue that was preventing compilation from working on Windows (#​2712, thanks @​tylerK1294!)

Besides that, now the node task is terminated when the server closes (thanks @​zzmp!)

v2.9.5: Hardhat v2.9.5

Compare Source

This release fixes a small publish problem in v2.9.4 that shouldn't affect most users.

Besides that, now the eth_getStorageAt method is spec-compliant. This means that the storage slot argument must have a length of 32 bytes (a hex-encoded, 0x-prefixed string of length 66).

v2.9.4: Hardhat v2.9.4

Compare Source

This release of Hardhat adds a change that makes it work better with the latest versions of ethers.js. It also includes several bug fixes and some minor features.

  • Expand the data object returned by the JSON-RPC response when a transaction or call reverts. Now it also includes the message and data fields. The message is the same message that is part of the response, and it's included to make things work better with ethers.js. The data field includes the return data of the transaction. These fields are included in the responses of the eth_sendTransaction, eth_sendRawTransaction, eth_call and eth_estimateGas methods when they revert.
  • Fixed an issue when circular dependencies where present in lazyObject or lazyFunction (issue #​1473, thanks @​pcarranzav!)
  • Upgrade ethereumjs dependencies (thanks @​LogvinovLeon!)
  • Stop publishing tsconfig.json files (issue #​2582)
  • Fixed an issue when solcjs was being used to compile the project (issues #​2554, #​2329 and #​2004, thanks @​alexdupre!)
  • Fixed a problem related to how optional params were printed in the help (thanks @​scnale!)
  • Fixed an issue triggered when hardhat_mine was used with solidity-coverage (issue #​2467)
  • Allow --version flag to be used when not in a Hardhat project directory (thanks @​brianpursley)
  • Fixed an OOM error during parallel compilation and added a --concurrency param to the compile task

v2.9.3: Hardhat v2.9.3

Compare Source

This release fixes a bug (#​2551) that was causing the output of hh node to not work by default. It also adds a new entry to the HRE, hre.userConfig, which contains the original user config before it's resolved.

v2.9.2: Hardhat v2.9.2

Compare Source

This is a small bug-fix release. It contains a fix to a problem that made the forking functionality stop working. If you are affected by it, please upgrade to this version.

Changelog

  • Fix a bug that would override mocha grep options within the test task
  • Fix a bug in Hardhat Network that prevented the forking functionality from working (#​2528)
  • Fixed bug (#​2352) preventing the disabling of node task logging via hardhat.config.js.

v2.9.1: Hardhat v2.9.1: MetaMask-related hang fix

Compare Source

This patch version contains a fix to an issue that made Hardhat Network hang and eventually crash when connecting MetaMask to it (#​2380)

Changelog

  • Fix a bug that made Hardhat Network hang when connecting MetaMask (#​2380)

v2.9.0: Hardhat v2.9.0: performance improvements

Compare Source

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 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 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.

Parallel Solidity compilation

Starting from this version, files are now compiled in parallel if possible. A typical scenario where this can produce significant speedups is a project that uses multiple compiler versions.

Other changes

  • Added support for BIP39 passphrases (thanks @​zhuqicn!)
  • Preserve any existing user's README when initializing a project (#​1942)
  • The test task now works correctly when a test file starts with ./ (#​2220)
  • A warning is now shown when a node version greater than the current LTS is

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.8.0 chore(deps): update dependency hardhat to v2.8.1 Jan 6, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.8.1 chore(deps): update dependency hardhat to v2.8.2 Jan 7, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.8.2 chore(deps): update dependency hardhat to v2.8.3 Jan 19, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.8.3 chore(deps): update dependency hardhat to v2.8.4 Feb 10, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.8.4 chore(deps): update dependency hardhat to v2.9.0 Mar 1, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.9.0 chore(deps): update dependency hardhat to v2.9.1 Mar 4, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.9.1 chore(deps): update dependency hardhat to v2.9.2 Mar 26, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.9.2 chore(deps): update dependency hardhat to v2.9.3 Apr 25, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.9.3 chore(deps): update dependency hardhat to v2.9.5 May 16, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.9.5 chore(deps): update dependency hardhat to v2.9.9 Jun 18, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.9.9 chore(deps): update dependency hardhat to v2.11.2 Sep 25, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.11.2 chore(deps): update dependency hardhat to v2.12.2 Nov 20, 2022
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.12.2 chore(deps): update dependency hardhat to v2.13.0 Mar 16, 2023
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.13.0 chore(deps): update dependency hardhat to v2.14.0 Apr 17, 2023
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.14.0 chore(deps): update dependency hardhat to v2.14.1 Jun 1, 2023
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.19.0 chore(deps): update dependency hardhat to v2.19.1 Nov 15, 2023
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.19.1 chore(deps): update dependency hardhat to v2.19.2 Dec 5, 2023
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.19.2 chore(deps): update dependency hardhat to v2.19.3 Dec 19, 2023
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.19.3 chore(deps): update dependency hardhat to v2.19.4 Dec 26, 2023
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.19.4 chore(deps): update dependency hardhat to v2.19.5 Jan 30, 2024
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.19.5 chore(deps): update dependency hardhat to v2.20.0 Feb 14, 2024
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.20.0 chore(deps): update dependency hardhat to v2.20.1 Feb 15, 2024
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.20.1 chore(deps): update dependency hardhat to v2.21.0 Mar 4, 2024
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.21.0 chore(deps): update dependency hardhat to v2.22.0 Mar 14, 2024
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.22.0 chore(deps): update dependency hardhat to v2.22.1 Mar 14, 2024
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.22.1 chore(deps): update dependency hardhat to v2.22.2 Mar 21, 2024
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.22.2 chore(deps): update dependency hardhat to v2.22.3 Apr 17, 2024
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.22.3 chore(deps): update dependency hardhat to v2.22.4 May 14, 2024
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.22.4 chore(deps): update dependency hardhat to v2.22.5 Jun 3, 2024
@renovate renovate bot changed the title chore(deps): update dependency hardhat to v2.22.5 chore(deps): update dependency hardhat to v2.22.6 Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

0 participants