hardhat 2.8.3 → 2.9.0-dev.1
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 +24 -1
- 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/jsonrpc/types/input/blockTag.d.ts +3 -3
- package/internal/core/jsonrpc/types/input/blockTag.d.ts.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 +6 -4
- 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/core/tasks/task-definitions.d.ts +8 -8
- package/internal/core/tasks/task-definitions.js +8 -8
- package/internal/hardhat-network/jsonrpc/server.d.ts.map +1 -1
- 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 +61 -10
- 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/chunked-promise-all.d.ts +7 -0
- package/internal/util/chunked-promise-all.d.ts.map +1 -0
- package/internal/util/chunked-promise-all.js +31 -0
- package/internal/util/chunked-promise-all.js.map +1 -0
- 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 +11 -11
- package/sample-projects/advanced/.prettierrc +1 -0
- 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 +41 -1
- 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 +8 -5
- 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/core/tasks/task-definitions.ts +8 -8
- 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 +85 -11
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunked-promise-all.js","sourceRoot":"","sources":["../../src/internal/util/chunked-promise-all.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,KAAK,UAAU,iBAAiB,CACrC,QAAiC,EACjC,YAAoB,CAAC;IAErB,MAAM,KAAK,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;IAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,EAAE,CAAC;IAEnB,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;QACzB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACvC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAgB,CAAC,CACrC,CAAC;QAEF,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAErB,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,MAAM,OAAO,GAAG,QAAQ,EAAE,CAAC;YAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;YAClC,WAAW,CAAC,MAAM,CAChB,KAAK,EACL,CAAC,EACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAgB,CAAC,CAC/C,CAAC;SACH;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACzB,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC9B;KACF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAjCD,8CAiCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/internal/util/download.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/internal/util/download.ts"],"names":[],"mappings":"AAqBA,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,aAAa,SAAQ,iBA2CtB"}
|
|
@@ -25,10 +25,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.download = void 0;
|
|
26
26
|
const fs_1 = __importDefault(require("fs"));
|
|
27
27
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
28
|
-
const https_proxy_agent_1 = __importDefault(require("https-proxy-agent"));
|
|
29
28
|
const path_1 = __importDefault(require("path"));
|
|
30
29
|
const util_1 = __importDefault(require("util"));
|
|
30
|
+
const packageInfo_1 = require("./packageInfo");
|
|
31
31
|
const TEMP_FILE_PREFIX = "tmp-";
|
|
32
|
+
const hardhatVersion = (0, packageInfo_1.getHardhatVersion)();
|
|
32
33
|
function resolveTempFileName(filePath) {
|
|
33
34
|
const { dir, ext, name } = path_1.default.parse(filePath);
|
|
34
35
|
return path_1.default.format({
|
|
@@ -39,38 +40,35 @@ function resolveTempFileName(filePath) {
|
|
|
39
40
|
}
|
|
40
41
|
async function download(url, filePath, timeoutMillis = 10000) {
|
|
41
42
|
const { pipeline } = await Promise.resolve().then(() => __importStar(require("stream")));
|
|
42
|
-
const {
|
|
43
|
+
const { getGlobalDispatcher, ProxyAgent, request } = await Promise.resolve().then(() => __importStar(require("undici")));
|
|
43
44
|
const streamPipeline = util_1.default.promisify(pipeline);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
fetchOptions.agent = new https_proxy_agent_1.default.HttpsProxyAgent(proxy);
|
|
53
|
-
}
|
|
54
|
-
// Check if Proxy is set http and `fetchOptions.agent` was not already set for https
|
|
55
|
-
if (process.env.HTTP_PROXY !== undefined &&
|
|
56
|
-
fetchOptions.agent === undefined) {
|
|
57
|
-
// Create the proxy from the environment variables
|
|
58
|
-
const proxy = process.env.HTTP_PROXY;
|
|
59
|
-
fetchOptions.agent = new https_proxy_agent_1.default.HttpsProxyAgent(proxy);
|
|
45
|
+
function chooseDispatcher() {
|
|
46
|
+
if (process.env.HTTPS_PROXY !== undefined) {
|
|
47
|
+
return new ProxyAgent(process.env.HTTPS_PROXY);
|
|
48
|
+
}
|
|
49
|
+
if (process.env.HTTP_PROXY !== undefined) {
|
|
50
|
+
return new ProxyAgent(process.env.HTTP_PROXY);
|
|
51
|
+
}
|
|
52
|
+
return getGlobalDispatcher();
|
|
60
53
|
}
|
|
61
54
|
// Fetch the url
|
|
62
|
-
const response = await
|
|
63
|
-
|
|
55
|
+
const response = await request(url, {
|
|
56
|
+
dispatcher: chooseDispatcher(),
|
|
57
|
+
headersTimeout: timeoutMillis,
|
|
58
|
+
maxRedirections: 10,
|
|
59
|
+
method: "GET",
|
|
60
|
+
headers: {
|
|
61
|
+
"User-Agent": `hardhat ${hardhatVersion}`,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
64
65
|
const tmpFilePath = resolveTempFileName(filePath);
|
|
65
66
|
await fs_extra_1.default.ensureDir(path_1.default.dirname(filePath));
|
|
66
67
|
await streamPipeline(response.body, fs_1.default.createWriteStream(tmpFilePath));
|
|
67
68
|
return fs_extra_1.default.move(tmpFilePath, filePath, { overwrite: true });
|
|
68
69
|
}
|
|
69
|
-
// Consume the response stream and discard its result
|
|
70
|
-
// See: https://github.com/node-fetch/node-fetch/issues/83
|
|
71
|
-
const _discarded = await response.arrayBuffer();
|
|
72
70
|
// eslint-disable-next-line @nomiclabs/hardhat-internal-rules/only-hardhat-error
|
|
73
|
-
throw new Error(`Failed to download ${url} - ${response.
|
|
71
|
+
throw new Error(`Failed to download ${url} - ${response.statusCode} received. ${await response.body.text()}`);
|
|
74
72
|
}
|
|
75
73
|
exports.download = download;
|
|
76
74
|
//# sourceMappingURL=download.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.js","sourceRoot":"","sources":["../../src/internal/util/download.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,wDAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file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;QAClC,UAAU,EAAE,gBAAgB,EAAE;QAC9B,cAAc,EAAE,aAAa;QAC7B,eAAe,EAAE,EAAE;QACnB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,YAAY,EAAE,WAAW,cAAc,EAAE;SAC1C;KACF,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;QAC5D,MAAM,WAAW,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;QAClD,MAAM,kBAAO,CAAC,SAAS,CAAC,cAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEhD,MAAM,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;QACvE,OAAO,kBAAO,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;KACjE;IAED,gFAAgF;IAChF,MAAM,IAAI,KAAK,CACb,sBAAsB,GAAG,MACvB,QAAQ,CAAC,UACX,cAAc,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAC3C,CAAC;AACJ,CAAC;AA9CD,4BA8CC"}
|
|
@@ -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-dir.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"global-dir.js","sourceRoot":"","sources":["../../src/internal/util/global-dir.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kDAA0B;AAC1B,wDAA0B;AAC1B,4CAAoB;AACpB,gDAAwB;AAExB,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,yBAAyB,CAAC,CAAC;AAE7C,KAAK,UAAU,aAAa,CAAC,WAAW,GAAG,SAAS;IAClD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,wDAAa,WAAW,GAAC,CAAC;IACxD,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,iBAAiB,CAAC,WAAW,GAAG,SAAS;IAChD,MAAM,QAAQ,GAAqB,OAAO,CAAC,WAAW,CAAC,CAAC;IACxD,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,gBAAgB;IACvB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAC;IACvC,kBAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IACzB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,WAAoB;IAC5C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,aAAa,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AO,OAAO,CAAC;AACjB,CAAC;AAZD,sDAYC;AAED,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,MAAM,SAAS,GAAG,gBAAgB,EAAE,CAAC;IACrC,MAAM,oBAAoB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC;IAE5E,kBAAE,CAAC,aAAa,CAAC,oBAAoB,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;AACrE,CAAC;AALD,sDAKC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
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-dev.1",
|
|
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",
|
|
@@ -97,12 +96,14 @@
|
|
|
97
96
|
"@ethereumjs/tx": "^3.4.0",
|
|
98
97
|
"@ethereumjs/vm": "^5.6.0",
|
|
99
98
|
"@ethersproject/abi": "^5.1.2",
|
|
99
|
+
"@metamask/eth-sig-util": "^4.0.0",
|
|
100
100
|
"@sentry/node": "^5.18.1",
|
|
101
|
-
"@solidity-parser/parser": "^0.14.
|
|
101
|
+
"@solidity-parser/parser": "^0.14.1",
|
|
102
102
|
"@types/bn.js": "^5.1.0",
|
|
103
103
|
"@types/lru-cache": "^5.1.0",
|
|
104
104
|
"abort-controller": "^3.0.0",
|
|
105
105
|
"adm-zip": "^0.4.16",
|
|
106
|
+
"aggregate-error": "^3.0.0",
|
|
106
107
|
"ansi-escapes": "^4.3.0",
|
|
107
108
|
"chalk": "^2.4.2",
|
|
108
109
|
"chokidar": "^3.4.0",
|
|
@@ -110,7 +111,6 @@
|
|
|
110
111
|
"debug": "^4.1.1",
|
|
111
112
|
"enquirer": "^2.3.0",
|
|
112
113
|
"env-paths": "^2.2.0",
|
|
113
|
-
"eth-sig-util": "^2.5.2",
|
|
114
114
|
"ethereum-cryptography": "^0.1.2",
|
|
115
115
|
"ethereumjs-abi": "^0.6.8",
|
|
116
116
|
"ethereumjs-util": "^7.1.3",
|
|
@@ -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
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -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,
|