Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
OTHER License
Bot releases are hidden (Show)
Published by alcuadrado over 2 years ago
A small release fixing how the toolbox resolves the default config of hardhat-gas-reporter
.
Published by alcuadrado over 2 years ago
This is a small patch release fixing a bug in one of our new chai matchers.
revertedWithCustomError().withArgs()
bug by @alcuadrado in https://github.com/NomicFoundation/hardhat/pull/2909
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.
You can get our recommended setup by installing the @nomicfoundation/hardhat-toolbox
plugin.
When you use this plugin, you'll be able to:
hardhat-ethers
plugin.You can learn how to migrate to it here.
@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:
bigint
number
bigint
ethers.BigNumber
BN.js
.revertedWithPanic
, .revertedWithCustomError
, .revertedWithoutReason
.revertedWith
matches the exact string, not a substring.to.emit("A").and.to.emit("B")
was ignoring the first event completelyYou can learn more about it here.
@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.
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());
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.
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.
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.
Published by fvictorio over 2 years ago
This release adds support for verifying contracts in the Sepolia testnet (thanks @pcaversaccio!)
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.
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!)
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).
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.
eth_sendTransaction
, eth_sendRawTransaction
, eth_call
and eth_estimateGas
methods when they revert.lazyObject
or lazyFunction
(issue #1473, thanks @pcarranzav!)tsconfig.json
files (issue #2582)hardhat_mine
was used with solidity-coverage
(issue #2467)--version
flag to be used when not in a Hardhat project directory (thanks @brianpursley)--concurrency
param to the compile taskPublished by fvictorio over 2 years ago
Published by fvictorio over 2 years ago
Published by fvictorio over 2 years ago
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.
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.
hardhat.config.js
.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)
Published by alcuadrado over 2 years ago
This is a small patch release fixing an error introduced in v3.0.2
Content-Type
header to hardhat-etherscan
's request for verifying contracts, in order to fix #2437.Published by alcuadrado over 2 years ago
This release of Hardhat is packed with performance improvements:
hardhat_mine
).Read on to learn more about these and other changes
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.
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.
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.
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.
./
(#2220)Published by alcuadrado over 2 years ago
This release upgrades solpp
in this plugin.
solpp
dependency in hardhat-solpp
(#1412) — thanks @davidtperk!