hardhat 3.9.0 → 3.10.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/CHANGELOG.md +44 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +6 -5
- package/dist/src/config.js.map +1 -1
- package/dist/src/hhu.d.ts +3 -0
- package/dist/src/hhu.d.ts.map +1 -0
- package/dist/src/hhu.js +14 -0
- package/dist/src/hhu.js.map +1 -0
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js +4 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +21 -23
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +21 -27
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts +3 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +18 -10
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/hhu/index.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/hhu/index.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/index.js +9 -0
- package/dist/src/internal/builtin-plugins/hhu/index.js.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/constants/index.d.ts +3 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/constants/index.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/constants/index.js +8 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/constants/index.js.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/constants/zero-address.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/constants/zero-address.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/constants/zero-address.js +6 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/constants/zero-address.js.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/convert/index.d.ts +3 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/convert/index.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/convert/index.js +27 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/convert/index.js.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/convert/pad.d.ts +10 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/convert/pad.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/convert/pad.js +31 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/convert/pad.js.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/fetch/block-number.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/fetch/block-number.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/fetch/block-number.js +17 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/fetch/block-number.js.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/fetch/index.d.ts +3 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/fetch/index.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/fetch/index.js +8 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/fetch/index.js.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/index.d.ts +11 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/index.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/index.js +20 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/index.js.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/utils-task.d.ts +13 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/utils-task.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/utils-task.js +17 -0
- package/dist/src/internal/builtin-plugins/hhu/tasks/utils-task.js.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/types.d.ts +45 -0
- package/dist/src/internal/builtin-plugins/hhu/types.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/hhu/types.js +2 -0
- package/dist/src/internal/builtin-plugins/hhu/types.js.map +1 -0
- package/dist/src/internal/builtin-plugins/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/index.js +5 -0
- package/dist/src/internal/builtin-plugins/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +2 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/solidity-stack-trace.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/solidity-stack-trace.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/solidity-stack-trace.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.js +17 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.d.ts +17 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js +19 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +5 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/hardfork.d.ts +8 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/hardfork.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/hardfork.js +30 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/hardfork.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/index.js +2 -10
- package/dist/src/internal/builtin-plugins/network-manager/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-option.d.ts +9 -0
- package/dist/src/internal/builtin-plugins/network-manager/network-option.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/network-option.js +15 -0
- package/dist/src/internal/builtin-plugins/network-manager/network-option.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/automatic-sender-handler.d.ts +4 -2
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/automatic-sender-handler.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/automatic-sender-handler.js +28 -6
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/automatic-sender-handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/node/task-action.js +2 -37
- package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/utils/resolve-node-connection-params.d.ts +19 -0
- package/dist/src/internal/builtin-plugins/node/utils/resolve-node-connection-params.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/node/utils/resolve-node-connection-params.js +47 -0
- package/dist/src/internal/builtin-plugins/node/utils/resolve-node-connection-params.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +34 -7
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.js +32 -9
- package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.d.ts +9 -3
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.js +60 -27
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.js +19 -10
- package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +4 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.js +13 -5
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.js +3 -1
- package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +6 -0
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/cli/help/get-global-help-string.d.ts +3 -1
- package/dist/src/internal/cli/help/get-global-help-string.d.ts.map +1 -1
- package/dist/src/internal/cli/help/get-global-help-string.js +3 -3
- package/dist/src/internal/cli/help/get-global-help-string.js.map +1 -1
- package/dist/src/internal/cli/help/get-help-string.d.ts +3 -1
- package/dist/src/internal/cli/help/get-help-string.d.ts.map +1 -1
- package/dist/src/internal/cli/help/get-help-string.js +4 -4
- package/dist/src/internal/cli/help/get-help-string.js.map +1 -1
- package/dist/src/internal/cli/help/utils.d.ts +3 -1
- package/dist/src/internal/cli/help/utils.d.ts.map +1 -1
- package/dist/src/internal/cli/help/utils.js +2 -2
- package/dist/src/internal/cli/help/utils.js.map +1 -1
- package/dist/src/internal/cli/hhu.d.ts +14 -0
- package/dist/src/internal/cli/hhu.d.ts.map +1 -0
- package/dist/src/internal/cli/hhu.js +184 -0
- package/dist/src/internal/cli/hhu.js.map +1 -0
- package/dist/src/internal/cli/main.d.ts +0 -25
- package/dist/src/internal/cli/main.d.ts.map +1 -1
- package/dist/src/internal/cli/main.js +23 -303
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/internal/cli/parser.d.ts +25 -0
- package/dist/src/internal/cli/parser.d.ts.map +1 -0
- package/dist/src/internal/cli/parser.js +282 -0
- package/dist/src/internal/cli/parser.js.map +1 -0
- package/dist/src/internal/cli/telemetry/analytics/analytics.d.ts +1 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.js +2 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/types.d.ts +1 -0
- package/dist/src/internal/cli/telemetry/analytics/types.d.ts.map +1 -1
- package/dist/src/internal/using-hardhat2-plugin-errors.d.ts +2 -2
- package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -1
- package/dist/src/internal/using-hardhat2-plugin-errors.js +7 -3
- package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -1
- package/dist/src/plugins.d.ts.map +1 -1
- package/dist/src/plugins.js +3 -2
- package/dist/src/plugins.js.map +1 -1
- package/package.json +4 -4
- package/src/config.ts +17 -5
- package/src/hhu.ts +18 -0
- package/src/internal/builtin-plugins/artifacts/hook-handlers/hre.ts +11 -3
- package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +32 -32
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +32 -36
- package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +22 -9
- package/src/internal/builtin-plugins/hhu/index.ts +13 -0
- package/src/internal/builtin-plugins/hhu/tasks/constants/index.ts +18 -0
- package/src/internal/builtin-plugins/hhu/tasks/constants/zero-address.ts +9 -0
- package/src/internal/builtin-plugins/hhu/tasks/convert/index.ts +40 -0
- package/src/internal/builtin-plugins/hhu/tasks/convert/pad.ts +61 -0
- package/src/internal/builtin-plugins/hhu/tasks/fetch/block-number.ts +28 -0
- package/src/internal/builtin-plugins/hhu/tasks/fetch/index.ts +18 -0
- package/src/internal/builtin-plugins/hhu/tasks/index.ts +36 -0
- package/src/internal/builtin-plugins/hhu/tasks/utils-task.ts +29 -0
- package/src/internal/builtin-plugins/hhu/types.ts +57 -0
- package/src/internal/builtin-plugins/index.ts +6 -0
- package/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +3 -0
- package/src/internal/builtin-plugins/network-manager/edr/stack-traces/solidity-stack-trace.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.ts +33 -0
- package/src/internal/builtin-plugins/network-manager/edr/types/hardfork.ts +20 -3
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +5 -0
- package/src/internal/builtin-plugins/network-manager/edr/utils/hardfork.ts +53 -1
- package/src/internal/builtin-plugins/network-manager/index.ts +3 -10
- package/src/internal/builtin-plugins/network-manager/network-option.ts +17 -0
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/automatic-sender-handler.ts +39 -9
- package/src/internal/builtin-plugins/node/task-action.ts +2 -52
- package/src/internal/builtin-plugins/node/utils/resolve-node-connection-params.ts +79 -0
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +51 -8
- package/src/internal/builtin-plugins/solidity-test/config.ts +53 -9
- package/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.ts +64 -25
- package/src/internal/builtin-plugins/solidity-test/eip712/index.ts +23 -13
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +5 -1
- package/src/internal/builtin-plugins/solidity-test/inline-config/index.ts +20 -9
- package/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.ts +6 -1
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +2 -2
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +6 -0
- package/src/internal/cli/help/get-global-help-string.ts +3 -2
- package/src/internal/cli/help/get-help-string.ts +4 -3
- package/src/internal/cli/help/utils.ts +2 -1
- package/src/internal/cli/hhu.ts +298 -0
- package/src/internal/cli/main.ts +41 -495
- package/src/internal/cli/parser.ts +472 -0
- package/src/internal/cli/telemetry/analytics/analytics.ts +5 -1
- package/src/internal/cli/telemetry/analytics/types.ts +3 -0
- package/src/internal/using-hardhat2-plugin-errors.ts +12 -3
- package/src/plugins.ts +5 -2
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +6 -6
- package/templates/hardhat-3/02-mocha-ethers/package.json +9 -9
- package/templates/hardhat-3/03-minimal/package.json +1 -1
|
@@ -6,6 +6,10 @@ import console from "./console/index.js";
|
|
|
6
6
|
import coverage from "./coverage/index.js";
|
|
7
7
|
import flatten from "./flatten/index.js";
|
|
8
8
|
import gasAnalytics from "./gas-analytics/index.js";
|
|
9
|
+
// The hhu / `utils` feature is unreleased and intentionally not wired up yet.
|
|
10
|
+
// To enable it, uncomment the three `hhu` lines (this import, the type re-export
|
|
11
|
+
// below, and the `builtinPlugins` entry) and re-add `bin.hhu` in package.json.
|
|
12
|
+
// import hhu from "./hhu/index.js";
|
|
9
13
|
import networkManager from "./network-manager/index.js";
|
|
10
14
|
import node from "./node/index.js";
|
|
11
15
|
import run from "./run/index.js";
|
|
@@ -22,6 +26,7 @@ export type * from "./console/index.js";
|
|
|
22
26
|
export type * from "./coverage/index.js";
|
|
23
27
|
export type * from "./flatten/index.js";
|
|
24
28
|
export type * from "./gas-analytics/index.js";
|
|
29
|
+
// export type * from "./hhu/index.js";
|
|
25
30
|
export type * from "./network-manager/index.js";
|
|
26
31
|
export type * from "./node/index.js";
|
|
27
32
|
export type * from "./run/index.js";
|
|
@@ -46,4 +51,5 @@ export const builtinPlugins: HardhatPlugin[] = [
|
|
|
46
51
|
node,
|
|
47
52
|
flatten,
|
|
48
53
|
telemetry,
|
|
54
|
+
// hhu,
|
|
49
55
|
];
|
|
@@ -10,7 +10,7 @@ let mnemonicToSeedSync: typeof Bip39T.mnemonicToSeedSync | undefined;
|
|
|
10
10
|
// ethereum-cryptography/hdkey is known to be slow to load, so we lazy load it
|
|
11
11
|
let HDKey: typeof HDKeyT | undefined;
|
|
12
12
|
|
|
13
|
-
const HD_PATH_REGEX = /^m(
|
|
13
|
+
const HD_PATH_REGEX = /^m(?:\/\d+'?)+\/?$/;
|
|
14
14
|
|
|
15
15
|
export async function derivePrivateKeys(
|
|
16
16
|
mnemonic: string,
|
|
@@ -59,6 +59,7 @@ import {
|
|
|
59
59
|
hardhatForkingConfigToEdrForkConfig,
|
|
60
60
|
resolveDefaultTransactionGasLimit,
|
|
61
61
|
} from "./utils/convert-to-edr.js";
|
|
62
|
+
import { warnIfExperimentalHardfork } from "./utils/hardfork.js";
|
|
62
63
|
import { printLine, replaceLastLine } from "./utils/logger.js";
|
|
63
64
|
|
|
64
65
|
const log = createDebug("hardhat:core:network-manager:edr:provider");
|
|
@@ -109,6 +110,8 @@ export class EdrProvider extends BaseProvider {
|
|
|
109
110
|
const printLineFn = loggerConfig.printLineFn ?? printLine;
|
|
110
111
|
const replaceLastLineFn = loggerConfig.replaceLastLineFn ?? replaceLastLine;
|
|
111
112
|
|
|
113
|
+
warnIfExperimentalHardfork(networkConfig.hardfork, networkConfig.chainType);
|
|
114
|
+
|
|
112
115
|
const providerConfig = await getProviderConfig(
|
|
113
116
|
networkConfig,
|
|
114
117
|
coverageConfig,
|
package/src/internal/builtin-plugins/network-manager/edr/stack-traces/solidity-stack-trace.ts
CHANGED
|
@@ -42,7 +42,6 @@ import {
|
|
|
42
42
|
} from "@nomicfoundation/edr";
|
|
43
43
|
|
|
44
44
|
export {
|
|
45
|
-
SourceReference,
|
|
46
45
|
StackTraceEntryType,
|
|
47
46
|
CheatcodeErrorCode,
|
|
48
47
|
stackTraceEntryTypeToString,
|
|
@@ -56,6 +55,7 @@ export {
|
|
|
56
55
|
};
|
|
57
56
|
|
|
58
57
|
export type {
|
|
58
|
+
SourceReference,
|
|
59
59
|
CallstackEntryStackTraceEntry,
|
|
60
60
|
UnrecognizedCreateCallstackEntryStackTraceEntry,
|
|
61
61
|
UnrecognizedContractCallstackEntryStackTraceEntry,
|
package/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.ts
CHANGED
|
@@ -21,6 +21,32 @@ import {
|
|
|
21
21
|
UNRECOGNIZED_FUNCTION_NAME,
|
|
22
22
|
} from "./solidity-stack-trace.js";
|
|
23
23
|
|
|
24
|
+
interface CheatcodeSuggestion {
|
|
25
|
+
message: string;
|
|
26
|
+
docsUrl?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const CHEATCODE_SUGGESTIONS: Record<string, CheatcodeSuggestion> = {
|
|
30
|
+
"eip712HashType(string,string)": {
|
|
31
|
+
message:
|
|
32
|
+
"Providing a path to a bindings file is not supported, please use the eip712HashType(string calldata typeNameOrDefinition) cheatcode instead.",
|
|
33
|
+
docsUrl:
|
|
34
|
+
"https://hardhat.org/docs/reference/cheatcodes/utilities/eip712-hash-type",
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function getCheatcodeSuggestion(cheatcode: string): string {
|
|
39
|
+
const suggestion = CHEATCODE_SUGGESTIONS[cheatcode];
|
|
40
|
+
|
|
41
|
+
if (suggestion === undefined) {
|
|
42
|
+
return "";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return suggestion.docsUrl !== undefined
|
|
46
|
+
? `${suggestion.message} See ${suggestion.docsUrl} for more information.`
|
|
47
|
+
: suggestion.message;
|
|
48
|
+
}
|
|
49
|
+
|
|
24
50
|
export function createSolidityErrorWithStackTrace(
|
|
25
51
|
fallbackMessage: string,
|
|
26
52
|
stackTrace: SolidityStackTrace,
|
|
@@ -277,6 +303,13 @@ function getMessageFromLastStackTraceEntry(
|
|
|
277
303
|
switch (stackTraceEntry.details.code) {
|
|
278
304
|
case CheatcodeErrorCode.UnsupportedCheatcode:
|
|
279
305
|
message = `Cheatcode '${stackTraceEntry.details.cheatcode}' is not supported by Hardhat.`;
|
|
306
|
+
|
|
307
|
+
const suggestion = getCheatcodeSuggestion(
|
|
308
|
+
stackTraceEntry.details.cheatcode,
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
message += suggestion.length > 0 ? " " + suggestion : "";
|
|
312
|
+
|
|
280
313
|
break;
|
|
281
314
|
case CheatcodeErrorCode.MissingCheatcode:
|
|
282
315
|
message = `Cheatcode '${stackTraceEntry.details.cheatcode}' is not yet available in this version of Hardhat.`;
|
|
@@ -22,6 +22,7 @@ export enum L1HardforkName {
|
|
|
22
22
|
CANCUN = "cancun",
|
|
23
23
|
PRAGUE = "prague",
|
|
24
24
|
OSAKA = "osaka",
|
|
25
|
+
AMSTERDAM = "amsterdam",
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
export enum OpHardforkName {
|
|
@@ -44,10 +45,26 @@ export function getHardforks(chainType: ChainType): string[] {
|
|
|
44
45
|
: L1_HARDFORK_ORDER;
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
/**
|
|
49
|
+
* The latest *stable* hardforks. These are hardcoded (rather than derived from
|
|
50
|
+
* EDR's `l1HardforkLatest()`/`opLatestHardfork()`) so this module stays free of
|
|
51
|
+
* the native `@nomicfoundation/edr` addon on the config-resolution bootstrap
|
|
52
|
+
* path — see commit 2568ed1ba.
|
|
53
|
+
*
|
|
54
|
+
* They are NOT necessarily the last entry of the enum: the enum can contain
|
|
55
|
+
* experimental forks (e.g. Amsterdam) that EDR ships but hasn't promoted to
|
|
56
|
+
* latest yet. The invariant test in
|
|
57
|
+
* `test/.../edr/types/hardfork.ts` asserts these equal EDR's
|
|
58
|
+
* `l1HardforkLatest()`/`opLatestHardfork()` — bump them together when EDR
|
|
59
|
+
* promotes a fork.
|
|
60
|
+
*/
|
|
61
|
+
export const L1_LATEST_STABLE_HARDFORK: L1HardforkName = L1HardforkName.OSAKA;
|
|
62
|
+
export const OP_LATEST_STABLE_HARDFORK: OpHardforkName = OpHardforkName.ISTHMUS;
|
|
63
|
+
|
|
47
64
|
export function getCurrentHardfork(chainType: ChainType): string {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
65
|
+
return chainType === OPTIMISM_CHAIN_TYPE
|
|
66
|
+
? OP_LATEST_STABLE_HARDFORK
|
|
67
|
+
: L1_LATEST_STABLE_HARDFORK;
|
|
51
68
|
}
|
|
52
69
|
|
|
53
70
|
/**
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
CANCUN,
|
|
41
41
|
PRAGUE,
|
|
42
42
|
OSAKA,
|
|
43
|
+
AMSTERDAM,
|
|
43
44
|
BEDROCK,
|
|
44
45
|
REGOLITH,
|
|
45
46
|
CANYON,
|
|
@@ -114,6 +115,8 @@ export function edrL1HardforkToHardhatL1HardforkName(
|
|
|
114
115
|
return L1HardforkName.PRAGUE;
|
|
115
116
|
case SpecId.Osaka:
|
|
116
117
|
return L1HardforkName.OSAKA;
|
|
118
|
+
case SpecId.Amsterdam:
|
|
119
|
+
return L1HardforkName.AMSTERDAM;
|
|
117
120
|
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- trust but verify
|
|
118
121
|
default:
|
|
119
122
|
const _exhaustiveCheck: never = hardfork;
|
|
@@ -235,6 +238,8 @@ function hardhatL1HardforkToEdrSpecId(hardfork: string): string {
|
|
|
235
238
|
return PRAGUE;
|
|
236
239
|
case L1HardforkName.OSAKA:
|
|
237
240
|
return OSAKA;
|
|
241
|
+
case L1HardforkName.AMSTERDAM:
|
|
242
|
+
return AMSTERDAM;
|
|
238
243
|
|
|
239
244
|
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- we want to print the fork
|
|
240
245
|
default:
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
import type { ChainType } from "../../../../../types/network.js";
|
|
2
|
+
|
|
3
|
+
import { styleText } from "node:util";
|
|
4
|
+
|
|
1
5
|
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
2
6
|
|
|
3
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
getCurrentHardfork,
|
|
9
|
+
hardforkGte,
|
|
10
|
+
L1HardforkName,
|
|
11
|
+
OpHardforkName,
|
|
12
|
+
} from "../types/hardfork.js";
|
|
4
13
|
|
|
5
14
|
export function getL1HardforkName(name: string): L1HardforkName {
|
|
6
15
|
const hardforkName =
|
|
@@ -16,6 +25,49 @@ export function getL1HardforkName(name: string): L1HardforkName {
|
|
|
16
25
|
return hardforkName;
|
|
17
26
|
}
|
|
18
27
|
|
|
28
|
+
// Tracks which (chainType, hardfork) pairs have already been warned about, so
|
|
29
|
+
// we only print the experimental-hardfork warning once per process.
|
|
30
|
+
const warnedHardforks = new Set<string>();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Prints a warning if `hardfork` is strictly beyond the latest stable hardfork
|
|
34
|
+
* for the given chain type (i.e. an experimental fork that EDR supports but
|
|
35
|
+
* hasn't promoted to latest yet). The warning is emitted at
|
|
36
|
+
* most once per (chainType, hardfork) pair for the lifetime of the process.
|
|
37
|
+
*/
|
|
38
|
+
export function warnIfExperimentalHardfork(
|
|
39
|
+
hardfork: string,
|
|
40
|
+
chainType: ChainType,
|
|
41
|
+
warn: (message: string) => void = (message) => console.error(message),
|
|
42
|
+
): void {
|
|
43
|
+
const latestStable = getCurrentHardfork(chainType);
|
|
44
|
+
|
|
45
|
+
// Only warn for hardforks strictly beyond the latest stable one.
|
|
46
|
+
if (
|
|
47
|
+
hardfork === latestStable ||
|
|
48
|
+
!hardforkGte(hardfork, latestStable, chainType)
|
|
49
|
+
) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const key = `${chainType}:${hardfork}`;
|
|
54
|
+
|
|
55
|
+
if (warnedHardforks.has(key)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
warnedHardforks.add(key);
|
|
60
|
+
|
|
61
|
+
warn(
|
|
62
|
+
styleText(["bold", "yellow"], "Warning:") +
|
|
63
|
+
` you have configured the "${hardfork}" hardfork, which is experimental ` +
|
|
64
|
+
`and not yet finalized, so its behavior may change or be incomplete. ` +
|
|
65
|
+
`The latest stable hardfork is "${latestStable}". ` +
|
|
66
|
+
`Keep Hardhat up to date to track changes to "${hardfork}" and to pick up ` +
|
|
67
|
+
`its stable version once it activates on mainnet.\n`,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
19
71
|
export function getOpHardforkName(name: string): OpHardforkName {
|
|
20
72
|
const hardforkName =
|
|
21
73
|
Object.values(OpHardforkName)[
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { HardhatPlugin } from "../../../types/plugins.js";
|
|
2
2
|
|
|
3
3
|
import { definePlugin } from "../../../plugins.js";
|
|
4
|
-
|
|
5
|
-
import {
|
|
4
|
+
|
|
5
|
+
import { NETWORK_GLOBAL_OPTION } from "./network-option.js";
|
|
6
6
|
|
|
7
7
|
export type * from "./type-extensions/config.js";
|
|
8
8
|
export type * from "./type-extensions/global-options.js";
|
|
@@ -16,14 +16,7 @@ const hardhatPlugin: HardhatPlugin = definePlugin({
|
|
|
16
16
|
hre: () => import("./hook-handlers/hre.js"),
|
|
17
17
|
network: () => import("./hook-handlers/network.js"),
|
|
18
18
|
},
|
|
19
|
-
globalOptions: [
|
|
20
|
-
globalOption({
|
|
21
|
-
name: "network",
|
|
22
|
-
description: "The network to connect to",
|
|
23
|
-
type: ArgumentType.STRING_WITHOUT_DEFAULT,
|
|
24
|
-
defaultValue: undefined,
|
|
25
|
-
}),
|
|
26
|
-
],
|
|
19
|
+
globalOptions: [NETWORK_GLOBAL_OPTION],
|
|
27
20
|
npmPackage: "hardhat",
|
|
28
21
|
dependencies: () => [import("../artifacts/index.js")],
|
|
29
22
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GlobalOptionDefinition } from "../../../types/arguments.js";
|
|
2
|
+
|
|
3
|
+
import { ArgumentType } from "../../../types/arguments.js";
|
|
4
|
+
import { globalOption } from "../../core/config.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The `--network` global option, contributed by the network-manager plugin.
|
|
8
|
+
*
|
|
9
|
+
* Exported so the standalone hhu binary, which doesn't load the plugin, can
|
|
10
|
+
* reuse the exact same definition instead of duplicating it.
|
|
11
|
+
*/
|
|
12
|
+
export const NETWORK_GLOBAL_OPTION: GlobalOptionDefinition = globalOption({
|
|
13
|
+
name: "network",
|
|
14
|
+
description: "The network to connect to",
|
|
15
|
+
type: ArgumentType.STRING_WITHOUT_DEFAULT,
|
|
16
|
+
defaultValue: undefined,
|
|
17
|
+
});
|
|
@@ -1,32 +1,62 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
|
+
JsonRpcRequest,
|
|
3
|
+
JsonRpcResponse,
|
|
4
|
+
} from "../../../../../../types/providers.js";
|
|
5
|
+
|
|
6
|
+
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
7
|
+
|
|
8
|
+
import { getRequestParams } from "../../../json-rpc.js";
|
|
9
|
+
import { InternalError } from "../../../provider-errors.js";
|
|
2
10
|
|
|
3
11
|
import { SenderHandler } from "./sender.js";
|
|
4
12
|
|
|
5
13
|
/**
|
|
6
14
|
* This class automatically retrieves and caches the first available account from the connected provider.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
15
|
+
* On the first supported request, fetches and caches `eth_accounts` so callers don't need to set `from` manually.
|
|
16
|
+
* If `eth_accounts` responds with a non-array, it returns a JSON-RPC error.
|
|
9
17
|
*/
|
|
10
18
|
export class AutomaticSenderHandler extends SenderHandler {
|
|
11
19
|
#alreadyFetchedAccounts = false;
|
|
12
20
|
#firstAccount: string | undefined;
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
public override async handle(
|
|
23
|
+
jsonRpcRequest: JsonRpcRequest,
|
|
24
|
+
): Promise<JsonRpcRequest | JsonRpcResponse> {
|
|
25
|
+
if (!this.isSupportedMethod(jsonRpcRequest)) {
|
|
26
|
+
return jsonRpcRequest;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const [tx] = getRequestParams(jsonRpcRequest);
|
|
30
|
+
if (!isObject(tx) || tx.from !== undefined) {
|
|
31
|
+
// Skip the eth_accounts fetch when we won't need a sender anyway:
|
|
32
|
+
// the tx isn't an object, or it already carries a `from`.
|
|
33
|
+
return await super.handle(jsonRpcRequest);
|
|
34
|
+
}
|
|
35
|
+
|
|
15
36
|
if (this.#alreadyFetchedAccounts === false) {
|
|
16
37
|
const accounts = await this.provider.request({
|
|
17
38
|
method: "eth_accounts",
|
|
18
39
|
});
|
|
19
40
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
41
|
+
if (!Array.isArray(accounts)) {
|
|
42
|
+
return {
|
|
43
|
+
jsonrpc: "2.0",
|
|
44
|
+
id: jsonRpcRequest.id,
|
|
45
|
+
error: {
|
|
46
|
+
code: InternalError.CODE,
|
|
47
|
+
message: "eth_accounts did not return an array of accounts",
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
25
51
|
|
|
26
52
|
this.#firstAccount = accounts[0];
|
|
27
53
|
this.#alreadyFetchedAccounts = true;
|
|
28
54
|
}
|
|
29
55
|
|
|
56
|
+
return await super.handle(jsonRpcRequest);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
protected async getSender(): Promise<string | undefined> {
|
|
30
60
|
return this.#firstAccount;
|
|
31
61
|
}
|
|
32
62
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { EdrNetworkConfigOverride } from "../../../types/config.js";
|
|
2
|
-
import type { ChainType } from "../../../types/network.js";
|
|
3
1
|
import type { NewTaskActionFunction } from "../../../types/tasks.js";
|
|
4
2
|
|
|
5
3
|
import path from "node:path";
|
|
@@ -12,7 +10,6 @@ import {
|
|
|
12
10
|
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
13
11
|
import { ensureDir, exists } from "@nomicfoundation/hardhat-utils/fs";
|
|
14
12
|
|
|
15
|
-
import { isSupportedChainType } from "../../edr/chain-type.js";
|
|
16
13
|
import { BUILD_INFO_DIR_NAME } from "../artifacts/artifact-manager.js";
|
|
17
14
|
import { EdrProvider } from "../network-manager/edr/edr-provider.js";
|
|
18
15
|
|
|
@@ -22,6 +19,7 @@ import {
|
|
|
22
19
|
formatEdrNetworkConfigAccounts,
|
|
23
20
|
} from "./helpers.js";
|
|
24
21
|
import { JsonRpcServerImplementation } from "./json-rpc/server.js";
|
|
22
|
+
import { resolveNodeConnectionParams } from "./utils/resolve-node-connection-params.js";
|
|
25
23
|
|
|
26
24
|
const log = createDebug("hardhat:core:tasks:node");
|
|
27
25
|
|
|
@@ -56,55 +54,7 @@ const nodeAction: NewTaskActionFunction<NodeActionArguments> = async (
|
|
|
56
54
|
});
|
|
57
55
|
}
|
|
58
56
|
|
|
59
|
-
const connectionParams
|
|
60
|
-
network: string;
|
|
61
|
-
chainType?: ChainType;
|
|
62
|
-
override?: EdrNetworkConfigOverride;
|
|
63
|
-
} = {
|
|
64
|
-
network,
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// NOTE: We create an empty network config override here. We add to it based
|
|
68
|
-
// on the result of arguments parsing. We can expand the list of arguments
|
|
69
|
-
// as much as needed.
|
|
70
|
-
const networkConfigOverride: EdrNetworkConfigOverride = {};
|
|
71
|
-
|
|
72
|
-
if (args.chainType !== undefined) {
|
|
73
|
-
if (!isSupportedChainType(args.chainType)) {
|
|
74
|
-
throw new HardhatError(
|
|
75
|
-
HardhatError.ERRORS.CORE.ARGUMENTS.INVALID_VALUE_FOR_TYPE,
|
|
76
|
-
{
|
|
77
|
-
value: args.chainType,
|
|
78
|
-
type: "ChainType",
|
|
79
|
-
name: "chainType",
|
|
80
|
-
},
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
connectionParams.chainType = args.chainType;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (args.chainId !== -1) {
|
|
87
|
-
networkConfigOverride.chainId = args.chainId;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// NOTE: --fork-block-number is only valid if --fork is specified
|
|
91
|
-
if (args.fork !== undefined) {
|
|
92
|
-
networkConfigOverride.forking = {
|
|
93
|
-
enabled: true,
|
|
94
|
-
url: args.fork,
|
|
95
|
-
...(args.forkBlockNumber !== -1
|
|
96
|
-
? { blockNumber: args.forkBlockNumber }
|
|
97
|
-
: undefined),
|
|
98
|
-
};
|
|
99
|
-
} else if (args.forkBlockNumber !== -1) {
|
|
100
|
-
// NOTE: We could make the error more specific here.
|
|
101
|
-
throw new HardhatError(
|
|
102
|
-
HardhatError.ERRORS.CORE.ARGUMENTS.MISSING_VALUE_FOR_ARGUMENT,
|
|
103
|
-
{
|
|
104
|
-
argument: "fork",
|
|
105
|
-
},
|
|
106
|
-
);
|
|
107
|
-
}
|
|
57
|
+
const connectionParams = resolveNodeConnectionParams(network, args);
|
|
108
58
|
|
|
109
59
|
// NOTE: This is where we initialize the network; the create method returns
|
|
110
60
|
// a fully resolved networkConfig object which might be useful for display
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { EdrNetworkConfigOverride } from "../../../../types/config.js";
|
|
2
|
+
import type { ChainType } from "../../../../types/network.js";
|
|
3
|
+
|
|
4
|
+
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
5
|
+
|
|
6
|
+
import { isSupportedChainType } from "../../../edr/chain-type.js";
|
|
7
|
+
|
|
8
|
+
export interface NodeConnectionArguments {
|
|
9
|
+
chainType?: string;
|
|
10
|
+
chainId: number;
|
|
11
|
+
fork?: string;
|
|
12
|
+
forkBlockNumber: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ResolvedNodeConnectionParams {
|
|
16
|
+
network: string;
|
|
17
|
+
chainType?: ChainType;
|
|
18
|
+
override?: EdrNetworkConfigOverride;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Resolves the arguments passed to the `node` task into the connection
|
|
23
|
+
* parameters used to create the underlying network connection.
|
|
24
|
+
*/
|
|
25
|
+
export function resolveNodeConnectionParams(
|
|
26
|
+
network: string,
|
|
27
|
+
args: NodeConnectionArguments,
|
|
28
|
+
): ResolvedNodeConnectionParams {
|
|
29
|
+
const connectionParams: ResolvedNodeConnectionParams = {
|
|
30
|
+
network,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// NOTE: We create an empty network config override here. We add to it based
|
|
34
|
+
// on the result of arguments parsing. We can expand the list of arguments
|
|
35
|
+
// as much as needed.
|
|
36
|
+
const networkConfigOverride: EdrNetworkConfigOverride = {};
|
|
37
|
+
|
|
38
|
+
if (args.chainType !== undefined) {
|
|
39
|
+
if (!isSupportedChainType(args.chainType)) {
|
|
40
|
+
throw new HardhatError(
|
|
41
|
+
HardhatError.ERRORS.CORE.ARGUMENTS.INVALID_VALUE_FOR_TYPE,
|
|
42
|
+
{
|
|
43
|
+
value: args.chainType,
|
|
44
|
+
type: "ChainType",
|
|
45
|
+
name: "chainType",
|
|
46
|
+
},
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
connectionParams.chainType = args.chainType;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (args.chainId !== -1) {
|
|
54
|
+
networkConfigOverride.chainId = args.chainId;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// NOTE: --fork-block-number is only valid if --fork is specified
|
|
58
|
+
if (args.fork !== undefined) {
|
|
59
|
+
networkConfigOverride.forking = {
|
|
60
|
+
enabled: true,
|
|
61
|
+
url: args.fork,
|
|
62
|
+
...(args.forkBlockNumber !== -1
|
|
63
|
+
? { blockNumber: args.forkBlockNumber }
|
|
64
|
+
: undefined),
|
|
65
|
+
};
|
|
66
|
+
} else if (args.forkBlockNumber !== -1) {
|
|
67
|
+
// NOTE: We could make the error more specific here.
|
|
68
|
+
throw new HardhatError(
|
|
69
|
+
HardhatError.ERRORS.CORE.ARGUMENTS.MISSING_VALUE_FOR_ARGUMENT,
|
|
70
|
+
{
|
|
71
|
+
argument: "fork",
|
|
72
|
+
},
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
connectionParams.override = networkConfigOverride;
|
|
77
|
+
|
|
78
|
+
return connectionParams;
|
|
79
|
+
}
|
|
@@ -1327,20 +1327,63 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1327
1327
|
options?: CompileBuildInfoOptions,
|
|
1328
1328
|
): Promise<CompilerOutput> {
|
|
1329
1329
|
const quiet = options?.quiet ?? false;
|
|
1330
|
+
const compilerType = buildInfo.compilerType ?? "solc";
|
|
1330
1331
|
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1332
|
+
if (compilerType === "solc") {
|
|
1333
|
+
// Build info recompilation for solc is self-contained: solc build info
|
|
1334
|
+
// files must be replayed with the same solc version. We bypass both
|
|
1335
|
+
// downloadCompilers and getCompiler hooks to preserve the historical solc
|
|
1336
|
+
// path and avoid making it depend on the current project config.
|
|
1337
|
+
await downloadSolcCompilers(new Set([buildInfo.solcVersion]), quiet);
|
|
1336
1338
|
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1339
|
+
const solcCompiler = await getCompiler(buildInfo.solcVersion, {
|
|
1340
|
+
preferWasm: false,
|
|
1341
|
+
});
|
|
1342
|
+
|
|
1343
|
+
return await solcCompiler.compile(buildInfo.input);
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
const partialCompilerConfig =
|
|
1347
|
+
this.#getPartialSolidityCompilerConfigFromBuildInfo(buildInfo);
|
|
1348
|
+
|
|
1349
|
+
await this.#hooks.runParallelHandlers("solidity", "downloadCompilers", [
|
|
1350
|
+
[partialCompilerConfig],
|
|
1351
|
+
quiet,
|
|
1352
|
+
]);
|
|
1353
|
+
|
|
1354
|
+
const compiler = await this.#hooks.runHandlerChain(
|
|
1355
|
+
"solidity",
|
|
1356
|
+
"getCompiler",
|
|
1357
|
+
[partialCompilerConfig],
|
|
1358
|
+
async () => {
|
|
1359
|
+
throw new HardhatError(
|
|
1360
|
+
HardhatError.ERRORS.CORE.SOLIDITY.BUILD_INFO_COMPILER_TYPE_NOT_HANDLED,
|
|
1361
|
+
{
|
|
1362
|
+
compilerType,
|
|
1363
|
+
version: buildInfo.solcVersion,
|
|
1364
|
+
},
|
|
1365
|
+
);
|
|
1366
|
+
},
|
|
1367
|
+
);
|
|
1340
1368
|
|
|
1341
1369
|
return await compiler.compile(buildInfo.input);
|
|
1342
1370
|
}
|
|
1343
1371
|
|
|
1372
|
+
#getPartialSolidityCompilerConfigFromBuildInfo(
|
|
1373
|
+
buildInfo: SolidityBuildInfo,
|
|
1374
|
+
): SolidityCompilerConfig {
|
|
1375
|
+
return {
|
|
1376
|
+
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions --
|
|
1377
|
+
Build infos may come from setups whose compiler type is unknown to the
|
|
1378
|
+
current Hardhat type definitions, but plugins can still handle them via
|
|
1379
|
+
the compiler hooks. */
|
|
1380
|
+
type: (buildInfo.compilerType ??
|
|
1381
|
+
"solc") as SolidityCompilerConfig["type"],
|
|
1382
|
+
version: buildInfo.solcVersion,
|
|
1383
|
+
settings: buildInfo.input.settings,
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1344
1387
|
async #downloadConfiguredCompilers(quiet = false): Promise<void> {
|
|
1345
1388
|
// We always print that we are downloading the compilers
|
|
1346
1389
|
quiet = false;
|