hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.

OTHER License

Downloads
1.5M
Stars
7.2K
Committers
373

Bot releases are hidden (Show)

hardhat - @nomicfoundation/[email protected]

Published by alcuadrado over 2 years ago

A small release fixing how the toolbox resolves the default config of hardhat-gas-reporter.

What's Changed

hardhat - @nomicfoundation/[email protected]

Published by alcuadrado over 2 years ago

This is a small patch release fixing a bug in one of our new chai matchers.

Changelog

hardhat - Hardhat 2.10.0: A refreshed experience

Published by alcuadrado over 2 years ago

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("@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
hardhat - Hardhat v2.9.9

Published by fvictorio over 2 years ago

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

hardhat - @nomiclabs/hardhat-etherscan v3.1.0

Published by fvictorio over 2 years ago

This release adds support for verifying contracts in chains that are not included by default in hardhat-etherscan.

To do this, you add the network you want to verify in the customChains entry of the Etherscan configuration:

etherscan: {
  apiKey: {
    customNetwork: "<custom-network-api-key>"
  },
  customChains: [
    {
      network: "customNetwork",
      chainId: 12345,
      urls: {
        apiURL: "https://api-custom-network.etherscan.io/api",
        browserURL: "https://custom-network.etherscan.io"
      }
    }
  ]
}

You can read more about this here.

Thanks to @no2chem for the initial implementation and to @calvinaco who helped test this.

hardhat - Hardhat v2.9.8

Published by fvictorio over 2 years ago

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.

hardhat - @nomiclabs/hardhat-etherscan v3.0.4

Published by fvictorio over 2 years ago

This release adds support for verifying contracts in the Sepolia testnet (thanks @pcaversaccio!)

hardhat - Hardhat v2.9.7

Published by fvictorio over 2 years ago

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

hardhat - Hardhat v2.9.6

Published by fvictorio over 2 years ago

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!)

hardhat - Hardhat v2.9.5

Published by fvictorio over 2 years ago

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

hardhat - Hardhat v2.9.4

Published by fvictorio over 2 years ago

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
hardhat - @nomiclabs/hardhat-truffle5 v2.0.6

Published by fvictorio over 2 years ago

  • b9f997cb: Upgraded ethereumjs dependencies (thanks @LogvinovLeon!).
hardhat - @nomiclabs/hardhat-truffle4 v2.0.5

Published by fvictorio over 2 years ago

  • b9f997cb: Upgraded ethereumjs dependencies (thanks @LogvinovLeon!).
hardhat - @nomiclabs/hardhat-ethers v2.0.6

Published by fvictorio over 2 years ago

  • 7403ec1d: Stop publishing tsconfig.json files
hardhat - Hardhat v2.9.3

Published by fvictorio over 2 years ago

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.

hardhat - Hardhat v2.9.2

Published by alcuadrado over 2 years ago

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.
hardhat - Hardhat v2.9.1: MetaMask-related hang fix

Published by alcuadrado over 2 years ago

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)
hardhat - @nomiclabs/hardhat-etherscan v3.0.3

Published by alcuadrado over 2 years ago

This is a small patch release fixing an error introduced in v3.0.2

Changelog

  • Added Content-Type header to hardhat-etherscan's request for verifying contracts, in order to fix #2437.
hardhat - Hardhat v2.9.0: performance improvements

Published by alcuadrado over 2 years ago

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 used.
hardhat - @nomiclabs/hardhat-solpp v2.0.1

Published by alcuadrado over 2 years ago

This release upgrades solpp in this plugin.

Changelog

  • Upgraded the solpp dependency in hardhat-solpp (#1412) — thanks @davidtperk!