hardhat 3.4.1 → 3.4.3
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 +50 -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 +10 -3
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/console/task-action.js +4 -4
- package/dist/src/internal/builtin-plugins/console/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +7 -7
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.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/coverage/instrumentation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.js +7 -2
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/process-coverage.js +6 -6
- package/dist/src/internal/builtin-plugins/coverage/process-coverage.js.map +1 -1
- package/dist/src/internal/builtin-plugins/flatten/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/flatten/task-action.js +4 -4
- package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
- 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 +10 -10
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +12 -9
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.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/helpers/utils.js +2 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.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/snapshot-cheatcodes.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +11 -16
- 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.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +5 -5
- package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.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 +2 -41
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.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 +1 -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/trace-formatters.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js +21 -24
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js +13 -11
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js +2 -2
- package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/node/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.js +4 -4
- package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/json-rpc/server.js +2 -2
- package/dist/src/internal/builtin-plugins/node/json-rpc/server.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 +4 -4
- package/dist/src/internal/builtin-plugins/node/task-action.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 +68 -29
- 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-cost.d.ts +8 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js +46 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +9 -3
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +2 -2
- 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-wrapper.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js +7 -19
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +4 -3
- 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/utils.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js +12 -8
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +3 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +15 -6
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/constants.js +2 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.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 +6 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.js +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +1 -2
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +3 -3
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +19 -17
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +6 -3
- 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 +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +9 -7
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/cli/banner-manager.js +2 -2
- package/dist/src/internal/cli/banner-manager.js.map +1 -1
- package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
- package/dist/src/internal/cli/error-handler.js +6 -6
- package/dist/src/internal/cli/error-handler.js.map +1 -1
- package/dist/src/internal/cli/help/get-help-string.js +2 -2
- package/dist/src/internal/cli/help/get-help-string.js.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +57 -36
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/init/package-manager.d.ts.map +1 -1
- package/dist/src/internal/cli/init/package-manager.js +5 -5
- package/dist/src/internal/cli/init/package-manager.js.map +1 -1
- package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
- package/dist/src/internal/cli/init/prompt.js +3 -3
- package/dist/src/internal/cli/init/prompt.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 +2 -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 +17 -10
- 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/analytics/utils.js +2 -2
- package/dist/src/internal/cli/telemetry/analytics/utils.js.map +1 -1
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js +2 -2
- package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.js +2 -2
- package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/subprocess.js +2 -2
- package/dist/src/internal/cli/telemetry/sentry/subprocess.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/transport.js +2 -2
- package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
- package/dist/src/internal/cli/telemetry/telemetry-permissions.js +2 -2
- package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
- package/dist/src/internal/config-loading.js +2 -2
- package/dist/src/internal/config-loading.js.map +1 -1
- package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
- package/dist/src/internal/core/hook-manager.js +202 -58
- package/dist/src/internal/core/hook-manager.js.map +1 -1
- package/dist/src/internal/core/hre.js +2 -2
- 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/user-interruptions.js +4 -4
- package/dist/src/internal/core/user-interruptions.js.map +1 -1
- package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -1
- package/dist/src/internal/using-hardhat2-plugin-errors.js +2 -2
- package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -1
- package/package.json +6 -9
- package/src/cli.ts +5 -5
- package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +12 -5
- package/src/internal/builtin-plugins/console/task-action.ts +4 -4
- package/src/internal/builtin-plugins/coverage/coverage-manager.ts +7 -7
- 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/coverage/instrumentation.ts +21 -2
- package/src/internal/builtin-plugins/coverage/process-coverage.ts +6 -6
- package/src/internal/builtin-plugins/flatten/task-action.ts +8 -4
- package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +11 -10
- package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +13 -9
- package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +12 -5
- package/src/internal/builtin-plugins/gas-analytics/helpers/utils.ts +2 -2
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +29 -17
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +12 -15
- package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +11 -5
- 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 +2 -61
- 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 +1 -1
- package/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.ts +23 -23
- package/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.ts +14 -11
- package/src/internal/builtin-plugins/node/artifacts/build-info-watcher.ts +2 -2
- package/src/internal/builtin-plugins/node/helpers.ts +8 -5
- package/src/internal/builtin-plugins/node/json-rpc/server.ts +2 -2
- package/src/internal/builtin-plugins/node/task-action.ts +5 -4
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +92 -52
- package/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.ts +61 -0
- package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +17 -3
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +4 -2
- package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +2 -2
- package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts +19 -22
- package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +9 -1
- package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +16 -7
- package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +27 -6
- package/src/internal/builtin-plugins/solidity/config.ts +5 -2
- package/src/internal/builtin-plugins/solidity/constants.ts +3 -0
- package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +13 -4
- package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +3 -4
- package/src/internal/builtin-plugins/solidity-test/reporter.ts +19 -18
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +6 -3
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
- package/src/internal/builtin-plugins/test/task-action.ts +13 -7
- package/src/internal/cli/banner-manager.ts +2 -2
- package/src/internal/cli/error-handler.ts +10 -6
- package/src/internal/cli/help/get-help-string.ts +2 -2
- package/src/internal/cli/init/init.ts +86 -43
- package/src/internal/cli/init/package-manager.ts +8 -6
- package/src/internal/cli/init/prompt.ts +4 -3
- package/src/internal/cli/init/template.ts +22 -27
- package/src/internal/cli/main.ts +4 -3
- package/src/internal/cli/node-version.ts +20 -12
- package/src/internal/cli/telemetry/analytics/analytics.ts +2 -2
- package/src/internal/cli/telemetry/analytics/utils.ts +2 -2
- package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +2 -2
- package/src/internal/cli/telemetry/sentry/reporter.ts +2 -2
- package/src/internal/cli/telemetry/sentry/subprocess.ts +2 -2
- package/src/internal/cli/telemetry/sentry/transport.ts +2 -2
- package/src/internal/cli/telemetry/telemetry-permissions.ts +2 -2
- package/src/internal/config-loading.ts +2 -2
- package/src/internal/core/hook-manager.ts +283 -101
- package/src/internal/core/hre.ts +2 -2
- package/src/internal/core/lazy-user-interruptions.ts +75 -0
- package/src/internal/core/user-interruptions.ts +4 -4
- package/src/internal/using-hardhat2-plugin-errors.ts +2 -2
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +7 -7
- 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/dist/src/internal/utils/colorizer.d.ts +0 -10
- package/dist/src/internal/utils/colorizer.d.ts.map +0 -1
- package/dist/src/internal/utils/colorizer.js +0 -2
- package/dist/src/internal/utils/colorizer.js.map +0 -1
- package/src/internal/builtin-plugins/coverage/helpers.ts +0 -63
- package/src/internal/utils/colorizer.ts +0 -9
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
CompilerOutput,
|
|
4
4
|
} from "../../../../../types/solidity/compiler-io.js";
|
|
5
5
|
import type { Compiler } from "../../../../../types/solidity/compiler.js";
|
|
6
|
+
import type { SemverVersion } from "@nomicfoundation/hardhat-utils/fast-semver";
|
|
6
7
|
|
|
7
8
|
import { spawn } from "node:child_process";
|
|
8
9
|
import fsPromises from "node:fs/promises";
|
|
@@ -16,13 +17,19 @@ import {
|
|
|
16
17
|
assertHardhatInvariant,
|
|
17
18
|
} from "@nomicfoundation/hardhat-errors";
|
|
18
19
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
20
|
+
import {
|
|
21
|
+
greaterThanOrEqual,
|
|
22
|
+
parseVersion,
|
|
23
|
+
} from "@nomicfoundation/hardhat-utils/fast-semver";
|
|
19
24
|
import {
|
|
20
25
|
mkdtemp,
|
|
21
26
|
readJsonFileAsStream,
|
|
22
27
|
remove,
|
|
23
28
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
24
29
|
import { createNonClosingWriter } from "@nomicfoundation/hardhat-utils/stream";
|
|
25
|
-
|
|
30
|
+
|
|
31
|
+
const NO_IMPORT_CALLBACK_MIN_VERSION: SemverVersion = [0, 8, 22];
|
|
32
|
+
const BASE_PATH_MIN_VERSION: SemverVersion = [0, 6, 9];
|
|
26
33
|
|
|
27
34
|
/**
|
|
28
35
|
* Spawns a compilation process and returns its output.
|
|
@@ -163,10 +170,17 @@ export class NativeCompiler implements Compiler {
|
|
|
163
170
|
// Logic to make sure that solc default import callback is not being used.
|
|
164
171
|
// If solcVersion is not defined or <= 0.6.8, do not add extra args.
|
|
165
172
|
if (this.version !== undefined) {
|
|
166
|
-
|
|
173
|
+
const parsed = parseVersion(this.version);
|
|
174
|
+
if (parsed === undefined) {
|
|
175
|
+
throw new HardhatError(
|
|
176
|
+
HardhatError.ERRORS.CORE.SOLIDITY.INVALID_SOLC_VERSION,
|
|
177
|
+
{ version: this.version },
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
if (greaterThanOrEqual(parsed, NO_IMPORT_CALLBACK_MIN_VERSION)) {
|
|
167
181
|
// version >= 0.8.22
|
|
168
182
|
args.push("--no-import-callback");
|
|
169
|
-
} else if (
|
|
183
|
+
} else if (greaterThanOrEqual(parsed, BASE_PATH_MIN_VERSION)) {
|
|
170
184
|
// version >= 0.6.9
|
|
171
185
|
const tmpFolder = await mkdtemp("hardhat-solc-");
|
|
172
186
|
args.push(`--base-path`);
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "@nomicfoundation/hardhat-errors";
|
|
12
12
|
import { bytesToHexString } from "@nomicfoundation/hardhat-utils/bytes";
|
|
13
13
|
import { sha256 } from "@nomicfoundation/hardhat-utils/crypto";
|
|
14
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
14
15
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
15
16
|
import {
|
|
16
17
|
chmod,
|
|
@@ -26,11 +27,12 @@ import { getPrefixedHexString } from "@nomicfoundation/hardhat-utils/hex";
|
|
|
26
27
|
import { download } from "@nomicfoundation/hardhat-utils/request";
|
|
27
28
|
import { MultiProcessMutex } from "@nomicfoundation/hardhat-utils/synchronization";
|
|
28
29
|
import AdmZip from "adm-zip";
|
|
29
|
-
import debug from "debug";
|
|
30
30
|
|
|
31
31
|
import { NativeCompiler, SolcJsCompiler } from "./compiler.js";
|
|
32
32
|
|
|
33
|
-
const log =
|
|
33
|
+
const log = createDebug(
|
|
34
|
+
"hardhat:core:solidity:build-system:compiler:downloader",
|
|
35
|
+
);
|
|
34
36
|
|
|
35
37
|
const COMPILER_REPOSITORY_URL = "https://binaries.soliditylang.org";
|
|
36
38
|
const DEFAULT_COMPILER_DOWNLOAD_RETRY_COUNT = 3;
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
assertHardhatInvariant,
|
|
10
10
|
HardhatError,
|
|
11
11
|
} from "@nomicfoundation/hardhat-errors";
|
|
12
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
12
13
|
import { exists, isBinaryFile } from "@nomicfoundation/hardhat-utils/fs";
|
|
13
14
|
import { getCacheDir } from "@nomicfoundation/hardhat-utils/global-dir";
|
|
14
|
-
import debug from "debug";
|
|
15
15
|
|
|
16
16
|
import { hasArm64MirrorBuild, hasOfficialArm64Build } from "../solc-info.js";
|
|
17
17
|
|
|
@@ -28,7 +28,7 @@ async function getGlobalCompilersCacheDir(): Promise<string> {
|
|
|
28
28
|
return path.join(globalCompilersCacheDir, "compilers-v3");
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const log =
|
|
31
|
+
const log = createDebug("hardhat:core:solidity:build-system:compiler");
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Returns true if a platform-specific build exists for the given version
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
// This wrapper was created by extracting the parts of the solc-js package
|
|
2
2
|
// (https://github.com/ethereum/solc-js) that we need to perform compilation.
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import type { SemverVersion } from "@nomicfoundation/hardhat-utils/fast-semver";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
HardhatError,
|
|
8
|
+
assertHardhatInvariant,
|
|
9
|
+
} from "@nomicfoundation/hardhat-errors";
|
|
10
|
+
import {
|
|
11
|
+
greaterThanOrEqual,
|
|
12
|
+
parseVersion,
|
|
13
|
+
} from "@nomicfoundation/hardhat-utils/fast-semver";
|
|
14
|
+
|
|
15
|
+
const VERSION_6: SemverVersion = [0, 6, 0];
|
|
6
16
|
|
|
7
17
|
interface Solc {
|
|
8
18
|
cwrap<T>(ident: string, returnType: string | null, argTypes: string[]): T;
|
|
@@ -36,8 +46,13 @@ export type CompileWrapper = (input: string) => string;
|
|
|
36
46
|
|
|
37
47
|
export default function wrapper(solc: Solc): SolcWrapper {
|
|
38
48
|
const version = bindVersion(solc);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
49
|
+
const rawVersion = version();
|
|
50
|
+
const parsedVersion = parseVersion(rawVersion);
|
|
51
|
+
assertHardhatInvariant(
|
|
52
|
+
parsedVersion !== undefined,
|
|
53
|
+
`Invalid solc version: ${rawVersion}`,
|
|
54
|
+
);
|
|
55
|
+
const isVersion6OrNewer = greaterThanOrEqual(parsedVersion, VERSION_6);
|
|
41
56
|
const reset = bindReset(solc);
|
|
42
57
|
const compile = bindCompile(solc, isVersion6OrNewer);
|
|
43
58
|
|
|
@@ -124,21 +139,3 @@ function bindCompile(
|
|
|
124
139
|
|
|
125
140
|
return undefined;
|
|
126
141
|
}
|
|
127
|
-
|
|
128
|
-
function versionToSemver(version: string): string {
|
|
129
|
-
// FIXME: parse more detail, but this is a good start
|
|
130
|
-
const parsed = version.match(
|
|
131
|
-
/^([0-9]+\.[0-9]+\.[0-9]+)-([0-9a-f]{8})[/*].*$/,
|
|
132
|
-
);
|
|
133
|
-
if (parsed !== null) {
|
|
134
|
-
return parsed[1] + "+commit." + parsed[2];
|
|
135
|
-
}
|
|
136
|
-
if (version.indexOf("0.1.3-0") !== -1) {
|
|
137
|
-
return "0.1.3";
|
|
138
|
-
}
|
|
139
|
-
if (version.indexOf("0.3.5-0") !== -1) {
|
|
140
|
-
return "0.3.5";
|
|
141
|
-
}
|
|
142
|
-
// assume it is already semver compatible
|
|
143
|
-
return version;
|
|
144
|
-
}
|
|
@@ -24,7 +24,10 @@ import type { Result } from "../../../../../types/utils.js";
|
|
|
24
24
|
import path from "node:path";
|
|
25
25
|
|
|
26
26
|
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
exists,
|
|
29
|
+
TrueCasePathResolver,
|
|
30
|
+
} from "@nomicfoundation/hardhat-utils/fs";
|
|
28
31
|
import { AsyncMutex } from "@nomicfoundation/hardhat-utils/synchronization";
|
|
29
32
|
import { analyze } from "@nomicfoundation/solidity-analyzer";
|
|
30
33
|
|
|
@@ -82,6 +85,9 @@ export class ResolverImplementation implements Resolver {
|
|
|
82
85
|
*/
|
|
83
86
|
readonly #fakeRootFile: ProjectResolvedFile;
|
|
84
87
|
|
|
88
|
+
readonly #trueCasePathResolver: TrueCasePathResolver =
|
|
89
|
+
new TrueCasePathResolver();
|
|
90
|
+
|
|
85
91
|
/**
|
|
86
92
|
* Creates a new resolver.
|
|
87
93
|
*
|
|
@@ -221,6 +227,7 @@ export class ResolverImplementation implements Resolver {
|
|
|
221
227
|
}
|
|
222
228
|
|
|
223
229
|
const pathValidation = await validateFsPath(
|
|
230
|
+
this.#trueCasePathResolver,
|
|
224
231
|
this.#projectRoot,
|
|
225
232
|
relativeFilePath,
|
|
226
233
|
);
|
|
@@ -839,6 +846,7 @@ export class ResolverImplementation implements Resolver {
|
|
|
839
846
|
>
|
|
840
847
|
> {
|
|
841
848
|
const pathValidation = await validateFsPath(
|
|
849
|
+
this.#trueCasePathResolver,
|
|
842
850
|
npmPackage.rootFsPath,
|
|
843
851
|
relativeFsPathWithinPackage,
|
|
844
852
|
);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { ResolvedNpmPackage } from "../../../../../types/solidity.js";
|
|
2
2
|
import type { Result } from "../../../../../types/utils.js";
|
|
3
|
+
import type { TrueCasePathResolver } from "@nomicfoundation/hardhat-utils/fs";
|
|
3
4
|
|
|
4
5
|
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
5
6
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
6
7
|
import {
|
|
7
8
|
FileNotFoundError,
|
|
8
|
-
|
|
9
|
+
NotADirectoryError,
|
|
9
10
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
10
11
|
import { exports } from "resolve.exports";
|
|
11
12
|
|
|
@@ -15,6 +16,7 @@ export enum PathValidationErrorType {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export async function validateFsPath(
|
|
19
|
+
resolver: TrueCasePathResolver,
|
|
18
20
|
from: string,
|
|
19
21
|
relative: string,
|
|
20
22
|
): Promise<
|
|
@@ -26,14 +28,21 @@ export async function validateFsPath(
|
|
|
26
28
|
> {
|
|
27
29
|
let trueCaseFsPath: string;
|
|
28
30
|
try {
|
|
29
|
-
trueCaseFsPath = await getFileTrueCase(from, relative);
|
|
31
|
+
trueCaseFsPath = await resolver.getFileTrueCase(from, relative);
|
|
30
32
|
} catch (error) {
|
|
31
|
-
ensureError(error
|
|
33
|
+
ensureError(error);
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
error
|
|
36
|
-
|
|
35
|
+
if (
|
|
36
|
+
error instanceof FileNotFoundError ||
|
|
37
|
+
error instanceof NotADirectoryError
|
|
38
|
+
) {
|
|
39
|
+
return {
|
|
40
|
+
success: false,
|
|
41
|
+
error: { type: PathValidationErrorType.DOES_NOT_EXIST },
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
throw error;
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
if (relative !== trueCaseFsPath) {
|
|
@@ -1,19 +1,33 @@
|
|
|
1
|
+
import type { SemverVersion } from "@nomicfoundation/hardhat-utils/fast-semver";
|
|
2
|
+
|
|
1
3
|
import os from "node:os";
|
|
2
4
|
|
|
3
|
-
import
|
|
5
|
+
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
6
|
+
import {
|
|
7
|
+
greaterThanOrEqual,
|
|
8
|
+
lowerThan,
|
|
9
|
+
parseVersion,
|
|
10
|
+
} from "@nomicfoundation/hardhat-utils/fast-semver";
|
|
4
11
|
|
|
5
12
|
// The first solc version with official ARM64 Linux builds
|
|
6
|
-
export const FIRST_OFFICIAL_ARM64_SOLC_VERSION =
|
|
13
|
+
export const FIRST_OFFICIAL_ARM64_SOLC_VERSION: SemverVersion = [0, 8, 31];
|
|
7
14
|
|
|
8
15
|
// The lowest solc version available in the frozen ARM64 mirror repo
|
|
9
16
|
// (https://github.com/NomicFoundation/solc-linux-arm64-mirror/tree/main/public/linux/aarch64)
|
|
10
|
-
export const FIRST_ARM64_MIRROR_SOLC_VERSION =
|
|
17
|
+
export const FIRST_ARM64_MIRROR_SOLC_VERSION: SemverVersion = [0, 5, 0];
|
|
11
18
|
|
|
12
19
|
/**
|
|
13
20
|
* Determines if a solc version has an official ARM64 Linux build.
|
|
14
21
|
*/
|
|
15
22
|
export function hasOfficialArm64Build(version: string): boolean {
|
|
16
|
-
|
|
23
|
+
const parsed = parseVersion(version);
|
|
24
|
+
if (parsed === undefined) {
|
|
25
|
+
throw new HardhatError(
|
|
26
|
+
HardhatError.ERRORS.CORE.SOLIDITY.INVALID_SOLC_VERSION,
|
|
27
|
+
{ version },
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return greaterThanOrEqual(parsed, FIRST_OFFICIAL_ARM64_SOLC_VERSION);
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
/**
|
|
@@ -21,9 +35,16 @@ export function hasOfficialArm64Build(version: string): boolean {
|
|
|
21
35
|
* in the community mirror (versions 0.5.0–0.8.30).
|
|
22
36
|
*/
|
|
23
37
|
export function hasArm64MirrorBuild(version: string): boolean {
|
|
38
|
+
const parsed = parseVersion(version);
|
|
39
|
+
if (parsed === undefined) {
|
|
40
|
+
throw new HardhatError(
|
|
41
|
+
HardhatError.ERRORS.CORE.SOLIDITY.INVALID_SOLC_VERSION,
|
|
42
|
+
{ version },
|
|
43
|
+
);
|
|
44
|
+
}
|
|
24
45
|
return (
|
|
25
|
-
|
|
26
|
-
|
|
46
|
+
greaterThanOrEqual(parsed, FIRST_ARM64_MIRROR_SOLC_VERSION) &&
|
|
47
|
+
lowerThan(parsed, FIRST_OFFICIAL_ARM64_SOLC_VERSION)
|
|
27
48
|
);
|
|
28
49
|
}
|
|
29
50
|
|
|
@@ -32,7 +32,10 @@ import {
|
|
|
32
32
|
hasOfficialArm64Build,
|
|
33
33
|
missesSomeOfficialNativeBuilds,
|
|
34
34
|
} from "./build-system/solc-info.js";
|
|
35
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
DEFAULT_OUTPUT_SELECTION,
|
|
37
|
+
SOLC_DEFAULT_OPTIMIZER_RUNS,
|
|
38
|
+
} from "./constants.js";
|
|
36
39
|
|
|
37
40
|
/**
|
|
38
41
|
* The top-level type SolidityUserConfig is a union type too complex for
|
|
@@ -542,7 +545,7 @@ function resolveSolidityCompilerConfig(
|
|
|
542
545
|
if (production && isSolcSolidityCompilerUserConfig(compilerConfig)) {
|
|
543
546
|
defaultSettings.optimizer = {
|
|
544
547
|
enabled: true,
|
|
545
|
-
runs:
|
|
548
|
+
runs: SOLC_DEFAULT_OPTIMIZER_RUNS,
|
|
546
549
|
};
|
|
547
550
|
}
|
|
548
551
|
|
|
@@ -21,7 +21,14 @@ import type {
|
|
|
21
21
|
CompilerOutputError,
|
|
22
22
|
} from "../../../../types/solidity/compiler-io.js";
|
|
23
23
|
import type { SolidityBuildInfo } from "../../../../types/solidity.js";
|
|
24
|
-
import type {
|
|
24
|
+
import type {
|
|
25
|
+
SolidityBuildSystemOptions,
|
|
26
|
+
SolidityBuildSystemImplementation as SolidityBuildSystemImplementationT,
|
|
27
|
+
} from "../build-system/build-system.js";
|
|
28
|
+
|
|
29
|
+
let SolidityBuildSystemImplementation:
|
|
30
|
+
| typeof SolidityBuildSystemImplementationT
|
|
31
|
+
| undefined;
|
|
25
32
|
|
|
26
33
|
class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
27
34
|
readonly #hooks: HookManager;
|
|
@@ -126,9 +133,11 @@ class LazySolidityBuildSystem implements SolidityBuildSystem {
|
|
|
126
133
|
}
|
|
127
134
|
|
|
128
135
|
async #getBuildSystem(): Promise<SolidityBuildSystem> {
|
|
129
|
-
|
|
130
|
-
"../build-system/build-system.js"
|
|
131
|
-
|
|
136
|
+
if (SolidityBuildSystemImplementation === undefined) {
|
|
137
|
+
const buildSystemModule = await import("../build-system/build-system.js");
|
|
138
|
+
SolidityBuildSystemImplementation =
|
|
139
|
+
buildSystemModule.SolidityBuildSystemImplementation;
|
|
140
|
+
}
|
|
132
141
|
|
|
133
142
|
if (this.#buildSystem === undefined) {
|
|
134
143
|
this.#buildSystem = new SolidityBuildSystemImplementation(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Abi } from "../../../types/artifacts.js";
|
|
2
2
|
import type { ChainType } from "../../../types/network.js";
|
|
3
3
|
import type { SolidityTestConfig } from "../../../types/test.js";
|
|
4
|
-
import type { Colorizer } from "../../utils/colorizer.js";
|
|
5
4
|
import type {
|
|
6
5
|
SolidityTestRunnerConfigArgs,
|
|
7
6
|
PathPermission,
|
|
@@ -10,6 +9,8 @@ import type {
|
|
|
10
9
|
TestFunctionOverride,
|
|
11
10
|
} from "@nomicfoundation/edr";
|
|
12
11
|
|
|
12
|
+
import { styleText } from "node:util";
|
|
13
|
+
|
|
13
14
|
import {
|
|
14
15
|
opGenesisState,
|
|
15
16
|
l1GenesisState,
|
|
@@ -19,7 +20,6 @@ import {
|
|
|
19
20
|
l1HardforkFromString,
|
|
20
21
|
} from "@nomicfoundation/edr";
|
|
21
22
|
import { hexStringToBytes } from "@nomicfoundation/hardhat-utils/hex";
|
|
22
|
-
import chalk from "chalk";
|
|
23
23
|
|
|
24
24
|
import { DEFAULT_VERBOSITY, OPTIMISM_CHAIN_TYPE } from "../../constants.js";
|
|
25
25
|
import { resolveHardfork } from "../network-manager/config-resolution.js";
|
|
@@ -161,7 +161,6 @@ export function isTestSuiteArtifact(artifact: Artifact): boolean {
|
|
|
161
161
|
export function warnDeprecatedTestFail(
|
|
162
162
|
artifact: Artifact,
|
|
163
163
|
sourceNameToUserSourceName: Map<string, string>,
|
|
164
|
-
colorizer: Colorizer = chalk,
|
|
165
164
|
): void {
|
|
166
165
|
const abi: Abi = JSON.parse(artifact.contract.abi);
|
|
167
166
|
|
|
@@ -175,7 +174,7 @@ export function warnDeprecatedTestFail(
|
|
|
175
174
|
artifact.id,
|
|
176
175
|
sourceNameToUserSourceName,
|
|
177
176
|
);
|
|
178
|
-
const warningMessage = `${
|
|
177
|
+
const warningMessage = `${styleText("yellow", "Warning")}: ${name} The support for the prefix \`testFail*\` has been removed. Consider using \`vm.expectRevert()\` for testing reverts in ${formattedLocation}\n`;
|
|
179
178
|
|
|
180
179
|
console.warn(warningMessage);
|
|
181
180
|
}
|
|
@@ -3,11 +3,11 @@ import type {
|
|
|
3
3
|
TestReporterResult,
|
|
4
4
|
TestStatus,
|
|
5
5
|
} from "./types.js";
|
|
6
|
-
import type { Colorizer } from "../../utils/colorizer.js";
|
|
7
6
|
import type { TestResult } from "@nomicfoundation/edr";
|
|
8
7
|
|
|
8
|
+
import { styleText } from "node:util";
|
|
9
|
+
|
|
9
10
|
import { bytesToHexString } from "@nomicfoundation/hardhat-utils/hex";
|
|
10
|
-
import chalk from "chalk";
|
|
11
11
|
|
|
12
12
|
import { sendErrorTelemetry } from "../../cli/telemetry/error-reporter/reporter.js";
|
|
13
13
|
import { SolidityTestStackTraceGenerationError } from "../network-manager/edr/stack-traces/stack-trace-generation-errors.js";
|
|
@@ -55,7 +55,8 @@ export async function* testReporter(
|
|
|
55
55
|
sourceNameToUserSourceName: Map<string, string>,
|
|
56
56
|
verbosity: number,
|
|
57
57
|
testSummaryIndex: number = 0,
|
|
58
|
-
|
|
58
|
+
// Allow passing a custom colorize function for testing purposes
|
|
59
|
+
colorize: typeof styleText = styleText,
|
|
59
60
|
): TestReporterResult {
|
|
60
61
|
let runSuccessCount = 0;
|
|
61
62
|
let runFailureCount = testSummaryIndex === 0 ? 1 : testSummaryIndex;
|
|
@@ -97,7 +98,7 @@ export async function* testReporter(
|
|
|
97
98
|
if (suiteResult.warnings.length > 0) {
|
|
98
99
|
indenter.inc();
|
|
99
100
|
for (const warning of suiteResult.warnings) {
|
|
100
|
-
yield indenter.t`${
|
|
101
|
+
yield indenter.t`${colorize("yellow", "Warning")}${colorize("grey", `: ${warning}`)}\n`;
|
|
101
102
|
}
|
|
102
103
|
indenter.dec();
|
|
103
104
|
yield "\n";
|
|
@@ -137,9 +138,9 @@ export async function* testReporter(
|
|
|
137
138
|
|
|
138
139
|
switch (status) {
|
|
139
140
|
case "Success": {
|
|
140
|
-
let successOutput = `${
|
|
141
|
+
let successOutput = `${colorize("green", "✔")} ${colorize("grey", name)}`;
|
|
141
142
|
if (details !== "") {
|
|
142
|
-
successOutput +=
|
|
143
|
+
successOutput += colorize("dim", details);
|
|
143
144
|
}
|
|
144
145
|
yield indenter.t`${successOutput}\n`;
|
|
145
146
|
suiteSuccessCount++;
|
|
@@ -153,7 +154,7 @@ export async function* testReporter(
|
|
|
153
154
|
}
|
|
154
155
|
case "Failure": {
|
|
155
156
|
failures.push({ testResult, contractName: suiteResult.id.name });
|
|
156
|
-
yield indenter.t`${
|
|
157
|
+
yield indenter.t`${colorize("red", `${runFailureCount}) ${name}`)}\n`;
|
|
157
158
|
runFailureCount++;
|
|
158
159
|
if (verbosity >= 3) {
|
|
159
160
|
printExecutionTraces = true;
|
|
@@ -164,7 +165,7 @@ export async function* testReporter(
|
|
|
164
165
|
break;
|
|
165
166
|
}
|
|
166
167
|
case "Skipped": {
|
|
167
|
-
yield indenter.t`${
|
|
168
|
+
yield indenter.t`${colorize("cyan", `- ${name}`)}\n`;
|
|
168
169
|
suiteSkippedCount++;
|
|
169
170
|
break;
|
|
170
171
|
}
|
|
@@ -194,7 +195,7 @@ export async function* testReporter(
|
|
|
194
195
|
indenter.inc();
|
|
195
196
|
yield indenter.t`Call Traces:\n`;
|
|
196
197
|
indenter.inc();
|
|
197
|
-
yield `${formatTraces(callTraces, indenter.prefix(),
|
|
198
|
+
yield `${formatTraces(callTraces, indenter.prefix(), colorize)}\n`;
|
|
198
199
|
indenter.dec();
|
|
199
200
|
indenter.dec();
|
|
200
201
|
if (testIndex < suiteResult.testResults.length - 1) {
|
|
@@ -226,12 +227,12 @@ export async function* testReporter(
|
|
|
226
227
|
yield "\n";
|
|
227
228
|
yield "\n";
|
|
228
229
|
|
|
229
|
-
yield indenter.t`${
|
|
230
|
+
yield indenter.t`${colorize("green", `${runSuccessCount} passing`)}\n`;
|
|
230
231
|
if (failures.length > 0) {
|
|
231
|
-
yield indenter.t`${
|
|
232
|
+
yield indenter.t`${colorize("red", `${failures.length} failing`)}\n`;
|
|
232
233
|
}
|
|
233
234
|
if (runSkippedCount > 0) {
|
|
234
|
-
yield indenter.t`${
|
|
235
|
+
yield indenter.t`${colorize("cyan", `${runSkippedCount} skipped`)}\n`;
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
238
|
|
|
@@ -273,7 +274,7 @@ export async function* testReporter(
|
|
|
273
274
|
? "FFI is disabled; set `test.solidity.ffi` to `true` in your Hardhat config to allow tests to call external commands"
|
|
274
275
|
: failure.reason ?? "Unknown error";
|
|
275
276
|
}
|
|
276
|
-
yield* output(indenter.t`${
|
|
277
|
+
yield* output(indenter.t`${colorize("red", `Error: ${reason}`)}\n`);
|
|
277
278
|
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- Ignore Cases not matched: undefined
|
|
278
279
|
switch (stackTrace?.kind) {
|
|
279
280
|
case "StackTrace":
|
|
@@ -287,7 +288,7 @@ export async function* testReporter(
|
|
|
287
288
|
}
|
|
288
289
|
}
|
|
289
290
|
if (stackTraceStack.length > 0) {
|
|
290
|
-
yield* output(`${
|
|
291
|
+
yield* output(`${colorize("grey", stackTraceStack.join("\n"))}\n`);
|
|
291
292
|
}
|
|
292
293
|
yield* output("\n");
|
|
293
294
|
break;
|
|
@@ -296,13 +297,13 @@ export async function* testReporter(
|
|
|
296
297
|
new SolidityTestStackTraceGenerationError(stackTrace.errorMessage),
|
|
297
298
|
);
|
|
298
299
|
yield* output(
|
|
299
|
-
indenter.t`Stack Trace Warning: ${
|
|
300
|
+
indenter.t`Stack Trace Warning: ${colorize("grey", stackTrace.errorMessage)}\n`,
|
|
300
301
|
);
|
|
301
302
|
break;
|
|
302
303
|
case "UnsafeToReplay":
|
|
303
304
|
if (stackTrace.globalForkLatest === true) {
|
|
304
305
|
yield* output(
|
|
305
|
-
indenter.t`Stack Trace Warning: ${
|
|
306
|
+
indenter.t`Stack Trace Warning: ${colorize("grey", "The test is not safe to replay because a fork url without a fork block number was provided.")}\n`,
|
|
306
307
|
);
|
|
307
308
|
yield* output(
|
|
308
309
|
indenter.t`Try rerunning your tests with -vvv or above.\n`,
|
|
@@ -310,7 +311,7 @@ export async function* testReporter(
|
|
|
310
311
|
}
|
|
311
312
|
if (stackTrace.impureCheatcodes.length > 0) {
|
|
312
313
|
yield* output(
|
|
313
|
-
indenter.t`Stack Trace Warning: ${
|
|
314
|
+
indenter.t`Stack Trace Warning: ${colorize("grey", `The test is not safe to replay because it uses impure cheatcodes: ${stackTrace.impureCheatcodes.join(", ")}`)}\n`,
|
|
314
315
|
);
|
|
315
316
|
yield* output(
|
|
316
317
|
indenter.t`Try rerunning your tests with -vvv or above.\n`,
|
|
@@ -335,7 +336,7 @@ export async function* testReporter(
|
|
|
335
336
|
for (const [key, value] of Object.entries(counterexample)) {
|
|
336
337
|
const counterExampleDetails = `${key}: ${Buffer.isBuffer(value) ? bytesToHexString(value) : value}`;
|
|
337
338
|
yield* output(
|
|
338
|
-
indenter.t`${
|
|
339
|
+
indenter.t`${colorize("grey", counterExampleDetails)}\n`,
|
|
339
340
|
);
|
|
340
341
|
}
|
|
341
342
|
indenter.dec();
|
|
@@ -27,7 +27,7 @@ import { getFullyQualifiedName } from "../../../utils/contract-names.js";
|
|
|
27
27
|
import { errorResult, successfulResult } from "../../../utils/result.js";
|
|
28
28
|
import { isSupportedChainType } from "../../edr/chain-type.js";
|
|
29
29
|
import { ArtifactManagerImplementation } from "../artifacts/artifact-manager.js";
|
|
30
|
-
import { getCoverageManager } from "../coverage/helpers.js";
|
|
30
|
+
import { getCoverageManager } from "../coverage/helpers/accessors.js";
|
|
31
31
|
import { getGasAnalyticsManager } from "../gas-analytics/helpers/accessors.js";
|
|
32
32
|
import { edrGasReportToHardhatGasMeasurements } from "../network-manager/edr/utils/convert-to-edr.js";
|
|
33
33
|
|
|
@@ -141,8 +141,11 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
141
141
|
({ edrArtifactsWithMetadata, allBuildInfosAndOutputs } =
|
|
142
142
|
await loadArtifacts(hre.solidity, ["contracts"]));
|
|
143
143
|
|
|
144
|
-
// When noCompile, validate
|
|
145
|
-
|
|
144
|
+
// When noCompile is enabled, only validate compiled artifacts for test roots
|
|
145
|
+
// explicitly selected by the user. If no files were specified, skip
|
|
146
|
+
// validating every discovered test root and run whatever compiled test
|
|
147
|
+
// suites are available.
|
|
148
|
+
if (noCompile === true && testFiles.length > 0) {
|
|
146
149
|
const compiledSources = new Set(
|
|
147
150
|
edrArtifactsWithMetadata.map(({ userSourceName }) =>
|
|
148
151
|
resolveFromRoot(hre.config.paths.root, userSourceName),
|
|
@@ -7,16 +7,17 @@ import type {
|
|
|
7
7
|
import type { TestSummary } from "../../../types/test.js";
|
|
8
8
|
import type { Result } from "../../../types/utils.js";
|
|
9
9
|
|
|
10
|
+
import { styleText } from "node:util";
|
|
11
|
+
|
|
10
12
|
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
11
13
|
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
12
|
-
import chalk, { type ChalkInstance } from "chalk";
|
|
13
14
|
|
|
14
15
|
import {
|
|
15
16
|
errorResult,
|
|
16
17
|
isResult,
|
|
17
18
|
successfulResult,
|
|
18
19
|
} from "../../../utils/result.js";
|
|
19
|
-
import { getCoverageManager } from "../coverage/helpers.js";
|
|
20
|
+
import { getCoverageManager } from "../coverage/helpers/accessors.js";
|
|
20
21
|
import { getGasAnalyticsManager } from "../gas-analytics/helpers/accessors.js";
|
|
21
22
|
|
|
22
23
|
interface TestActionArguments {
|
|
@@ -194,19 +195,23 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
if (passed.length > 0) {
|
|
197
|
-
logSummaryLine("passing", passed,
|
|
198
|
+
logSummaryLine("passing", passed, (text: string) =>
|
|
199
|
+
styleText("green", text),
|
|
200
|
+
);
|
|
198
201
|
}
|
|
199
202
|
|
|
200
203
|
if (failed.length > 0) {
|
|
201
|
-
logSummaryLine("failing", failed,
|
|
204
|
+
logSummaryLine("failing", failed, (text: string) => styleText("red", text));
|
|
202
205
|
}
|
|
203
206
|
|
|
204
207
|
if (skipped.length > 0) {
|
|
205
|
-
logSummaryLine("skipped", skipped,
|
|
208
|
+
logSummaryLine("skipped", skipped, (text: string) =>
|
|
209
|
+
styleText("cyan", text),
|
|
210
|
+
);
|
|
206
211
|
}
|
|
207
212
|
|
|
208
213
|
if (todo.length > 0) {
|
|
209
|
-
logSummaryLine("todo", todo,
|
|
214
|
+
logSummaryLine("todo", todo, (text: string) => styleText("blue", text));
|
|
210
215
|
}
|
|
211
216
|
|
|
212
217
|
if (outputLines.length > 0) {
|
|
@@ -262,7 +267,8 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
262
267
|
function logSummaryLine(
|
|
263
268
|
label: string,
|
|
264
269
|
items: Array<[string, number]>,
|
|
265
|
-
|
|
270
|
+
// Allow passing a custom colorize function for testing purposes
|
|
271
|
+
color: (text: string) => string = (text) => styleText("white", text),
|
|
266
272
|
): void {
|
|
267
273
|
let total = 0;
|
|
268
274
|
const str = items
|
|
@@ -2,6 +2,7 @@ import type { Dispatcher } from "@nomicfoundation/hardhat-utils/request";
|
|
|
2
2
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
5
6
|
import {
|
|
6
7
|
readJsonFile,
|
|
7
8
|
writeJsonFile,
|
|
@@ -10,9 +11,8 @@ import {
|
|
|
10
11
|
import { getCacheDir } from "@nomicfoundation/hardhat-utils/global-dir";
|
|
11
12
|
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
12
13
|
import { getRequest } from "@nomicfoundation/hardhat-utils/request";
|
|
13
|
-
import debug from "debug";
|
|
14
14
|
|
|
15
|
-
const log =
|
|
15
|
+
const log = createDebug("hardhat:core:cli:banner-manager");
|
|
16
16
|
|
|
17
17
|
interface BannerConfig {
|
|
18
18
|
enabled: boolean;
|