hardhat 3.4.0 → 3.4.2
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 +36 -0
- package/dist/src/cli.js +5 -5
- package/dist/src/cli.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js +11 -4
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
- 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 +10 -10
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/clean/index.js +1 -1
- package/dist/src/internal/builtin-plugins/clean/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/console/index.js +1 -1
- package/dist/src/internal/builtin-plugins/console/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/exports.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js +24 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.js +27 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers/compat.js.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/clean.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/clean.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js +18 -15
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +3 -3
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/flatten/index.js +1 -1
- package/dist/src/internal/builtin-plugins/flatten/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js +10 -4
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js +18 -14
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js +2 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
- 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 +2 -7
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts +14 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js +40 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts +1 -12
- 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 +3 -42
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.js.map +1 -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 +2 -5
- 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.js +2 -2
- 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/hook-handlers/hre.js +4 -4
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js +7 -7
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.js +2 -2
- package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/index.js +1 -1
- package/dist/src/internal/builtin-plugins/node/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/run/index.js +1 -1
- package/dist/src/internal/builtin-plugins/run/index.js.map +1 -1
- 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 +61 -28
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +4 -4
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/read-source-file.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/read-source-file.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +10 -10
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js +16 -11
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js +4 -4
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/config.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/test.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/telemetry/index.js +1 -1
- package/dist/src/internal/builtin-plugins/telemetry/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/hook-handlers/config.js +1 -1
- package/dist/src/internal/builtin-plugins/test/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/index.js +1 -1
- package/dist/src/internal/builtin-plugins/test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +18 -9
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/init/template.d.ts.map +1 -1
- package/dist/src/internal/cli/init/template.js +5 -14
- package/dist/src/internal/cli/init/template.js.map +1 -1
- package/dist/src/internal/cli/main.d.ts.map +1 -1
- package/dist/src/internal/cli/main.js +4 -2
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/internal/cli/node-version.d.ts +1 -1
- package/dist/src/internal/cli/node-version.d.ts.map +1 -1
- package/dist/src/internal/cli/node-version.js +18 -8
- package/dist/src/internal/cli/node-version.js.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/analytics.js +2 -2
- package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.d.ts +6 -0
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.d.ts.map +1 -0
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js +47 -0
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.d.ts +27 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.d.ts.map +1 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.js +40 -0
- package/dist/src/internal/cli/telemetry/error-reporter/reporter.js.map +1 -0
- package/dist/src/internal/cli/telemetry/sentry/anonymizer.js +1 -1
- package/dist/src/internal/cli/telemetry/sentry/anonymizer.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/init.d.ts +0 -8
- package/dist/src/internal/cli/telemetry/sentry/init.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/init.js +1 -37
- package/dist/src/internal/cli/telemetry/sentry/init.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts +8 -2
- package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.js +18 -12
- package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/transport.js +1 -1
- package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
- package/dist/src/internal/cli/telemetry/telemetry-permissions.js +1 -1
- package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
- package/dist/src/internal/config-loading.js +3 -3
- package/dist/src/internal/config-loading.js.map +1 -1
- package/dist/src/internal/core/configuration-variables.d.ts.map +1 -1
- package/dist/src/internal/core/configuration-variables.js +1 -1
- package/dist/src/internal/core/configuration-variables.js.map +1 -1
- package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
- package/dist/src/internal/core/hook-manager.js +196 -59
- package/dist/src/internal/core/hook-manager.js.map +1 -1
- package/dist/src/internal/core/hre.d.ts.map +1 -1
- package/dist/src/internal/core/hre.js +5 -5
- package/dist/src/internal/core/hre.js.map +1 -1
- package/dist/src/internal/core/lazy-user-interruptions.d.ts +11 -0
- package/dist/src/internal/core/lazy-user-interruptions.d.ts.map +1 -0
- package/dist/src/internal/core/lazy-user-interruptions.js +39 -0
- package/dist/src/internal/core/lazy-user-interruptions.js.map +1 -0
- package/dist/src/internal/core/plugins/resolve-plugin-list.js +1 -1
- package/dist/src/internal/core/plugins/resolve-plugin-list.js.map +1 -1
- package/dist/src/internal/core/tasks/resolved-task.js +4 -4
- package/dist/src/internal/core/tasks/resolved-task.js.map +1 -1
- package/dist/src/internal/core/user-interruptions.js +9 -9
- package/dist/src/internal/core/user-interruptions.js.map +1 -1
- package/dist/src/internal/hre-initialization.js +1 -1
- package/dist/src/internal/hre-initialization.js.map +1 -1
- package/package.json +4 -4
- package/src/cli.ts +5 -5
- package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +13 -6
- package/src/internal/builtin-plugins/artifacts/hook-handlers/hre.ts +16 -10
- package/src/internal/builtin-plugins/clean/index.ts +1 -1
- package/src/internal/builtin-plugins/console/index.ts +1 -1
- package/src/internal/builtin-plugins/coverage/exports.ts +1 -1
- package/src/internal/builtin-plugins/coverage/helpers/accessors.ts +44 -0
- package/src/internal/builtin-plugins/coverage/helpers/compat.ts +37 -0
- package/src/internal/builtin-plugins/coverage/hook-handlers/clean.ts +1 -1
- package/src/internal/builtin-plugins/coverage/hook-handlers/hre.ts +26 -16
- package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +3 -3
- package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +1 -1
- package/src/internal/builtin-plugins/flatten/index.ts +1 -1
- package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +12 -5
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +29 -17
- package/src/internal/builtin-plugins/gas-analytics/index.ts +4 -2
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +2 -6
- package/src/internal/builtin-plugins/network-manager/config-resolution.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/edr-constants.ts +61 -0
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +3 -62
- package/src/internal/builtin-plugins/network-manager/edr/genesis-state.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/types/hardfork.ts +3 -9
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +2 -2
- package/src/internal/builtin-plugins/network-manager/hook-handlers/hre.ts +4 -4
- package/src/internal/builtin-plugins/network-manager/hook-handlers/network.ts +2 -2
- package/src/internal/builtin-plugins/network-manager/http-provider.ts +6 -2
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +11 -7
- package/src/internal/builtin-plugins/node/helpers.ts +2 -2
- package/src/internal/builtin-plugins/node/index.ts +1 -1
- package/src/internal/builtin-plugins/run/index.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +84 -49
- package/src/internal/builtin-plugins/solidity/build-system/compilation-job.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +4 -4
- package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +2 -2
- package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-runner.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/read-source-file.ts +2 -2
- package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +11 -11
- package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +1 -1
- package/src/internal/builtin-plugins/solidity/hook-handlers/config.ts +1 -1
- package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +27 -14
- package/src/internal/builtin-plugins/solidity/index.ts +1 -1
- package/src/internal/builtin-plugins/solidity/solidity-hooks.ts +1 -1
- package/src/internal/builtin-plugins/solidity/tasks/build.ts +4 -4
- package/src/internal/builtin-plugins/solidity-test/edr-artifacts.ts +2 -2
- package/src/internal/builtin-plugins/solidity-test/hook-handlers/config.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/hook-handlers/test.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/index.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/reporter.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +1 -1
- package/src/internal/builtin-plugins/telemetry/index.ts +1 -1
- package/src/internal/builtin-plugins/test/hook-handlers/config.ts +1 -1
- package/src/internal/builtin-plugins/test/index.ts +1 -1
- package/src/internal/builtin-plugins/test/task-action.ts +1 -1
- package/src/internal/cli/init/init.ts +32 -14
- package/src/internal/cli/init/template.ts +22 -27
- package/src/internal/cli/main.ts +5 -3
- package/src/internal/cli/node-version.ts +21 -10
- package/src/internal/cli/telemetry/analytics/analytics.ts +2 -2
- package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +64 -0
- package/src/internal/cli/telemetry/error-reporter/reporter.ts +49 -0
- package/src/internal/cli/telemetry/sentry/anonymizer.ts +1 -1
- package/src/internal/cli/telemetry/sentry/init.ts +2 -62
- package/src/internal/cli/telemetry/sentry/reporter.ts +27 -15
- package/src/internal/cli/telemetry/sentry/transport.ts +1 -1
- package/src/internal/cli/telemetry/telemetry-permissions.ts +1 -1
- package/src/internal/config-loading.ts +3 -3
- package/src/internal/core/configuration-variables.ts +19 -18
- package/src/internal/core/hook-manager.ts +267 -103
- package/src/internal/core/hre.ts +7 -5
- package/src/internal/core/lazy-user-interruptions.ts +75 -0
- package/src/internal/core/plugins/resolve-plugin-list.ts +1 -1
- package/src/internal/core/tasks/resolved-task.ts +4 -4
- package/src/internal/core/user-interruptions.ts +9 -9
- package/src/internal/hre-initialization.ts +1 -1
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +10 -10
- package/templates/hardhat-3/02-mocha-ethers/package.json +13 -13
- package/templates/hardhat-3/03-minimal/package.json +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +0 -15
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +0 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.js +0 -35
- package/dist/src/internal/builtin-plugins/coverage/helpers.js.map +0 -1
- package/src/internal/builtin-plugins/coverage/helpers.ts +0 -63
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { EdrNetworkHDAccountsConfig } from "../../../../types/config.js";
|
|
2
|
+
import type { DefaultHDAccountsConfigParams } from "../accounts/constants.js";
|
|
3
|
+
|
|
4
|
+
import { deepEqual } from "@nomicfoundation/hardhat-utils/lang";
|
|
5
|
+
|
|
6
|
+
import { DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS } from "../accounts/constants.js";
|
|
7
|
+
|
|
8
|
+
export const EDR_NETWORK_DEFAULT_COINBASE =
|
|
9
|
+
"0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e";
|
|
10
|
+
|
|
11
|
+
interface EdrNetworkDefaultHDAccountsConfigParams
|
|
12
|
+
extends DefaultHDAccountsConfigParams {
|
|
13
|
+
mnemonic: string;
|
|
14
|
+
accountsBalance: bigint;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const EDR_NETWORK_MNEMONIC =
|
|
18
|
+
"test test test test test test test test test test test junk";
|
|
19
|
+
export const DEFAULT_EDR_NETWORK_BALANCE = 10000000000000000000000n;
|
|
20
|
+
export const DEFAULT_EDR_NETWORK_HD_ACCOUNTS_CONFIG_PARAMS: EdrNetworkDefaultHDAccountsConfigParams =
|
|
21
|
+
{
|
|
22
|
+
...DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS,
|
|
23
|
+
mnemonic: EDR_NETWORK_MNEMONIC,
|
|
24
|
+
accountsBalance: DEFAULT_EDR_NETWORK_BALANCE,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export async function isDefaultEdrNetworkHDAccountsConfig(
|
|
28
|
+
accounts: EdrNetworkHDAccountsConfig,
|
|
29
|
+
): Promise<boolean> {
|
|
30
|
+
return await deepEqual(
|
|
31
|
+
{
|
|
32
|
+
...accounts,
|
|
33
|
+
mnemonic: await accounts.mnemonic.get(),
|
|
34
|
+
passphrase: await accounts.passphrase.get(),
|
|
35
|
+
},
|
|
36
|
+
DEFAULT_EDR_NETWORK_HD_ACCOUNTS_CONFIG_PARAMS,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const EDR_NETWORK_DEFAULT_PRIVATE_KEYS: string[] = [
|
|
41
|
+
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
|
|
42
|
+
"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
|
|
43
|
+
"0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a",
|
|
44
|
+
"0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6",
|
|
45
|
+
"0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
|
|
46
|
+
"0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
|
|
47
|
+
"0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e",
|
|
48
|
+
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356",
|
|
49
|
+
"0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97",
|
|
50
|
+
"0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6",
|
|
51
|
+
"0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897",
|
|
52
|
+
"0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82",
|
|
53
|
+
"0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1",
|
|
54
|
+
"0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd",
|
|
55
|
+
"0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa",
|
|
56
|
+
"0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61",
|
|
57
|
+
"0xea6c44ac03bff858b476bba40716402b03e41b8e97e276d1baec7c37d42484a0",
|
|
58
|
+
"0x689af8efa8c651a91ad287602527f3af2fe9f6501a7ac4b061667b5a93e037fd",
|
|
59
|
+
"0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0",
|
|
60
|
+
"0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e",
|
|
61
|
+
];
|
|
@@ -3,7 +3,6 @@ import type { LoggerConfig } from "./types/logger.js";
|
|
|
3
3
|
import type {
|
|
4
4
|
ChainDescriptorsConfig,
|
|
5
5
|
EdrNetworkConfig,
|
|
6
|
-
EdrNetworkHDAccountsConfig,
|
|
7
6
|
} from "../../../../types/config.js";
|
|
8
7
|
import type {
|
|
9
8
|
EthSubscription,
|
|
@@ -13,7 +12,6 @@ import type {
|
|
|
13
12
|
SuccessfulJsonRpcResponse,
|
|
14
13
|
} from "../../../../types/providers.js";
|
|
15
14
|
import type { RequireField } from "../../../../types/utils.js";
|
|
16
|
-
import type { DefaultHDAccountsConfigParams } from "../accounts/constants.js";
|
|
17
15
|
import type { JsonRpcRequestWrapperFunction } from "../network-manager.js";
|
|
18
16
|
import type { TraceOutputManager } from "./utils/trace-output.js";
|
|
19
17
|
import type {
|
|
@@ -33,14 +31,12 @@ import {
|
|
|
33
31
|
import { toSeconds } from "@nomicfoundation/hardhat-utils/date";
|
|
34
32
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
35
33
|
import { numberToHexString } from "@nomicfoundation/hardhat-utils/hex";
|
|
36
|
-
import { deepEqual } from "@nomicfoundation/hardhat-utils/lang";
|
|
37
34
|
import debug from "debug";
|
|
38
35
|
|
|
39
|
-
import { sendErrorTelemetry } from "../../../cli/telemetry/
|
|
36
|
+
import { sendErrorTelemetry } from "../../../cli/telemetry/error-reporter/reporter.js";
|
|
40
37
|
import { EDR_NETWORK_REVERT_SNAPSHOT_EVENT } from "../../../constants.js";
|
|
41
38
|
import { hardhatChainTypeToEdrChainType } from "../../../edr/chain-type.js";
|
|
42
39
|
import { getGlobalEdrContext } from "../../../edr/context.js";
|
|
43
|
-
import { DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS } from "../accounts/constants.js";
|
|
44
40
|
import { BaseProvider } from "../base-provider.js";
|
|
45
41
|
import { getJsonRpcRequest, isFailedJsonRpcResponse } from "../json-rpc.js";
|
|
46
42
|
import {
|
|
@@ -65,61 +61,6 @@ import { printLine, replaceLastLine } from "./utils/logger.js";
|
|
|
65
61
|
|
|
66
62
|
const log = debug("hardhat:core:hardhat-network:provider");
|
|
67
63
|
|
|
68
|
-
export const EDR_NETWORK_DEFAULT_COINBASE =
|
|
69
|
-
"0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e";
|
|
70
|
-
|
|
71
|
-
interface EdrNetworkDefaultHDAccountsConfigParams
|
|
72
|
-
extends DefaultHDAccountsConfigParams {
|
|
73
|
-
mnemonic: string;
|
|
74
|
-
accountsBalance: bigint;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export const EDR_NETWORK_MNEMONIC =
|
|
78
|
-
"test test test test test test test test test test test junk";
|
|
79
|
-
export const DEFAULT_EDR_NETWORK_BALANCE = 10000000000000000000000n;
|
|
80
|
-
export const DEFAULT_EDR_NETWORK_HD_ACCOUNTS_CONFIG_PARAMS: EdrNetworkDefaultHDAccountsConfigParams =
|
|
81
|
-
{
|
|
82
|
-
...DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS,
|
|
83
|
-
mnemonic: EDR_NETWORK_MNEMONIC,
|
|
84
|
-
accountsBalance: DEFAULT_EDR_NETWORK_BALANCE,
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export async function isDefaultEdrNetworkHDAccountsConfig(
|
|
88
|
-
accounts: EdrNetworkHDAccountsConfig,
|
|
89
|
-
): Promise<boolean> {
|
|
90
|
-
return deepEqual(
|
|
91
|
-
{
|
|
92
|
-
...accounts,
|
|
93
|
-
mnemonic: await accounts.mnemonic.get(),
|
|
94
|
-
passphrase: await accounts.passphrase.get(),
|
|
95
|
-
},
|
|
96
|
-
DEFAULT_EDR_NETWORK_HD_ACCOUNTS_CONFIG_PARAMS,
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export const EDR_NETWORK_DEFAULT_PRIVATE_KEYS: string[] = [
|
|
101
|
-
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
|
|
102
|
-
"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
|
|
103
|
-
"0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a",
|
|
104
|
-
"0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6",
|
|
105
|
-
"0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
|
|
106
|
-
"0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
|
|
107
|
-
"0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e",
|
|
108
|
-
"0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356",
|
|
109
|
-
"0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97",
|
|
110
|
-
"0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6",
|
|
111
|
-
"0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897",
|
|
112
|
-
"0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82",
|
|
113
|
-
"0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1",
|
|
114
|
-
"0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd",
|
|
115
|
-
"0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa",
|
|
116
|
-
"0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61",
|
|
117
|
-
"0xea6c44ac03bff858b476bba40716402b03e41b8e97e276d1baec7c37d42484a0",
|
|
118
|
-
"0x689af8efa8c651a91ad287602527f3af2fe9f6501a7ac4b061667b5a93e037fd",
|
|
119
|
-
"0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0",
|
|
120
|
-
"0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e",
|
|
121
|
-
];
|
|
122
|
-
|
|
123
64
|
interface EdrProviderConfig {
|
|
124
65
|
chainDescriptors: ChainDescriptorsConfig;
|
|
125
66
|
networkConfig: RequireField<EdrNetworkConfig, "chainType">;
|
|
@@ -325,7 +266,7 @@ export class EdrProvider extends BaseProvider {
|
|
|
325
266
|
typeof jsonRpcResponse.result === "string",
|
|
326
267
|
"Invalid client version response",
|
|
327
268
|
);
|
|
328
|
-
return clientVersion(jsonRpcResponse.result);
|
|
269
|
+
return await clientVersion(jsonRpcResponse.result);
|
|
329
270
|
} else {
|
|
330
271
|
return jsonRpcResponse.result;
|
|
331
272
|
}
|
|
@@ -496,7 +437,7 @@ export class EdrProvider extends BaseProvider {
|
|
|
496
437
|
throw new UnknownError(error.message, error);
|
|
497
438
|
}
|
|
498
439
|
|
|
499
|
-
return this.#handleEdrResponse(
|
|
440
|
+
return await this.#handleEdrResponse(
|
|
500
441
|
edrResponse,
|
|
501
442
|
request.method,
|
|
502
443
|
Array.isArray(request.params) ? request.params : undefined,
|
|
@@ -79,7 +79,7 @@ export async function getGenesisStateAndOwnedAccounts(
|
|
|
79
79
|
return cached;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
return genesisStateAndAccountsCacheMutex.exclusiveRun(async () => {
|
|
82
|
+
return await genesisStateAndAccountsCacheMutex.exclusiveRun(async () => {
|
|
83
83
|
// We need to check again inside the mutex callback in case another async
|
|
84
84
|
// operation initialized it while we were waiting to acquire the mutex
|
|
85
85
|
const cachedAfterWaiting = genesisStateAndAccountsCache
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { ChainType } from "../../../../../types/network.js";
|
|
2
2
|
|
|
3
|
-
import { l1HardforkLatest, opLatestHardfork } from "@nomicfoundation/edr";
|
|
4
|
-
|
|
5
3
|
import { OPTIMISM_CHAIN_TYPE } from "../../../../constants.js";
|
|
6
|
-
import {
|
|
7
|
-
edrL1HardforkToHardhatL1HardforkName,
|
|
8
|
-
edrOpHardforkToHardhatOpHardforkName,
|
|
9
|
-
} from "../utils/convert-to-edr.js";
|
|
10
4
|
|
|
11
5
|
export enum L1HardforkName {
|
|
12
6
|
FRONTIER = "chainstart",
|
|
@@ -51,9 +45,9 @@ export function getHardforks(chainType: ChainType): string[] {
|
|
|
51
45
|
}
|
|
52
46
|
|
|
53
47
|
export function getCurrentHardfork(chainType: ChainType): string {
|
|
54
|
-
|
|
55
|
-
?
|
|
56
|
-
|
|
48
|
+
const order =
|
|
49
|
+
chainType === OPTIMISM_CHAIN_TYPE ? OP_HARDFORK_ORDER : L1_HARDFORK_ORDER;
|
|
50
|
+
return order[order.length - 1];
|
|
57
51
|
}
|
|
58
52
|
|
|
59
53
|
/**
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
DEFAULT_EDR_NETWORK_BALANCE,
|
|
62
62
|
EDR_NETWORK_DEFAULT_PRIVATE_KEYS,
|
|
63
63
|
isDefaultEdrNetworkHDAccountsConfig,
|
|
64
|
-
} from "../edr-
|
|
64
|
+
} from "../edr-constants.js";
|
|
65
65
|
import { L1HardforkName, OpHardforkName } from "../types/hardfork.js";
|
|
66
66
|
|
|
67
67
|
import { getL1HardforkName, getOpHardforkName } from "./hardfork.js";
|
|
@@ -281,7 +281,7 @@ export async function hardhatAccountsToEdrOwnedAccounts(
|
|
|
281
281
|
balance: account.balance,
|
|
282
282
|
}));
|
|
283
283
|
|
|
284
|
-
return Promise.all(accountPromises);
|
|
284
|
+
return await Promise.all(accountPromises);
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
export async function normalizeEdrNetworkAccountsConfig(
|
|
@@ -17,7 +17,7 @@ export default async (): Promise<Partial<HardhatRuntimeEnvironmentHooks>> => ({
|
|
|
17
17
|
networkManager = await createNetworkManager(hre, context);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
return networkManager.create(networkConnectionParams);
|
|
20
|
+
return await networkManager.create(networkConnectionParams);
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
async connect(networkConnectionParams) {
|
|
@@ -25,7 +25,7 @@ export default async (): Promise<Partial<HardhatRuntimeEnvironmentHooks>> => ({
|
|
|
25
25
|
networkManager = await createNetworkManager(hre, context);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
return networkManager.connect(networkConnectionParams);
|
|
28
|
+
return await networkManager.connect(networkConnectionParams);
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
async getOrCreate(networkOrParams) {
|
|
@@ -33,7 +33,7 @@ export default async (): Promise<Partial<HardhatRuntimeEnvironmentHooks>> => ({
|
|
|
33
33
|
networkManager = await createNetworkManager(hre, context);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
return networkManager.getOrCreate(networkOrParams);
|
|
36
|
+
return await networkManager.getOrCreate(networkOrParams);
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
async createServer(...params) {
|
|
@@ -41,7 +41,7 @@ export default async (): Promise<Partial<HardhatRuntimeEnvironmentHooks>> => ({
|
|
|
41
41
|
networkManager = await createNetworkManager(hre, context);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
return networkManager.createServer(...params);
|
|
44
|
+
return await networkManager.createServer(...params);
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
|
|
@@ -78,7 +78,7 @@ export default async (): Promise<Partial<NetworkHooks>> => {
|
|
|
78
78
|
updatedRequest = newRequestOrResponse;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
return next(context, networkConnection, updatedRequest);
|
|
81
|
+
return await next(context, networkConnection, updatedRequest);
|
|
82
82
|
},
|
|
83
83
|
|
|
84
84
|
async closeConnection<ChainTypeT extends ChainType | string>(
|
|
@@ -93,7 +93,7 @@ export default async (): Promise<Partial<NetworkHooks>> => {
|
|
|
93
93
|
requestHandlersPerConnection.delete(networkConnection);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
return next(context, networkConnection);
|
|
96
|
+
return await next(context, networkConnection);
|
|
97
97
|
},
|
|
98
98
|
};
|
|
99
99
|
|
|
@@ -224,7 +224,11 @@ export class HttpProvider extends BaseProvider {
|
|
|
224
224
|
retryCount,
|
|
225
225
|
);
|
|
226
226
|
if (this.#shouldRetryRequest(retryAfterSeconds, retryCount)) {
|
|
227
|
-
return this.#retry(
|
|
227
|
+
return await this.#retry(
|
|
228
|
+
jsonRpcRequest,
|
|
229
|
+
retryAfterSeconds,
|
|
230
|
+
retryCount,
|
|
231
|
+
);
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
// eslint-disable-next-line no-restricted-syntax -- allow throwing ProviderError
|
|
@@ -269,7 +273,7 @@ export class HttpProvider extends BaseProvider {
|
|
|
269
273
|
retryCount: number,
|
|
270
274
|
) {
|
|
271
275
|
await sleep(retryAfterSeconds);
|
|
272
|
-
return this.#fetchJsonRpcResponse(request, retryCount + 1);
|
|
276
|
+
return await this.#fetchJsonRpcResponse(request, retryCount + 1);
|
|
273
277
|
}
|
|
274
278
|
}
|
|
275
279
|
|
|
@@ -116,7 +116,11 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
116
116
|
"newConnection",
|
|
117
117
|
[],
|
|
118
118
|
async (_context) =>
|
|
119
|
-
this.#initializeNetworkConnection(
|
|
119
|
+
await this.#initializeNetworkConnection(
|
|
120
|
+
networkName,
|
|
121
|
+
chainType,
|
|
122
|
+
override,
|
|
123
|
+
),
|
|
120
124
|
);
|
|
121
125
|
|
|
122
126
|
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
@@ -131,7 +135,7 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
131
135
|
): Promise<NetworkConnection<ChainTypeT>> {
|
|
132
136
|
this.#connectCalled = true;
|
|
133
137
|
|
|
134
|
-
return this.create(networkOrParams);
|
|
138
|
+
return await this.create(networkOrParams);
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
public async getOrCreate<
|
|
@@ -170,7 +174,7 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
170
174
|
return cached as NetworkConnection<ChainTypeT>;
|
|
171
175
|
}
|
|
172
176
|
|
|
173
|
-
return this.#getOrCreateMutex.exclusiveRun(async () => {
|
|
177
|
+
return await this.#getOrCreateMutex.exclusiveRun(async () => {
|
|
174
178
|
// Double-check after acquiring the mutex — another call may have
|
|
175
179
|
// populated the cache while we were waiting.
|
|
176
180
|
const cachedAfterWaiting = this.#getOrCreateCache
|
|
@@ -260,7 +264,7 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
260
264
|
"network",
|
|
261
265
|
"onRequest",
|
|
262
266
|
[networkConnection, request],
|
|
263
|
-
async (_context, _connection, req) => defaultBehavior(req),
|
|
267
|
+
async (_context, _connection, req) => await defaultBehavior(req),
|
|
264
268
|
);
|
|
265
269
|
|
|
266
270
|
if (resolvedNetworkConfig.type === "edr-simulated") {
|
|
@@ -351,7 +355,7 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
351
355
|
|
|
352
356
|
const includeCallTraces = verbosityToIncludeTraces(this.#verbosity);
|
|
353
357
|
|
|
354
|
-
return EdrProvider.create({
|
|
358
|
+
return await EdrProvider.create({
|
|
355
359
|
chainDescriptors: this.#chainDescriptors,
|
|
356
360
|
// The resolvedNetworkConfig can have its chainType set to `undefined`
|
|
357
361
|
// so we default to the default chain type here.
|
|
@@ -375,7 +379,7 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
375
379
|
});
|
|
376
380
|
}
|
|
377
381
|
|
|
378
|
-
return HttpProvider.create({
|
|
382
|
+
return await HttpProvider.create({
|
|
379
383
|
url: await resolvedNetworkConfig.url.getUrl(),
|
|
380
384
|
networkName: resolvedNetworkName,
|
|
381
385
|
extraHeaders: resolvedNetworkConfig.httpHeaders,
|
|
@@ -384,7 +388,7 @@ export class NetworkManagerImplementation implements NetworkManager {
|
|
|
384
388
|
});
|
|
385
389
|
};
|
|
386
390
|
|
|
387
|
-
return NetworkConnectionImplementation.create(
|
|
391
|
+
return await NetworkConnectionImplementation.create(
|
|
388
392
|
this.#nextConnectionId++,
|
|
389
393
|
resolvedNetworkName,
|
|
390
394
|
resolvedChainType,
|
|
@@ -16,8 +16,8 @@ import chalk from "chalk";
|
|
|
16
16
|
// micro-eth-signer is known to be slow to load, so we lazy load it
|
|
17
17
|
let microEthSigner: typeof MicroEthSignerT | undefined;
|
|
18
18
|
|
|
19
|
-
import { sendErrorTelemetry } from "../../cli/telemetry/
|
|
20
|
-
import { isDefaultEdrNetworkHDAccountsConfig } from "../network-manager/edr/edr-
|
|
19
|
+
import { sendErrorTelemetry } from "../../cli/telemetry/error-reporter/reporter.js";
|
|
20
|
+
import { isDefaultEdrNetworkHDAccountsConfig } from "../network-manager/edr/edr-constants.js";
|
|
21
21
|
import { normalizeEdrNetworkAccountsConfig } from "../network-manager/edr/utils/convert-to-edr.js";
|
|
22
22
|
|
|
23
23
|
export async function formatEdrNetworkConfigAccounts(
|
|
@@ -46,7 +46,7 @@ const hardhatPlugin: HardhatPlugin = {
|
|
|
46
46
|
type: ArgumentType.INT,
|
|
47
47
|
defaultValue: -1,
|
|
48
48
|
})
|
|
49
|
-
.setAction(async () => import("./task-action.js"))
|
|
49
|
+
.setAction(async () => await import("./task-action.js"))
|
|
50
50
|
.build(),
|
|
51
51
|
],
|
|
52
52
|
dependencies: () => [import("../network-manager/index.js")],
|
|
@@ -14,7 +14,7 @@ const hardhatPlugin: HardhatPlugin = {
|
|
|
14
14
|
name: "noCompile",
|
|
15
15
|
description: "Do not compile the project before running the script",
|
|
16
16
|
})
|
|
17
|
-
.setAction(async () => import("./task-action.js"))
|
|
17
|
+
.setAction(async () => await import("./task-action.js"))
|
|
18
18
|
.build(),
|
|
19
19
|
],
|
|
20
20
|
dependencies: () => [import("../solidity/index.js")],
|
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
writeJsonFile,
|
|
50
50
|
writeJsonFileAsStream,
|
|
51
51
|
writeUtf8File,
|
|
52
|
+
readdirOrEmpty,
|
|
52
53
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
53
54
|
import { shortenPath } from "@nomicfoundation/hardhat-utils/path";
|
|
54
55
|
import { createSpinner } from "@nomicfoundation/hardhat-utils/spinner";
|
|
@@ -176,23 +177,15 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
176
177
|
options: { scope?: BuildScope } = {},
|
|
177
178
|
): Promise<string[]> {
|
|
178
179
|
const scope = options.scope ?? "contracts";
|
|
179
|
-
const unified = !this.#options.solidityConfig.splitTestsCompilation;
|
|
180
180
|
|
|
181
181
|
this.#ensureSplitCompilationModeIfTestsScope(scope);
|
|
182
182
|
|
|
183
|
+
const unified = !this.#options.solidityConfig.splitTestsCompilation;
|
|
184
|
+
const { localContractFiles, sourceTestFiles } =
|
|
185
|
+
await this.#getSoliditySourcesRootFilePaths();
|
|
186
|
+
|
|
183
187
|
switch (scope) {
|
|
184
188
|
case "contracts": {
|
|
185
|
-
const localContractFiles = (
|
|
186
|
-
await Promise.all(
|
|
187
|
-
this.#options.soliditySourcesPaths.map((dir) =>
|
|
188
|
-
getAllFilesMatching(
|
|
189
|
-
dir,
|
|
190
|
-
(f) => f.endsWith(".sol") && !f.endsWith(".t.sol"),
|
|
191
|
-
),
|
|
192
|
-
),
|
|
193
|
-
)
|
|
194
|
-
).flat(1);
|
|
195
|
-
|
|
196
189
|
const npmFilesToBuild =
|
|
197
190
|
this.#options.solidityConfig.npmFilesToBuild.map(
|
|
198
191
|
npmModuleToNpmRootPath,
|
|
@@ -204,16 +197,12 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
204
197
|
|
|
205
198
|
// In unified mode, contracts scope returns all roots: contracts,
|
|
206
199
|
// tests, and npm files.
|
|
207
|
-
const testFiles =
|
|
208
|
-
await
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
return getAllFilesMatching(dir, (f) => f.endsWith(".t.sol"));
|
|
214
|
-
}),
|
|
215
|
-
])
|
|
216
|
-
).flat(1);
|
|
200
|
+
const testFiles = [
|
|
201
|
+
...(await getAllFilesMatching(this.#options.solidityTestsPath, (f) =>
|
|
202
|
+
f.endsWith(".sol"),
|
|
203
|
+
)),
|
|
204
|
+
...sourceTestFiles,
|
|
205
|
+
];
|
|
217
206
|
|
|
218
207
|
// Remove duplicates in case there is an intersection between
|
|
219
208
|
// the tests.solidity paths and the sources paths
|
|
@@ -222,16 +211,12 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
222
211
|
);
|
|
223
212
|
}
|
|
224
213
|
case "tests": {
|
|
225
|
-
let rootFilePaths =
|
|
226
|
-
await
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return getAllFilesMatching(dir, (f) => f.endsWith(".t.sol"));
|
|
232
|
-
}),
|
|
233
|
-
])
|
|
234
|
-
).flat(1);
|
|
214
|
+
let rootFilePaths = [
|
|
215
|
+
...(await getAllFilesMatching(this.#options.solidityTestsPath, (f) =>
|
|
216
|
+
f.endsWith(".sol"),
|
|
217
|
+
)),
|
|
218
|
+
...sourceTestFiles,
|
|
219
|
+
];
|
|
235
220
|
|
|
236
221
|
// NOTE: We remove duplicates in case there is an intersection between
|
|
237
222
|
// the tests.solidity paths and the sources paths
|
|
@@ -241,6 +226,46 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
241
226
|
}
|
|
242
227
|
}
|
|
243
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Returns all the root files from the different solidity source dirs in the
|
|
231
|
+
* config, partitioned into contract files and test files according to their
|
|
232
|
+
* extensions.
|
|
233
|
+
*/
|
|
234
|
+
async #getSoliditySourcesRootFilePaths(): Promise<{
|
|
235
|
+
localContractFiles: string[];
|
|
236
|
+
sourceTestFiles: string[];
|
|
237
|
+
}> {
|
|
238
|
+
const sourceFileGroups = await Promise.all(
|
|
239
|
+
this.#options.soliditySourcesPaths.map(async (dir) => {
|
|
240
|
+
const localSolidityFiles = await getAllFilesMatching(dir, (f) =>
|
|
241
|
+
f.endsWith(".sol"),
|
|
242
|
+
);
|
|
243
|
+
|
|
244
|
+
const localContractFiles: string[] = [];
|
|
245
|
+
const sourceTestFiles: string[] = [];
|
|
246
|
+
|
|
247
|
+
for (const file of localSolidityFiles) {
|
|
248
|
+
if (file.endsWith(".t.sol")) {
|
|
249
|
+
sourceTestFiles.push(file);
|
|
250
|
+
} else {
|
|
251
|
+
localContractFiles.push(file);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return { localContractFiles, sourceTestFiles };
|
|
256
|
+
}),
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
return {
|
|
260
|
+
localContractFiles: sourceFileGroups.flatMap(
|
|
261
|
+
({ localContractFiles }) => localContractFiles,
|
|
262
|
+
),
|
|
263
|
+
sourceTestFiles: sourceFileGroups.flatMap(
|
|
264
|
+
({ sourceTestFiles }) => sourceTestFiles,
|
|
265
|
+
),
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
244
269
|
public isSuccessfulBuildResult(
|
|
245
270
|
buildResult: CompilationJobCreationError | Map<string, FileBuildResult>,
|
|
246
271
|
): buildResult is Map<string, FileBuildResult> {
|
|
@@ -253,12 +278,12 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
253
278
|
): Promise<CompilationJobCreationError | Map<string, FileBuildResult>> {
|
|
254
279
|
this.#ensureSplitCompilationModeIfTestsScope(options?.scope);
|
|
255
280
|
|
|
256
|
-
return this.#hooks.runHandlerChain(
|
|
281
|
+
return await this.#hooks.runHandlerChain(
|
|
257
282
|
"solidity",
|
|
258
283
|
"build",
|
|
259
284
|
[rootFilePaths, options],
|
|
260
285
|
async (_context, nextRootFilePaths, nextOptions) =>
|
|
261
|
-
this.#build(nextRootFilePaths, nextOptions),
|
|
286
|
+
await this.#build(nextRootFilePaths, nextOptions),
|
|
262
287
|
);
|
|
263
288
|
}
|
|
264
289
|
|
|
@@ -308,8 +333,9 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
308
333
|
// NOTE: We precompute the build ids in parallel here, which are cached
|
|
309
334
|
// internally in each compilation job
|
|
310
335
|
await Promise.all(
|
|
311
|
-
runnableCompilationJobs.map(
|
|
312
|
-
runnableCompilationJob
|
|
336
|
+
runnableCompilationJobs.map(
|
|
337
|
+
async (runnableCompilationJob) =>
|
|
338
|
+
await runnableCompilationJob.getBuildId(),
|
|
313
339
|
),
|
|
314
340
|
);
|
|
315
341
|
|
|
@@ -539,7 +565,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
539
565
|
"getCompiler",
|
|
540
566
|
[compilerConfig],
|
|
541
567
|
async (_context, cfg) =>
|
|
542
|
-
getSolcCompilerForConfig(cfg, buildProfile.preferWasm),
|
|
568
|
+
await getSolcCompilerForConfig(cfg, buildProfile.preferWasm),
|
|
543
569
|
);
|
|
544
570
|
longVersion = compiler.longVersion;
|
|
545
571
|
longVersionMap.set(compilerConfig.version, longVersion);
|
|
@@ -805,7 +831,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
805
831
|
"getCompiler",
|
|
806
832
|
[runnableCompilationJob.solcConfig],
|
|
807
833
|
async (_context, cfg) =>
|
|
808
|
-
getSolcCompilerForConfig(cfg, buildProfile.preferWasm),
|
|
834
|
+
await getSolcCompilerForConfig(cfg, buildProfile.preferWasm),
|
|
809
835
|
);
|
|
810
836
|
|
|
811
837
|
log(
|
|
@@ -824,7 +850,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
824
850
|
"invokeSolc",
|
|
825
851
|
[compiler, input, runnableCompilationJob.solcConfig],
|
|
826
852
|
async (_context, nextCompiler, nextSolcInput) => {
|
|
827
|
-
return nextCompiler.compile(nextSolcInput);
|
|
853
|
+
return await nextCompiler.compile(nextSolcInput);
|
|
828
854
|
},
|
|
829
855
|
);
|
|
830
856
|
|
|
@@ -1097,18 +1123,23 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1097
1123
|
reachableBuildInfoIds.filter((id) => id !== undefined),
|
|
1098
1124
|
);
|
|
1099
1125
|
|
|
1100
|
-
//
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
);
|
|
1126
|
+
// The build-info directory is expected to be flat: every build-info file
|
|
1127
|
+
// lives directly under it, so a non-recursive `readdir` is enough.
|
|
1128
|
+
const buildInfoFiles = await readdirOrEmpty(buildInfosDir);
|
|
1104
1129
|
|
|
1105
1130
|
for (const buildInfoFile of buildInfoFiles) {
|
|
1106
|
-
|
|
1131
|
+
let id: string | undefined;
|
|
1107
1132
|
|
|
1108
|
-
|
|
1133
|
+
if (buildInfoFile.endsWith(".output.json")) {
|
|
1134
|
+
id = buildInfoFile.slice(0, -".output.json".length);
|
|
1135
|
+
} else if (buildInfoFile.endsWith(".json")) {
|
|
1136
|
+
id = buildInfoFile.slice(0, -".json".length);
|
|
1137
|
+
} else {
|
|
1138
|
+
continue;
|
|
1139
|
+
}
|
|
1109
1140
|
|
|
1110
1141
|
if (!reachableBuildInfoIdsSet.has(id)) {
|
|
1111
|
-
await remove(buildInfoFile);
|
|
1142
|
+
await remove(path.join(buildInfosDir, buildInfoFile));
|
|
1112
1143
|
}
|
|
1113
1144
|
}
|
|
1114
1145
|
|
|
@@ -1165,7 +1196,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1165
1196
|
preferWasm: false,
|
|
1166
1197
|
});
|
|
1167
1198
|
|
|
1168
|
-
return compiler.compile(buildInfo.input);
|
|
1199
|
+
return await compiler.compile(buildInfo.input);
|
|
1169
1200
|
}
|
|
1170
1201
|
|
|
1171
1202
|
async #downloadConfiguredCompilers(quiet = false): Promise<void> {
|
|
@@ -1200,8 +1231,12 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1200
1231
|
);
|
|
1201
1232
|
}
|
|
1202
1233
|
|
|
1234
|
+
#isFatalError(error: CompilerOutputError): boolean {
|
|
1235
|
+
return error.type !== "Warning" && error.severity === "error";
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1203
1238
|
#hasCompilationErrors(output: CompilerOutput): boolean {
|
|
1204
|
-
return output.errors?.some((
|
|
1239
|
+
return output.errors?.some((e) => this.#isFatalError(e)) ?? false;
|
|
1205
1240
|
}
|
|
1206
1241
|
|
|
1207
1242
|
/**
|
|
@@ -1314,7 +1349,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1314
1349
|
console.log();
|
|
1315
1350
|
|
|
1316
1351
|
for (const error of filteredErrors) {
|
|
1317
|
-
if (error
|
|
1352
|
+
if (this.#isFatalError(error)) {
|
|
1318
1353
|
const errorMessage: string =
|
|
1319
1354
|
this.#getFormattedInternalCompilerErrorMessage(error) ??
|
|
1320
1355
|
error.formattedMessage ??
|
|
@@ -92,7 +92,7 @@ export class CompilationJobImplementation implements CompilationJob {
|
|
|
92
92
|
// instrument the project file content when coverage feature is enabled.
|
|
93
93
|
// We pass some additional data via the chain - i.e. the input source name and solc
|
|
94
94
|
// version - but we expect any handlers to pass them on as-is without modification.
|
|
95
|
-
return this.#hooks.runHandlerChain(
|
|
95
|
+
return await this.#hooks.runHandlerChain(
|
|
96
96
|
"solidity",
|
|
97
97
|
"preprocessProjectFileBeforeBuilding",
|
|
98
98
|
[file.inputSourceName, file.fsPath, file.content.text, solcVersion],
|