Skip to content

Commit cd33a67

Browse files
committed
Merge branch 'main' into edr/main
2 parents 042c238 + 2a280a7 commit cd33a67

File tree

165 files changed

+3235
-1234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+3235
-1234
lines changed

.changeset/beige-ladybugs-confess.md

-5
This file was deleted.

.changeset/dry-pianos-scream.md

-5
This file was deleted.

.changeset/modern-fishes-look.md

-5
This file was deleted.

.github/workflows/autoassign-issues.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
script: |
1616
// each user has a chance of (p - (previousP ?? 0)) to be assigned
1717
const potentialAssignees = [
18-
["fvictorio", 0.5],
19-
["schaable", 0.75],
18+
["kanej", 1/3],
19+
["schaable", 2/3],
2020
["ChristopherDedominici", 1.0],
2121
];
2222

.github/workflows/autoassign-prs.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: PR autoassignment
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
7+
jobs:
8+
assign-new-issue:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: write
12+
steps:
13+
- uses: actions/github-script@v6
14+
with:
15+
script: |
16+
const externalPrTriager = "kanej";
17+
18+
// Within the Github API PRs are issue objects
19+
const pr = await github.rest.issues.get({
20+
owner: context.issue.owner,
21+
repo: context.issue.repo,
22+
issue_number: context.issue.number
23+
});
24+
25+
const isCollaborator = ["OWNER", "MEMBER", "COLLABORATOR"].includes(pr.data.author_association)
26+
27+
if (isCollaborator) {
28+
return
29+
}
30+
31+
await github.rest.issues.addAssignees({
32+
owner: context.issue.owner,
33+
repo: context.issue.repo,
34+
issue_number: context.issue.number,
35+
assignees: [externalPrTriager],
36+
});

.github/workflows/e2e-tests.yml

+10
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ jobs:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
1616
name: Run E2E tests on ${{ matrix.os }}
1717
runs-on: ${{ matrix.os }}
18+
env:
19+
# TODO: the e2e tests fail on windows when pnpm is used,
20+
# for what we think is a bug in pnpm. We set this env
21+
# variable to skip that combination until we find a solution.
22+
#
23+
# The failure is caused by `pnpm hardhat init` executing
24+
# `hardhat init` twice on windows, which results in the
25+
# second execution failing because `hardhat init` cannot
26+
# be run on an existing project.
27+
IS_WINDOWS: ${{ matrix.os == 'windows-latest' }}
1828
steps:
1929
- uses: actions/checkout@v2
2030
- uses: pnpm/action-setup@v2

.github/workflows/hardhat-network-helpers-ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ on:
44
push:
55
branches: [$default-branch]
66
paths:
7+
- "packages/hardhat-core/**"
78
- "packages/hardhat-network-helpers/**"
89
- "packages/hardhat-common/**"
910
- "config/**"
1011
pull_request:
1112
branches:
1213
- "**"
1314
paths:
15+
- "packages/hardhat-core/**"
1416
- "packages/hardhat-network-helpers/**"
1517
- "packages/hardhat-common/**"
1618
- "config/**"

.github/workflows/release.yml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
release:
1010
name: Release
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
1215
steps:
1316
- name: Checkout Repo
1417
uses: actions/checkout@v2

.github/workflows/test-slow-imports-rule.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install
3333
run: pnpm install --frozen-lockfile --prefer-offline
3434
- name: Add slow import
35-
run: echo 'import "lodash";' >> src/internal/constants.ts
35+
run: echo 'import "lodash";' >> src/internal/core/config/config-resolution.ts
3636
- name: Build
3737
run: pnpm build
3838
- name: Run eslint

config/eslint/constants.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module.exports.slowImportsCommonIgnoredModules = [
77
"source-map-support/register",
88
"@nomicfoundation/hardhat-ethers",
99
"hardhat/common",
10+
"hardhat/common/bigInt",
1011
"hardhat/config",
1112
"hardhat/plugins",
1213
"hardhat/types",

docs/.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
ignore-workspace-root-check=true
2+
enable-pre-post-scripts=true

docs/src/content/hardhat-network/docs/reference/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- grayGlacier
1414
- merge
1515
- shanghai
16+
- cancun
1617

1718
## Config
1819

@@ -65,7 +66,7 @@ The block gas limit to use in Hardhat Network's blockchain. Default value: `30_0
6566

6667
#### `hardfork`
6768

68-
This setting changes how Hardhat Network works, to mimic Ethereum's mainnet at a given hardfork. It must be one of `"byzantium"`, `"constantinople"`, `"petersburg"`, `"istanbul"`, `"muirGlacier"`, `"berlin"`, `"london"`, `"arrowGlacier"`, `"grayGlacier"`, `"merge"` and `"shanghai"`. Default value: `"shanghai"`
69+
This setting changes how Hardhat Network works, to mimic Ethereum's mainnet at a given hardfork. It must be one of `"byzantium"`, `"constantinople"`, `"petersburg"`, `"istanbul"`, `"muirGlacier"`, `"berlin"`, `"london"`, `"arrowGlacier"`, `"grayGlacier"`, `"merge"`, `"shanghai"` and `"cancun"`. Default value: `"shanghai"`
6970

7071
#### `throwOnTransactionFailures`
7172

docs/src/content/hardhat-runner/docs/advanced/create-task.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ npm install --save-dev @nomicfoundation/hardhat-toolbox
6363
:::tab{value="npm 6"}
6464

6565
```
66-
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
66+
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
6767
```
6868

6969
:::
7070

7171
:::tab{value="yarn"}
7272

7373
```
74-
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
74+
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
7575
```
7676

7777
:::

docs/src/content/hardhat-runner/docs/advanced/hardhat-and-foundry.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -78,30 +78,30 @@ If you have an existing Foundry project and you want to use Hardhat in it, follo
7878

7979
First, if you don't have a `package.json` already in your project, create one with `npm init`.
8080

81-
Then install Hardhat and the [`@nomicfoundation/hardhat-foundry`](/hardhat-runner/plugins/nomicfoundation-hardhat-foundry) plugin:
81+
Then install Hardhat, the [Hardhat Toolbox](/hardhat-runner/plugins/nomicfoundation-hardhat-toolbox), and the [`@nomicfoundation/hardhat-foundry`](/hardhat-runner/plugins/nomicfoundation-hardhat-foundry) plugin:
8282

8383
::::tabsgroup{options="npm 7+,npm 6,yarn"}
8484

8585
:::tab{value="npm 7+"}
8686

8787
```
88-
npm install --save-dev hardhat @nomicfoundation/hardhat-foundry
88+
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-foundry
8989
```
9090

9191
:::
9292

9393
:::tab{value="npm 6"}
9494

9595
```
96-
npm install --save-dev hardhat @nomicfoundation/hardhat-foundry
96+
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-foundry
9797
```
9898

9999
:::
100100

101101
:::tab{value=yarn}
102102

103103
```
104-
yarn add --dev hardhat @nomicfoundation/hardhat-foundry
104+
yarn add --dev hardhat @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-foundry
105105
```
106106

107107
:::
@@ -111,6 +111,7 @@ yarn add --dev hardhat @nomicfoundation/hardhat-foundry
111111
After that, initialize a Hardhat project with `npx hardhat init`. Choose the "Create an empty hardhat.config.js" option, and then import the plugin in `hardhat.config.js`:
112112

113113
```javascript
114+
require("@nomicfoundation/hardhat-toolbox");
114115
require("@nomicfoundation/hardhat-foundry");
115116
```
116117

docs/src/content/hardhat-runner/docs/advanced/migrating-from-hardhat-waffle.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ Follow these steps to migrate your project to Hardhat Toolbox.
1717
:::tab{value="npm 7+"}
1818

1919
```
20-
npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
20+
npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
2121
```
2222

2323
:::
2424

2525
:::tab{value="npm 6"}
2626

2727
```
28-
npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
28+
npm uninstall @nomiclabs/hardhat-waffle ethereum-waffle @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v5 @ethersproject/abi @ethersproject/providers
2929
```
3030

3131
:::
@@ -55,15 +55,15 @@ Follow these steps to migrate your project to Hardhat Toolbox.
5555
:::tab{value="npm 6"}
5656

5757
```
58-
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
58+
npm install --save-dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers @nomicfoundation/hardhat-ethers @nomicfoundation/hardhat-verify chai@4 ethers hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
5959
```
6060

6161
:::
6262

6363
:::tab{value="yarn"}
6464

6565
```
66-
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers@1 @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai ethers@5 hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
66+
yarn add --dev @nomicfoundation/hardhat-toolbox @nomicfoundation/hardhat-network-helpers @nomicfoundation/hardhat-chai-matchers@1 @nomiclabs/hardhat-ethers @nomiclabs/hardhat-etherscan chai@4 ethers@5 hardhat-gas-reporter solidity-coverage @typechain/hardhat typechain @typechain/ethers-v6
6767
```
6868

6969
:::

docs/src/content/hardhat-runner/docs/advanced/multiple-solidity-versions.md

+6
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,9 @@ Keep in mind that:
4242

4343
- Overrides are full compiler configurations, so if you have any additional settings you're using you should set them for the override as well.
4444
- You have to use forward slashes (`/`) even if you are on Windows.
45+
46+
:::tip
47+
48+
Hardhat also provides a way to use a custom Solidity compiler. Learn more from the [Using a custom Solidity compiler guide](/hardhat-runner/docs/other-guides/using-custom-solc.md).
49+
50+
:::

docs/src/content/hardhat-runner/docs/guides/typescript.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,23 @@ To be able to write your tests in TypeScript, you also need these packages:
5353
:::tab{value="npm 7+"}
5454

5555
```
56-
npm install --save-dev chai @types/node @types/mocha @types/chai
56+
npm install --save-dev chai@4 @types/node @types/mocha @types/chai@4
5757
```
5858

5959
:::
6060

6161
:::tab{value="npm 6"}
6262

6363
```
64-
npm install --save-dev chai @types/node @types/mocha @types/chai
64+
npm install --save-dev chai@4 @types/node @types/mocha @types/chai@4
6565
```
6666

6767
:::
6868

6969
:::tab{value=yarn}
7070

7171
```
72-
yarn add --dev chai @types/node @types/mocha @types/chai
72+
yarn add --dev chai@4 @types/node @types/mocha @types/chai@4
7373
```
7474

7575
:::
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Using a custom Solidity compiler
2+
3+
To use a custom, local version of the Solidity compiler, you need to override the `TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD` subtask in your Hardhat config.
4+
5+
This subtask returns an object with four properties:
6+
7+
- `compilerPath`: the path to the compiler
8+
- `isSolcJs`: a flag indicating if the compiler is a javascript module or a native binary
9+
- `version`: the short version of the compiler (for example, `0.8.24`)
10+
- `longVersion`: the long version of the compiler (for example, `0.8.24+commit.e11b9ed9`). This property is used as extra metadata in the build-info files, so you shouldn't worry too much about its value.
11+
12+
Here is an example to override the [wasm solc build for version `0.8.24`](https://binaries.soliditylang.org/wasm/soljson-v0.8.24+commit.e11b9ed9.js). Before proceeding, ensure you download the required solc binary to the root of your hardhat project.
13+
14+
::::tabsgroup{options="TypeScript,JavaScript"}
15+
16+
:::tab{value="TypeScript"}
17+
18+
```ts
19+
// hardhat.config.js
20+
import { HardhatUserConfig, subtask } from "hardhat/config";
21+
22+
const {
23+
TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD,
24+
} = require("hardhat/builtin-tasks/task-names");
25+
const path = require("path");
26+
27+
subtask(
28+
TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD,
29+
async (
30+
args: {
31+
solcVersion: string;
32+
},
33+
hre,
34+
runSuper
35+
) => {
36+
if (args.solcVersion === "0.8.24") {
37+
const compilerPath = path.join(
38+
__dirname,
39+
"soljson-v0.8.24+commit.e11b9ed9.js"
40+
);
41+
42+
return {
43+
compilerPath,
44+
isSolcJs: true, // if you are using a native compiler, set this to false
45+
version: args.solcVersion,
46+
// This is used as extra information in the build-info files,
47+
// but other than that is not important
48+
longVersion: "0.8.24+commit.e11b9ed9",
49+
};
50+
}
51+
52+
// since we only want to override the compiler for version 0.8.24,
53+
// the runSuper function allows us to call the default subtask.
54+
return runSuper();
55+
}
56+
);
57+
58+
const config: HardhatUserConfig = {
59+
solidity: "0.8.24",
60+
};
61+
62+
export default config;
63+
```
64+
65+
:::
66+
67+
:::tab{value="JavaScript"}
68+
69+
```js
70+
// hardhat.config.js
71+
const {
72+
TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD,
73+
} = require("hardhat/builtin-tasks/task-names");
74+
const path = require("path");
75+
76+
subtask(TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD, async (args, hre, runSuper) => {
77+
if (args.solcVersion === "0.8.24") {
78+
const compilerPath = path.join(
79+
__dirname,
80+
"soljson-v0.8.24+commit.e11b9ed9.js"
81+
);
82+
83+
return {
84+
compilerPath,
85+
isSolcJs: true, // if you are using a native compiler, set this to false
86+
version: args.solcVersion,
87+
// This is used as extra information in the build-info files,
88+
// but other than that is not important
89+
longVersion: "0.8.24+commit.e11b9ed9",
90+
};
91+
}
92+
93+
// since we only want to override the compiler for version 0.8.24,
94+
// the runSuper function allows us to call the default subtask.
95+
return runSuper();
96+
});
97+
98+
module.exports = {
99+
solidity: "0.8.24",
100+
};
101+
```
102+
103+
:::
104+
105+
::::
106+
107+
Check our ["Creating a task" guide](/hardhat-runner/docs/advanced/create-task) to learn more about overriding tasks.

0 commit comments

Comments
 (0)