hardhat 2.8.4 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -61
- package/README.md +1 -1
- package/builtin-tasks/compile.js +86 -51
- package/builtin-tasks/compile.js.map +1 -1
- package/builtin-tasks/node.js.map +1 -1
- package/builtin-tasks/test.js +30 -5
- package/builtin-tasks/test.js.map +1 -1
- package/builtin-tasks/utils/solidity-files-cache.d.ts.map +1 -1
- package/builtin-tasks/utils/solidity-files-cache.js.map +1 -1
- package/internal/cli/analytics.js +2 -2
- package/internal/cli/analytics.js.map +1 -1
- package/internal/cli/cli.js +3 -3
- package/internal/cli/project-creation.d.ts.map +1 -1
- package/internal/cli/project-creation.js +23 -0
- package/internal/cli/project-creation.js.map +1 -1
- package/internal/core/config/config-loading.d.ts.map +1 -1
- package/internal/core/config/config-loading.js.map +1 -1
- package/internal/core/config/config-validation.d.ts.map +1 -1
- package/internal/core/config/config-validation.js +2 -2
- package/internal/core/config/config-validation.js.map +1 -1
- package/internal/core/config/default-config.d.ts +2 -0
- package/internal/core/config/default-config.d.ts.map +1 -1
- package/internal/core/config/default-config.js +1 -0
- package/internal/core/config/default-config.js.map +1 -1
- package/internal/core/errors-list.d.ts +7 -0
- package/internal/core/errors-list.d.ts.map +1 -1
- package/internal/core/errors-list.js +13 -0
- package/internal/core/errors-list.js.map +1 -1
- package/internal/core/providers/accounts.d.ts +1 -1
- package/internal/core/providers/accounts.d.ts.map +1 -1
- package/internal/core/providers/accounts.js +2 -2
- package/internal/core/providers/accounts.js.map +1 -1
- package/internal/core/providers/construction.d.ts.map +1 -1
- package/internal/core/providers/construction.js +1 -1
- package/internal/core/providers/construction.js.map +1 -1
- package/internal/core/providers/http.d.ts +5 -1
- package/internal/core/providers/http.d.ts.map +1 -1
- package/internal/core/providers/http.js +35 -31
- package/internal/core/providers/http.js.map +1 -1
- package/internal/core/providers/util.d.ts +1 -1
- package/internal/core/providers/util.d.ts.map +1 -1
- package/internal/core/providers/util.js +3 -3
- package/internal/core/providers/util.js.map +1 -1
- package/internal/hardhat-network/jsonrpc/server.d.ts.map +1 -1
- package/internal/hardhat-network/jsonrpc/server.js +7 -2
- package/internal/hardhat-network/jsonrpc/server.js.map +1 -1
- package/internal/hardhat-network/provider/BlockchainBase.d.ts +26 -0
- package/internal/hardhat-network/provider/BlockchainBase.d.ts.map +1 -0
- package/internal/hardhat-network/provider/BlockchainBase.js +92 -0
- package/internal/hardhat-network/provider/BlockchainBase.js.map +1 -0
- package/internal/hardhat-network/provider/BlockchainData.d.ts +32 -0
- package/internal/hardhat-network/provider/BlockchainData.d.ts.map +1 -1
- package/internal/hardhat-network/provider/BlockchainData.js +78 -1
- package/internal/hardhat-network/provider/BlockchainData.js.map +1 -1
- package/internal/hardhat-network/provider/HardhatBlockchain.d.ts +9 -15
- package/internal/hardhat-network/provider/HardhatBlockchain.d.ts.map +1 -1
- package/internal/hardhat-network/provider/HardhatBlockchain.js +15 -73
- package/internal/hardhat-network/provider/HardhatBlockchain.js.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts +6 -14
- package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.js +23 -73
- package/internal/hardhat-network/provider/fork/ForkBlockchain.js.map +1 -1
- package/internal/hardhat-network/provider/modules/eth.js +2 -2
- package/internal/hardhat-network/provider/modules/eth.js.map +1 -1
- package/internal/hardhat-network/provider/modules/hardhat.d.ts +3 -0
- package/internal/hardhat-network/provider/modules/hardhat.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/hardhat.js +40 -5
- package/internal/hardhat-network/provider/modules/hardhat.js.map +1 -1
- package/internal/hardhat-network/provider/modules/logger.d.ts +4 -2
- package/internal/hardhat-network/provider/modules/logger.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/logger.js +38 -12
- package/internal/hardhat-network/provider/modules/logger.js.map +1 -1
- package/internal/hardhat-network/provider/node-types.d.ts +1 -1
- package/internal/hardhat-network/provider/node-types.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node.d.ts +9 -1
- package/internal/hardhat-network/provider/node.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node.js +57 -8
- package/internal/hardhat-network/provider/node.js.map +1 -1
- package/internal/hardhat-network/provider/provider.d.ts +1 -1
- package/internal/hardhat-network/provider/provider.d.ts.map +1 -1
- package/internal/hardhat-network/provider/provider.js.map +1 -1
- package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts +2 -1
- package/internal/hardhat-network/provider/types/HardhatBlockchainInterface.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/makeForkClient.d.ts.map +1 -1
- package/internal/hardhat-network/provider/utils/makeForkClient.js +2 -1
- package/internal/hardhat-network/provider/utils/makeForkClient.js.map +1 -1
- package/internal/hardhat-network/provider/utils/putGenesisBlock.js +1 -1
- package/internal/hardhat-network/stack-traces/debug.js +1 -1
- package/internal/hardhat-network/stack-traces/debug.js.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.js +21 -12
- package/internal/hardhat-network/stack-traces/error-inferrer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidity-errors.js +2 -2
- package/internal/hardhat-network/stack-traces/solidity-errors.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts +3 -2
- package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts.map +1 -1
- package/internal/solidity/compilation-job.d.ts.map +1 -1
- package/internal/solidity/compilation-job.js.map +1 -1
- package/internal/solidity/compiler/downloader.d.ts +2 -2
- package/internal/solidity/compiler/downloader.d.ts.map +1 -1
- package/internal/solidity/compiler/downloader.js +3 -3
- package/internal/solidity/compiler/downloader.js.map +1 -1
- package/internal/util/download.d.ts.map +1 -1
- package/internal/util/download.js +22 -24
- package/internal/util/download.js.map +1 -1
- package/internal/util/glob.d.ts.map +1 -1
- package/internal/util/glob.js.map +1 -1
- package/internal/util/global-dir.d.ts.map +1 -1
- package/internal/util/global-dir.js.map +1 -1
- package/internal/util/keys-derivation.d.ts +1 -1
- package/internal/util/keys-derivation.d.ts.map +1 -1
- package/internal/util/keys-derivation.js +2 -2
- package/internal/util/keys-derivation.js.map +1 -1
- package/package.json +10 -10
- package/sample-projects/advanced-ts/README.md +1 -1
- package/src/builtin-tasks/compile.ts +94 -76
- package/src/builtin-tasks/node.ts +2 -1
- package/src/builtin-tasks/test.ts +69 -11
- package/src/builtin-tasks/utils/solidity-files-cache.ts +3 -2
- package/src/internal/cli/analytics.ts +2 -2
- package/src/internal/cli/cli.ts +3 -3
- package/src/internal/cli/project-creation.ts +40 -0
- package/src/internal/core/config/config-loading.ts +2 -1
- package/src/internal/core/config/config-validation.ts +2 -0
- package/src/internal/core/config/default-config.ts +1 -0
- package/src/internal/core/errors-list.ts +13 -0
- package/src/internal/core/providers/accounts.ts +4 -2
- package/src/internal/core/providers/construction.ts +3 -1
- package/src/internal/core/providers/http.ts +47 -16
- package/src/internal/core/providers/util.ts +6 -3
- package/src/internal/hardhat-network/jsonrpc/server.ts +16 -3
- package/src/internal/hardhat-network/provider/BlockchainBase.ts +137 -0
- package/src/internal/hardhat-network/provider/BlockchainData.ts +144 -0
- package/src/internal/hardhat-network/provider/HardhatBlockchain.ts +34 -87
- package/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts +45 -90
- package/src/internal/hardhat-network/provider/modules/eth.ts +2 -2
- package/src/internal/hardhat-network/provider/modules/hardhat.ts +51 -5
- package/src/internal/hardhat-network/provider/modules/logger.ts +50 -14
- package/src/internal/hardhat-network/provider/node-types.ts +2 -2
- package/src/internal/hardhat-network/provider/node.ts +81 -8
- package/src/internal/hardhat-network/provider/provider.ts +9 -8
- package/src/internal/hardhat-network/provider/types/HardhatBlockchainInterface.ts +7 -1
- package/src/internal/hardhat-network/provider/utils/makeForkClient.ts +2 -1
- package/src/internal/hardhat-network/provider/utils/putGenesisBlock.ts +1 -1
- package/src/internal/hardhat-network/stack-traces/debug.ts +1 -1
- package/src/internal/hardhat-network/stack-traces/error-inferrer.ts +21 -13
- package/src/internal/hardhat-network/stack-traces/solidity-errors.ts +2 -2
- package/src/internal/hardhat-network/stack-traces/solidity-stack-trace.ts +3 -2
- package/src/internal/solidity/compilation-job.ts +2 -1
- package/src/internal/solidity/compiler/downloader.ts +5 -3
- package/src/internal/util/download.ts +26 -31
- package/src/internal/util/glob.ts +1 -0
- package/src/internal/util/global-dir.ts +2 -1
- package/src/internal/util/keys-derivation.ts +3 -2
- package/src/types/config.ts +4 -0
- package/types/config.d.ts +4 -0
- package/types/config.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/internal/util/glob.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/internal/util/glob.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,MAAM,CAAC;AAKpD,wBAAsB,IAAI,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,MAAM,EAAE,CAAC,CAInB;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,EAAE,CAG7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/internal/util/glob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/internal/util/glob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,2CAA6B;AAC7B,gDAAwB;AAEjB,KAAK,UAAU,IAAI,CACxB,OAAe,EACf,UAAuB,EAAE;IAEzB,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,wDAAa,MAAM,GAAC,CAAC;IACrD,MAAM,KAAK,GAAG,MAAM,cAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACnC,CAAC;AAPD,oBAOC;AAED,SAAgB,QAAQ,CAAC,OAAe,EAAE,UAAuB,EAAE;IACjE,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrD,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACnC,CAAC;AAHD,4BAGC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-dir.d.ts","sourceRoot":"","sources":["../../src/internal/util/global-dir.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"global-dir.d.ts","sourceRoot":"","sources":["../../src/internal/util/global-dir.ts"],"names":[],"mappings":"AA+BA,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAInD;AAED,wBAAsB,eAAe,gCAIpC;AAED;;GAEG;AACH,wBAAgB,0BAA0B,gCAGzC;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,gCAIhD;AAgBD,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,iBAatD;AAED,wBAAsB,eAAe,oBAKpC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,GAAG,SAAS,CAY3D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QAKrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-dir.js","sourceRoot":"","sources":["../../src/internal/util/global-d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@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export declare function deriveKeyFromMnemonicAndPath(mnemonic: string, hdPath: string): Buffer | undefined;
|
|
2
|
+
export declare function deriveKeyFromMnemonicAndPath(mnemonic: string, hdPath: string, passphrase: string): Buffer | undefined;
|
|
3
3
|
//# sourceMappingURL=keys-derivation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys-derivation.d.ts","sourceRoot":"","sources":["../../src/internal/util/keys-derivation.ts"],"names":[],"mappings":";AAGA,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"keys-derivation.d.ts","sourceRoot":"","sources":["../../src/internal/util/keys-derivation.ts"],"names":[],"mappings":";AAGA,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,SAAS,CAkBpB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deriveKeyFromMnemonicAndPath = void 0;
|
|
4
|
-
function deriveKeyFromMnemonicAndPath(mnemonic, hdPath) {
|
|
4
|
+
function deriveKeyFromMnemonicAndPath(mnemonic, hdPath, passphrase) {
|
|
5
5
|
const { mnemonicToSeedSync, } = require("ethereum-cryptography/bip39");
|
|
6
|
-
const seed = mnemonicToSeedSync(mnemonic);
|
|
6
|
+
const seed = mnemonicToSeedSync(mnemonic, passphrase);
|
|
7
7
|
const { HDKey, } = require("ethereum-cryptography/hdkey");
|
|
8
8
|
const masterKey = HDKey.fromMasterSeed(seed);
|
|
9
9
|
const derived = masterKey.derive(hdPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys-derivation.js","sourceRoot":"","sources":["../../src/internal/util/keys-derivation.ts"],"names":[],"mappings":";;;AAGA,SAAgB,4BAA4B,CAC1C,QAAgB,EAChB,MAAc;
|
|
1
|
+
{"version":3,"file":"keys-derivation.js","sourceRoot":"","sources":["../../src/internal/util/keys-derivation.ts"],"names":[],"mappings":";;;AAGA,SAAgB,4BAA4B,CAC1C,QAAgB,EAChB,MAAc,EACd,UAAkB;IAElB,MAAM,EACJ,kBAAkB,GACnB,GAEG,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAEtD,MAAM,EACJ,KAAK,GACN,GAEG,OAAO,CAAC,6BAA6B,CAAC,CAAC;IAE3C,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEzC,OAAO,OAAO,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;AACtE,CAAC;AAtBD,oEAsBC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hardhat",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"author": "Nomic Labs LLC",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"homepage": "https://hardhat.org",
|
|
7
7
|
"repository": "github:nomiclabs/hardhat",
|
|
8
8
|
"main": "internal/lib/hardhat-lib.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"hardhat": "internal/cli/cli.js"
|
|
24
24
|
},
|
|
25
25
|
"engines": {
|
|
26
|
-
"node": "^12.0.0 || ^14.0.0 ||
|
|
26
|
+
"node": "^12.0.0 || ^14.0.0 || ^16.0.0"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"lint": "yarn prettier --check && yarn eslint",
|
|
@@ -63,9 +63,8 @@
|
|
|
63
63
|
"@types/fs-extra": "^5.1.0",
|
|
64
64
|
"@types/glob": "^7.1.1",
|
|
65
65
|
"@types/lodash": "^4.14.123",
|
|
66
|
-
"@types/mocha": "^9.
|
|
66
|
+
"@types/mocha": "^9.1.0",
|
|
67
67
|
"@types/node": "^12.0.0",
|
|
68
|
-
"@types/node-fetch": "^2.3.7",
|
|
69
68
|
"@types/qs": "^6.5.3",
|
|
70
69
|
"@types/resolve": "^1.17.1",
|
|
71
70
|
"@types/semver": "^6.0.2",
|
|
@@ -81,7 +80,7 @@
|
|
|
81
80
|
"eslint-plugin-import": "2.24.1",
|
|
82
81
|
"eslint-plugin-prettier": "3.4.0",
|
|
83
82
|
"ethers": "^5.0.0",
|
|
84
|
-
"mocha": "^
|
|
83
|
+
"mocha": "^9.2.0",
|
|
85
84
|
"prettier": "2.4.1",
|
|
86
85
|
"proxy": "^1.0.2",
|
|
87
86
|
"rimraf": "^3.0.2",
|
|
@@ -99,11 +98,12 @@
|
|
|
99
98
|
"@ethersproject/abi": "^5.1.2",
|
|
100
99
|
"@metamask/eth-sig-util": "^4.0.0",
|
|
101
100
|
"@sentry/node": "^5.18.1",
|
|
102
|
-
"@solidity-parser/parser": "^0.14.
|
|
101
|
+
"@solidity-parser/parser": "^0.14.1",
|
|
103
102
|
"@types/bn.js": "^5.1.0",
|
|
104
103
|
"@types/lru-cache": "^5.1.0",
|
|
105
104
|
"abort-controller": "^3.0.0",
|
|
106
105
|
"adm-zip": "^0.4.16",
|
|
106
|
+
"aggregate-error": "^3.0.0",
|
|
107
107
|
"ansi-escapes": "^4.3.0",
|
|
108
108
|
"chalk": "^2.4.2",
|
|
109
109
|
"chokidar": "^3.4.0",
|
|
@@ -118,14 +118,13 @@
|
|
|
118
118
|
"fp-ts": "1.19.3",
|
|
119
119
|
"fs-extra": "^7.0.1",
|
|
120
120
|
"glob": "^7.1.3",
|
|
121
|
-
"https-proxy-agent": "^5.0.0",
|
|
122
121
|
"immutable": "^4.0.0-rc.12",
|
|
123
122
|
"io-ts": "1.10.4",
|
|
124
123
|
"lodash": "^4.17.11",
|
|
125
124
|
"merkle-patricia-tree": "^4.2.2",
|
|
126
125
|
"mnemonist": "^0.38.0",
|
|
127
|
-
"mocha": "^
|
|
128
|
-
"
|
|
126
|
+
"mocha": "^9.2.0",
|
|
127
|
+
"p-map": "^4.0.0",
|
|
129
128
|
"qs": "^6.7.0",
|
|
130
129
|
"raw-body": "^2.4.1",
|
|
131
130
|
"resolve": "1.17.0",
|
|
@@ -136,6 +135,7 @@
|
|
|
136
135
|
"stacktrace-parser": "^0.1.10",
|
|
137
136
|
"true-case-path": "^2.2.1",
|
|
138
137
|
"tsort": "0.0.1",
|
|
138
|
+
"undici": "^4.14.1",
|
|
139
139
|
"uuid": "^8.3.2",
|
|
140
140
|
"ws": "^7.4.6"
|
|
141
141
|
},
|
|
@@ -32,7 +32,7 @@ To try out Etherscan verification, you first need to deploy a contract to an Eth
|
|
|
32
32
|
In this project, copy the .env.example file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract:
|
|
33
33
|
|
|
34
34
|
```shell
|
|
35
|
-
hardhat run --network ropsten scripts/
|
|
35
|
+
hardhat run --network ropsten scripts/deploy.ts
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
Then, copy the deployment address and paste it in to replace `DEPLOYED_CONTRACT_ADDRESS` in this command:
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import os from "os";
|
|
1
2
|
import chalk from "chalk";
|
|
2
3
|
import { exec } from "child_process";
|
|
3
4
|
import debug from "debug";
|
|
4
5
|
import fsExtra from "fs-extra";
|
|
5
6
|
import path from "path";
|
|
6
7
|
import semver from "semver";
|
|
8
|
+
import AggregateError from "aggregate-error";
|
|
7
9
|
|
|
8
10
|
import {
|
|
9
11
|
Artifacts as ArtifactsImpl,
|
|
@@ -379,39 +381,92 @@ subtask(TASK_COMPILE_SOLIDITY_COMPILE_JOBS)
|
|
|
379
381
|
return { artifactsEmittedPerJob: [] };
|
|
380
382
|
}
|
|
381
383
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
384
|
+
const { default: pMap } = await import("p-map");
|
|
385
|
+
|
|
386
|
+
log(`Compiling ${compilationJobs.length} jobs`);
|
|
387
|
+
|
|
388
|
+
const versionList: string[] = [];
|
|
389
|
+
for (const job of compilationJobs) {
|
|
390
|
+
const solcVersion = job.getSolcConfig().version;
|
|
391
|
+
|
|
392
|
+
if (!versionList.includes(solcVersion)) {
|
|
393
|
+
// versions older than 0.4.11 don't work with hardhat
|
|
394
|
+
// see issue https://github.com/nomiclabs/hardhat/issues/2004
|
|
395
|
+
if (
|
|
396
|
+
semver.lt(solcVersion, COMPILE_TASK_FIRST_SOLC_VERSION_SUPPORTED)
|
|
397
|
+
) {
|
|
398
|
+
throw new HardhatError(
|
|
399
|
+
ERRORS.BUILTIN_TASKS.COMPILE_TASK_UNSUPPORTED_SOLC_VERSION,
|
|
400
|
+
{
|
|
401
|
+
version: solcVersion,
|
|
402
|
+
firstSupportedVersion:
|
|
403
|
+
COMPILE_TASK_FIRST_SOLC_VERSION_SUPPORTED,
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
}
|
|
391
407
|
|
|
392
|
-
|
|
408
|
+
versionList.push(solcVersion);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
393
411
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
412
|
+
/**
|
|
413
|
+
* Downloading the same version of a compiler in parallel can cause an
|
|
414
|
+
* error. When compilation jobs are executed in parallel, there's a chance
|
|
415
|
+
* that both use the same solc version and trigger this problem. To
|
|
416
|
+
* prevent that, we pre-download all the necessary compilers before
|
|
417
|
+
* running the compilation jobs.
|
|
418
|
+
*/
|
|
419
|
+
for (const solcVersion of versionList) {
|
|
420
|
+
await run(TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD, {
|
|
421
|
+
solcVersion,
|
|
422
|
+
quiet: false,
|
|
423
|
+
});
|
|
424
|
+
}
|
|
397
425
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
426
|
+
const pMapOptions = { concurrency: os.cpus().length, stopOnError: false };
|
|
427
|
+
try {
|
|
428
|
+
const results = await pMap(
|
|
429
|
+
compilationJobs,
|
|
430
|
+
(compilationJob, compilationJobIndex) => {
|
|
431
|
+
return run(TASK_COMPILE_SOLIDITY_COMPILE_JOB, {
|
|
432
|
+
compilationJob,
|
|
433
|
+
compilationJobs,
|
|
434
|
+
compilationJobIndex,
|
|
435
|
+
quiet,
|
|
436
|
+
});
|
|
437
|
+
},
|
|
438
|
+
pMapOptions
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
const artifactsEmittedPerJob: ArtifactsEmittedPerJob = results.map(
|
|
442
|
+
({ compilationJob, artifactsEmittedPerFile }) => ({
|
|
401
443
|
compilationJob,
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
quiet,
|
|
405
|
-
}
|
|
444
|
+
artifactsEmittedPerFile,
|
|
445
|
+
})
|
|
406
446
|
);
|
|
407
447
|
|
|
408
|
-
artifactsEmittedPerJob
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
448
|
+
return { artifactsEmittedPerJob };
|
|
449
|
+
} catch (e) {
|
|
450
|
+
if (!(e instanceof AggregateError)) {
|
|
451
|
+
// eslint-disable-next-line @nomiclabs/hardhat-internal-rules/only-hardhat-error
|
|
452
|
+
throw e;
|
|
453
|
+
}
|
|
413
454
|
|
|
414
|
-
|
|
455
|
+
for (const error of e) {
|
|
456
|
+
if (
|
|
457
|
+
!HardhatError.isHardhatErrorType(
|
|
458
|
+
error,
|
|
459
|
+
ERRORS.BUILTIN_TASKS.COMPILE_FAILURE
|
|
460
|
+
)
|
|
461
|
+
) {
|
|
462
|
+
// eslint-disable-next-line @nomiclabs/hardhat-internal-rules/only-hardhat-error
|
|
463
|
+
throw error;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// error is an aggregate error, and all errors are compilation failures
|
|
468
|
+
throw new HardhatError(ERRORS.BUILTIN_TASKS.COMPILE_FAILURE);
|
|
469
|
+
}
|
|
415
470
|
}
|
|
416
471
|
);
|
|
417
472
|
|
|
@@ -646,18 +701,6 @@ subtask(TASK_COMPILE_SOLIDITY_COMPILE_SOLC)
|
|
|
646
701
|
},
|
|
647
702
|
{ run }
|
|
648
703
|
): Promise<{ output: CompilerOutput; solcBuild: SolcBuild }> => {
|
|
649
|
-
// versions older than 0.4.11 don't work with hardhat
|
|
650
|
-
// see issue https://github.com/nomiclabs/hardhat/issues/2004
|
|
651
|
-
if (semver.lt(solcVersion, COMPILE_TASK_FIRST_SOLC_VERSION_SUPPORTED)) {
|
|
652
|
-
throw new HardhatError(
|
|
653
|
-
ERRORS.BUILTIN_TASKS.COMPILE_TASK_UNSUPPORTED_SOLC_VERSION,
|
|
654
|
-
{
|
|
655
|
-
version: solcVersion,
|
|
656
|
-
firstSupportedVersion: COMPILE_TASK_FIRST_SOLC_VERSION_SUPPORTED,
|
|
657
|
-
}
|
|
658
|
-
);
|
|
659
|
-
}
|
|
660
|
-
|
|
661
704
|
const solcBuild: SolcBuild = await run(
|
|
662
705
|
TASK_COMPILE_SOLIDITY_GET_SOLC_BUILD,
|
|
663
706
|
{
|
|
@@ -870,45 +913,11 @@ subtask(TASK_COMPILE_SOLIDITY_LOG_RUN_COMPILER_START)
|
|
|
870
913
|
.addParam("compilationJobIndex", undefined, undefined, types.int)
|
|
871
914
|
.addParam("quiet", undefined, undefined, types.boolean)
|
|
872
915
|
.setAction(
|
|
873
|
-
async ({
|
|
874
|
-
compilationJobs,
|
|
875
|
-
compilationJobIndex,
|
|
876
|
-
}: {
|
|
916
|
+
async ({}: {
|
|
877
917
|
compilationJob: CompilationJob;
|
|
878
918
|
compilationJobs: CompilationJob[];
|
|
879
919
|
compilationJobIndex: number;
|
|
880
|
-
}) => {
|
|
881
|
-
const solcVersion =
|
|
882
|
-
compilationJobs[compilationJobIndex].getSolcConfig().version;
|
|
883
|
-
|
|
884
|
-
// we log if this is the first job, or if the previous job has a
|
|
885
|
-
// different solc version
|
|
886
|
-
const shouldLog =
|
|
887
|
-
compilationJobIndex === 0 ||
|
|
888
|
-
compilationJobs[compilationJobIndex - 1].getSolcConfig().version !==
|
|
889
|
-
solcVersion;
|
|
890
|
-
|
|
891
|
-
if (!shouldLog) {
|
|
892
|
-
return;
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
// count how many files emit artifacts for this version
|
|
896
|
-
let count = 0;
|
|
897
|
-
for (let i = compilationJobIndex; i < compilationJobs.length; i++) {
|
|
898
|
-
const job = compilationJobs[i];
|
|
899
|
-
if (job.getSolcConfig().version !== solcVersion) {
|
|
900
|
-
break;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
count += job
|
|
904
|
-
.getResolvedFiles()
|
|
905
|
-
.filter((file) => job.emitsArtifacts(file)).length;
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
console.log(
|
|
909
|
-
`Compiling ${count} ${pluralize(count, "file")} with ${solcVersion}`
|
|
910
|
-
);
|
|
911
|
-
}
|
|
920
|
+
}) => {}
|
|
912
921
|
);
|
|
913
922
|
|
|
914
923
|
/**
|
|
@@ -1257,8 +1266,17 @@ subtask(TASK_COMPILE_SOLIDITY_LOG_COMPILATION_RESULT)
|
|
|
1257
1266
|
.addParam("quiet", undefined, undefined, types.boolean)
|
|
1258
1267
|
.setAction(
|
|
1259
1268
|
async ({ compilationJobs }: { compilationJobs: CompilationJob[] }) => {
|
|
1260
|
-
|
|
1261
|
-
|
|
1269
|
+
let count = 0;
|
|
1270
|
+
for (const job of compilationJobs) {
|
|
1271
|
+
count += job
|
|
1272
|
+
.getResolvedFiles()
|
|
1273
|
+
.filter((file) => job.emitsArtifacts(file)).length;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
if (count > 0) {
|
|
1277
|
+
console.log(
|
|
1278
|
+
`Compiled ${count} Solidity ${pluralize(count, "file")} successfully`
|
|
1279
|
+
);
|
|
1262
1280
|
}
|
|
1263
1281
|
}
|
|
1264
1282
|
);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { MochaOptions } from "mocha";
|
|
2
|
+
|
|
1
3
|
import chalk from "chalk";
|
|
2
4
|
import path from "path";
|
|
3
5
|
|
|
@@ -26,7 +28,11 @@ subtask(TASK_TEST_GET_TEST_FILES)
|
|
|
26
28
|
)
|
|
27
29
|
.setAction(async ({ testFiles }: { testFiles: string[] }, { config }) => {
|
|
28
30
|
if (testFiles.length !== 0) {
|
|
29
|
-
|
|
31
|
+
const testFilesAbsolutePaths = testFiles.map((x) =>
|
|
32
|
+
path.resolve(process.cwd(), x)
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return testFilesAbsolutePaths;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
const jsFiles = await glob(path.join(config.paths.tests, "**/*.js"));
|
|
@@ -43,24 +49,61 @@ subtask(TASK_TEST_GET_TEST_FILES)
|
|
|
43
49
|
subtask(TASK_TEST_SETUP_TEST_ENVIRONMENT, async () => {});
|
|
44
50
|
|
|
45
51
|
subtask(TASK_TEST_RUN_MOCHA_TESTS)
|
|
52
|
+
.addFlag("parallel", "Run tests in parallel")
|
|
53
|
+
.addFlag("bail", "Stop running tests after the first test failure")
|
|
54
|
+
.addOptionalParam(
|
|
55
|
+
"grep",
|
|
56
|
+
"Only run tests matching the given string or regexp"
|
|
57
|
+
)
|
|
46
58
|
.addOptionalVariadicPositionalParam(
|
|
47
59
|
"testFiles",
|
|
48
60
|
"An optional list of files to test",
|
|
49
61
|
[]
|
|
50
62
|
)
|
|
51
|
-
.setAction(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
.setAction(
|
|
64
|
+
async (
|
|
65
|
+
taskArgs: {
|
|
66
|
+
bail: boolean;
|
|
67
|
+
parallel: boolean;
|
|
68
|
+
testFiles: string[];
|
|
69
|
+
grep?: string;
|
|
70
|
+
},
|
|
71
|
+
{ config }
|
|
72
|
+
) => {
|
|
73
|
+
const { default: Mocha } = await import("mocha");
|
|
55
74
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
75
|
+
const mochaConfig: MochaOptions = {
|
|
76
|
+
...config.mocha,
|
|
77
|
+
grep: taskArgs.grep,
|
|
78
|
+
};
|
|
59
79
|
|
|
60
|
-
|
|
80
|
+
if (taskArgs.bail) {
|
|
81
|
+
mochaConfig.bail = true;
|
|
82
|
+
}
|
|
83
|
+
if (taskArgs.parallel) {
|
|
84
|
+
mochaConfig.parallel = true;
|
|
85
|
+
}
|
|
61
86
|
|
|
62
|
-
|
|
63
|
-
|
|
87
|
+
if (mochaConfig.parallel === true) {
|
|
88
|
+
const mochaRequire = mochaConfig.require ?? [];
|
|
89
|
+
if (!mochaRequire.includes("hardhat/register")) {
|
|
90
|
+
mochaRequire.push("hardhat/register");
|
|
91
|
+
}
|
|
92
|
+
mochaConfig.require = mochaRequire;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const mocha = new Mocha(mochaConfig);
|
|
96
|
+
taskArgs.testFiles.forEach((file) => mocha.addFile(file));
|
|
97
|
+
|
|
98
|
+
const testFailures = await new Promise<number>((resolve) => {
|
|
99
|
+
mocha.run(resolve);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
mocha.dispose();
|
|
103
|
+
|
|
104
|
+
return testFailures;
|
|
105
|
+
}
|
|
106
|
+
);
|
|
64
107
|
|
|
65
108
|
subtask(TASK_TEST_RUN_SHOW_FORK_RECOMMENDATIONS).setAction(
|
|
66
109
|
async (_, { config, network }) => {
|
|
@@ -80,14 +123,26 @@ task(TASK_TEST, "Runs mocha tests")
|
|
|
80
123
|
[]
|
|
81
124
|
)
|
|
82
125
|
.addFlag("noCompile", "Don't compile before running this task")
|
|
126
|
+
.addFlag("parallel", "Run tests in parallel")
|
|
127
|
+
.addFlag("bail", "Stop running tests after the first test failure")
|
|
128
|
+
.addOptionalParam(
|
|
129
|
+
"grep",
|
|
130
|
+
"Only run tests matching the given string or regexp"
|
|
131
|
+
)
|
|
83
132
|
.setAction(
|
|
84
133
|
async (
|
|
85
134
|
{
|
|
86
135
|
testFiles,
|
|
87
136
|
noCompile,
|
|
137
|
+
parallel,
|
|
138
|
+
bail,
|
|
139
|
+
grep,
|
|
88
140
|
}: {
|
|
89
141
|
testFiles: string[];
|
|
90
142
|
noCompile: boolean;
|
|
143
|
+
parallel: boolean;
|
|
144
|
+
bail: boolean;
|
|
145
|
+
grep?: string;
|
|
91
146
|
},
|
|
92
147
|
{ run, network }
|
|
93
148
|
) => {
|
|
@@ -103,6 +158,9 @@ task(TASK_TEST, "Runs mocha tests")
|
|
|
103
158
|
|
|
104
159
|
const testFailures = await run(TASK_TEST_RUN_MOCHA_TESTS, {
|
|
105
160
|
testFiles: files,
|
|
161
|
+
parallel,
|
|
162
|
+
bail,
|
|
163
|
+
grep,
|
|
106
164
|
});
|
|
107
165
|
|
|
108
166
|
if (network.name === HARDHAT_NETWORK_NAME) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type { LoDashStatic } from "lodash";
|
|
2
|
+
import type { ProjectPathsConfig, SolcConfig } from "../../types";
|
|
3
|
+
|
|
1
4
|
import debug from "debug";
|
|
2
5
|
import fsExtra from "fs-extra";
|
|
3
6
|
import * as t from "io-ts";
|
|
4
|
-
import type { LoDashStatic } from "lodash";
|
|
5
7
|
import * as path from "path";
|
|
6
8
|
|
|
7
9
|
import { SOLIDITY_FILES_CACHE_FILENAME } from "../../internal/constants";
|
|
8
|
-
import type { ProjectPathsConfig, SolcConfig } from "../../types";
|
|
9
10
|
|
|
10
11
|
const log = debug("hardhat:core:tasks:compile:cache");
|
|
11
12
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import AbortController from "abort-controller";
|
|
2
2
|
import debug from "debug";
|
|
3
|
-
import fetch from "node-fetch";
|
|
4
3
|
import os from "os";
|
|
5
4
|
import qs from "qs";
|
|
5
|
+
import { request } from "undici";
|
|
6
6
|
import { v4 as uuid } from "uuid";
|
|
7
7
|
|
|
8
8
|
import * as builtinTaskNames from "../../builtin-tasks/task-names";
|
|
@@ -171,7 +171,7 @@ export class Analytics {
|
|
|
171
171
|
|
|
172
172
|
log(`Hit payload: ${JSON.stringify(hit)}`);
|
|
173
173
|
|
|
174
|
-
const hitPromise =
|
|
174
|
+
const hitPromise = request(googleAnalyticsUrl, {
|
|
175
175
|
body: hitPayload,
|
|
176
176
|
method: "POST",
|
|
177
177
|
signal: controller.signal,
|
package/src/internal/cli/cli.ts
CHANGED
|
@@ -41,14 +41,14 @@ async function printVersionMessage(packageJson: PackageJson) {
|
|
|
41
41
|
console.log(packageJson.version);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function
|
|
44
|
+
function printWarningAboutNodeJsVersionIfNecessary(packageJson: PackageJson) {
|
|
45
45
|
const requirement = packageJson.engines.node;
|
|
46
46
|
if (!semver.satisfies(process.version, requirement)) {
|
|
47
47
|
console.warn(
|
|
48
48
|
chalk.yellow(
|
|
49
49
|
`You are using a version of Node.js that is not supported by Hardhat, and it may work incorrectly, or not work at all.
|
|
50
50
|
|
|
51
|
-
Please,
|
|
51
|
+
Please, make sure you are using a supported version of Node.js.
|
|
52
52
|
|
|
53
53
|
To learn more about which versions of Node.js are supported go to https://hardhat.org/nodejs-versions`
|
|
54
54
|
)
|
|
@@ -64,7 +64,7 @@ async function main() {
|
|
|
64
64
|
try {
|
|
65
65
|
const packageJson = await getPackageJson();
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
printWarningAboutNodeJsVersionIfNecessary(packageJson);
|
|
68
68
|
|
|
69
69
|
const envVariableArguments = getEnvHardhatArguments(
|
|
70
70
|
HARDHAT_PARAM_DEFINITIONS,
|
|
@@ -142,6 +142,44 @@ async function printWelcomeMessage() {
|
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
async function checkForDuplicates(
|
|
146
|
+
projectRoot: string,
|
|
147
|
+
projectType: SampleProjectTypeCreationAction
|
|
148
|
+
): Promise<void> {
|
|
149
|
+
const { intersection, union } = await import("lodash");
|
|
150
|
+
|
|
151
|
+
const packageRoot = getPackageRoot();
|
|
152
|
+
|
|
153
|
+
const srcPath = path.join(packageRoot, "sample-projects");
|
|
154
|
+
const destFiles = fsExtra.readdirSync(projectRoot);
|
|
155
|
+
let srcFiles: string[] = fsExtra.readdirSync(path.join(srcPath, "basic"));
|
|
156
|
+
|
|
157
|
+
switch (projectType) {
|
|
158
|
+
case Action.CREATE_ADVANCED_SAMPLE_PROJECT_ACTION:
|
|
159
|
+
srcFiles = union(
|
|
160
|
+
srcFiles,
|
|
161
|
+
fsExtra.readdirSync(path.join(srcPath, "advanced"))
|
|
162
|
+
);
|
|
163
|
+
break;
|
|
164
|
+
case Action.CREATE_ADVANCED_TYPESCRIPT_SAMPLE_PROJECT_ACTION:
|
|
165
|
+
srcFiles = union(
|
|
166
|
+
srcFiles,
|
|
167
|
+
fsExtra.readdirSync(path.join(srcPath, "advanced")),
|
|
168
|
+
fsExtra.readdirSync(path.join(srcPath, "advanced-ts"))
|
|
169
|
+
);
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const duplicates = intersection(srcFiles, destFiles);
|
|
174
|
+
|
|
175
|
+
if (duplicates.length > 0) {
|
|
176
|
+
throw new HardhatError(ERRORS.GENERAL.CONFLICTING_FILES, {
|
|
177
|
+
dest: projectRoot,
|
|
178
|
+
conflicts: duplicates.map((n) => ` ${n}`).join(os.EOL),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
145
183
|
async function copySampleProject(
|
|
146
184
|
projectRoot: string,
|
|
147
185
|
projectType: SampleProjectTypeCreationAction
|
|
@@ -153,6 +191,8 @@ async function copySampleProject(
|
|
|
153
191
|
// the advanced TypeScript project is what was requested, overlay those files
|
|
154
192
|
// on top of the advanced ones.
|
|
155
193
|
|
|
194
|
+
await checkForDuplicates(projectRoot, projectType);
|
|
195
|
+
|
|
156
196
|
await fsExtra.ensureDir(projectRoot);
|
|
157
197
|
await fsExtra.copy(
|
|
158
198
|
path.join(packageRoot, "sample-projects", "basic"),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type StackTraceParserT from "stacktrace-parser";
|
|
2
|
+
|
|
1
3
|
import chalk from "chalk";
|
|
2
4
|
import debug from "debug";
|
|
3
5
|
import fsExtra from "fs-extra";
|
|
4
6
|
import path from "path";
|
|
5
7
|
import semver from "semver";
|
|
6
|
-
import type StackTraceParserT from "stacktrace-parser";
|
|
7
8
|
|
|
8
9
|
import { HardhatArguments, HardhatConfig } from "../../../types";
|
|
9
10
|
import { HardhatContext } from "../../context";
|
|
@@ -190,6 +190,7 @@ const commonHDAccountsFields = {
|
|
|
190
190
|
const HardhatNetworkHDAccountsConfig = t.type({
|
|
191
191
|
mnemonic: optional(t.string),
|
|
192
192
|
accountsBalance: optional(decimalString),
|
|
193
|
+
passphrase: optional(t.string),
|
|
193
194
|
...commonHDAccountsFields,
|
|
194
195
|
});
|
|
195
196
|
|
|
@@ -293,6 +294,7 @@ const HardhatNetworkConfig = t.type({
|
|
|
293
294
|
|
|
294
295
|
const HDAccountsConfig = t.type({
|
|
295
296
|
mnemonic: t.string,
|
|
297
|
+
passphrase: optional(t.string),
|
|
296
298
|
...commonHDAccountsFields,
|
|
297
299
|
});
|
|
298
300
|
|