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
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
Statement,
|
|
5
5
|
} from "./types.js";
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import { styleText } from "node:util";
|
|
8
8
|
|
|
9
9
|
// Use constants for the Uint8Array to improve memory usage (1 byte vs 8 bytes per item)
|
|
10
10
|
const STATUS_NOT_EXECUTED = 0; // equivalent to false
|
|
@@ -399,7 +399,7 @@ function printStatementsForDebugging(
|
|
|
399
399
|
console.debug(counter++ + " ---");
|
|
400
400
|
|
|
401
401
|
for (let i = statement.startUtf16; i < statement.endUtf16; i++) {
|
|
402
|
-
process.stdout.write(
|
|
402
|
+
process.stdout.write(styleText("gray", fileContent[i]));
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
console.debug();
|
|
@@ -413,7 +413,7 @@ function printStatementsForDebugging(
|
|
|
413
413
|
console.debug(counter++ + " ---");
|
|
414
414
|
|
|
415
415
|
for (let i = statement.startUtf16; i < statement.endUtf16; i++) {
|
|
416
|
-
process.stdout.write(
|
|
416
|
+
process.stdout.write(styleText("gray", fileContent[i]));
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
console.debug();
|
|
@@ -432,11 +432,11 @@ function printCharacterCoverageForDebugging(
|
|
|
432
432
|
): void {
|
|
433
433
|
for (let i = 0; i < characterCoverage.length; i++) {
|
|
434
434
|
if (characterCoverage[i] === STATUS_IGNORED) {
|
|
435
|
-
process.stdout.write(
|
|
435
|
+
process.stdout.write(styleText("gray", fileContent[i]));
|
|
436
436
|
} else if (characterCoverage[i] === STATUS_EXECUTED) {
|
|
437
|
-
process.stdout.write(
|
|
437
|
+
process.stdout.write(styleText("green", fileContent[i]));
|
|
438
438
|
} else {
|
|
439
|
-
process.stdout.write(
|
|
439
|
+
process.stdout.write(styleText("red", fileContent[i]));
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { NewTaskActionFunction } from "../../../types/tasks.js";
|
|
2
2
|
|
|
3
|
+
import { styleText } from "node:util";
|
|
4
|
+
|
|
3
5
|
import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
|
|
4
|
-
import chalk from "chalk";
|
|
5
6
|
|
|
6
7
|
import {
|
|
7
8
|
ResolvedFileType,
|
|
@@ -108,7 +109,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
|
|
|
108
109
|
|
|
109
110
|
if (filesWithoutLicenses.length > 0) {
|
|
110
111
|
warn(
|
|
111
|
-
|
|
112
|
+
styleText(
|
|
113
|
+
"yellow",
|
|
112
114
|
`\nThe following file(s) do NOT specify SPDX licenses: ${filesWithoutLicenses.join(
|
|
113
115
|
", ",
|
|
114
116
|
)}`,
|
|
@@ -118,7 +120,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
|
|
|
118
120
|
|
|
119
121
|
if (pragmaDirective !== "" && filesWithoutPragmaDirectives.length > 0) {
|
|
120
122
|
warn(
|
|
121
|
-
|
|
123
|
+
styleText(
|
|
124
|
+
"yellow",
|
|
122
125
|
`\nPragma abicoder directives are defined in some files, but they are not defined in the following ones: ${filesWithoutPragmaDirectives.join(
|
|
123
126
|
", ",
|
|
124
127
|
)}`,
|
|
@@ -128,7 +131,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
|
|
|
128
131
|
|
|
129
132
|
if (filesWithDifferentPragmaDirectives.length > 0) {
|
|
130
133
|
warn(
|
|
131
|
-
|
|
134
|
+
styleText(
|
|
135
|
+
"yellow",
|
|
132
136
|
`\nThe flattened file is using the pragma abicoder directive '${pragmaDirective}' but these files have a different pragma abicoder directive: ${filesWithDifferentPragmaDirectives.join(
|
|
133
137
|
", ",
|
|
134
138
|
)}`,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SuiteResult } from "@nomicfoundation/edr";
|
|
2
2
|
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { styleText } from "node:util";
|
|
4
5
|
|
|
5
6
|
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
6
7
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
writeUtf8File,
|
|
11
12
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
12
13
|
import { findDuplicates } from "@nomicfoundation/hardhat-utils/lang";
|
|
13
|
-
import chalk from "chalk";
|
|
14
14
|
|
|
15
15
|
import {
|
|
16
16
|
getFullyQualifiedName,
|
|
@@ -388,7 +388,8 @@ export function logFunctionGasSnapshotsSection(
|
|
|
388
388
|
if (isFirstTimeWrite) {
|
|
389
389
|
logger();
|
|
390
390
|
logger(
|
|
391
|
-
|
|
391
|
+
styleText(
|
|
392
|
+
"green",
|
|
392
393
|
" No existing snapshots found. Function gas snapshots written successfully",
|
|
393
394
|
),
|
|
394
395
|
);
|
|
@@ -408,7 +409,7 @@ export function logFunctionGasSnapshotsSection(
|
|
|
408
409
|
"\n",
|
|
409
410
|
);
|
|
410
411
|
for (const line of addedLines) {
|
|
411
|
-
logger(
|
|
412
|
+
logger(styleText("green", ` + ${line}`));
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
415
|
|
|
@@ -419,7 +420,7 @@ export function logFunctionGasSnapshotsSection(
|
|
|
419
420
|
comparison.removed,
|
|
420
421
|
).split("\n");
|
|
421
422
|
for (const line of removedLines) {
|
|
422
|
-
logger(
|
|
423
|
+
logger(styleText("red", ` - ${line}`));
|
|
423
424
|
}
|
|
424
425
|
}
|
|
425
426
|
|
|
@@ -435,10 +436,10 @@ export function printFunctionGasSnapshotChanges(
|
|
|
435
436
|
const isLast = i === changes.length - 1;
|
|
436
437
|
|
|
437
438
|
logger(` ${change.contractNameOrFqn}#${change.functionSig}`);
|
|
438
|
-
logger(
|
|
439
|
+
logger(styleText("grey", ` (in ${change.source})`));
|
|
439
440
|
|
|
440
441
|
if (change.kind === "fuzz") {
|
|
441
|
-
logger(
|
|
442
|
+
logger(styleText("grey", ` Runs: ${change.runs}`));
|
|
442
443
|
}
|
|
443
444
|
|
|
444
445
|
const diff = change.actual - change.expected;
|
|
@@ -454,15 +455,15 @@ export function printFunctionGasSnapshotChanges(
|
|
|
454
455
|
|
|
455
456
|
// Color: green for decrease (improvement), red for increase (regression)
|
|
456
457
|
const formattedGasChange =
|
|
457
|
-
diff < 0 ?
|
|
458
|
+
diff < 0 ? styleText("green", gasChange) : styleText("red", gasChange);
|
|
458
459
|
|
|
459
460
|
const label = change.kind === "fuzz" ? "~" : "gas";
|
|
460
461
|
|
|
461
|
-
logger(
|
|
462
|
+
logger(styleText("grey", ` Expected (${label}): ${change.expected}`));
|
|
462
463
|
logger(
|
|
463
|
-
|
|
464
|
+
styleText("grey", ` Actual (${label}): ${change.actual} (`) +
|
|
464
465
|
formattedGasChange +
|
|
465
|
-
|
|
466
|
+
styleText("grey", ")"),
|
|
466
467
|
);
|
|
467
468
|
|
|
468
469
|
if (!isLast) {
|
|
@@ -10,11 +10,13 @@ import type { TableItem } from "@nomicfoundation/hardhat-utils/format";
|
|
|
10
10
|
|
|
11
11
|
import crypto from "node:crypto";
|
|
12
12
|
import path from "node:path";
|
|
13
|
+
import { styleText } from "node:util";
|
|
13
14
|
|
|
14
15
|
import {
|
|
15
16
|
HardhatError,
|
|
16
17
|
assertHardhatInvariant,
|
|
17
18
|
} from "@nomicfoundation/hardhat-errors";
|
|
19
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
18
20
|
import { formatTable } from "@nomicfoundation/hardhat-utils/format";
|
|
19
21
|
import {
|
|
20
22
|
ensureDir,
|
|
@@ -26,8 +28,6 @@ import {
|
|
|
26
28
|
writeJsonFile,
|
|
27
29
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
28
30
|
import { findDuplicates } from "@nomicfoundation/hardhat-utils/lang";
|
|
29
|
-
import chalk from "chalk";
|
|
30
|
-
import debug from "debug";
|
|
31
31
|
|
|
32
32
|
import { parseFullyQualifiedName } from "../../../utils/contract-names.js";
|
|
33
33
|
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
median,
|
|
42
42
|
} from "./helpers/utils.js";
|
|
43
43
|
|
|
44
|
-
const gasStatsLog =
|
|
44
|
+
const gasStatsLog = createDebug(
|
|
45
45
|
"hardhat:core:gas-analytics:gas-analytics-manager:gas-stats",
|
|
46
46
|
);
|
|
47
47
|
|
|
@@ -311,7 +311,10 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
|
|
|
311
311
|
const rows: TableItem[] = [];
|
|
312
312
|
|
|
313
313
|
if (gasStatsByContract.size > 0) {
|
|
314
|
-
rows.push({
|
|
314
|
+
rows.push({
|
|
315
|
+
type: "title",
|
|
316
|
+
text: styleText("bold", "Gas Usage Statistics"),
|
|
317
|
+
});
|
|
315
318
|
}
|
|
316
319
|
|
|
317
320
|
const sortedContracts = getSortedContractEntries(gasStatsByContract);
|
|
@@ -322,8 +325,9 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
|
|
|
322
325
|
} of sortedContracts) {
|
|
323
326
|
rows.push({
|
|
324
327
|
type: "section-header",
|
|
325
|
-
text:
|
|
326
|
-
subtitle:
|
|
328
|
+
text: styleText(["cyan", "bold"], userFqn),
|
|
329
|
+
subtitle:
|
|
330
|
+
proxyLabel !== undefined ? styleText("cyan", proxyLabel) : undefined,
|
|
327
331
|
});
|
|
328
332
|
|
|
329
333
|
if (contractGasStats.functions.size > 0) {
|
|
@@ -336,7 +340,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
|
|
|
336
340
|
"Median",
|
|
337
341
|
"Max",
|
|
338
342
|
"#calls",
|
|
339
|
-
].map((s) =>
|
|
343
|
+
].map((s) => styleText("yellow", s)),
|
|
340
344
|
});
|
|
341
345
|
}
|
|
342
346
|
|
|
@@ -372,7 +376,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
|
|
|
372
376
|
"Median",
|
|
373
377
|
"Max",
|
|
374
378
|
"#deployments",
|
|
375
|
-
].map((s) =>
|
|
379
|
+
].map((s) => styleText("yellow", s)),
|
|
376
380
|
});
|
|
377
381
|
rows.push({
|
|
378
382
|
type: "row",
|
|
@@ -388,7 +392,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
|
|
|
388
392
|
rows.push({
|
|
389
393
|
type: "header",
|
|
390
394
|
cells: [
|
|
391
|
-
|
|
395
|
+
styleText("yellow", "Bytecode size"),
|
|
392
396
|
`${contractGasStats.deployment.runtimeSize}`,
|
|
393
397
|
],
|
|
394
398
|
});
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
// NOTE: This file is imported from hot paths — the plugin's `created` hook
|
|
2
|
+
// handler and task-actions that may run on every `hardhat test` invocation
|
|
3
|
+
// regardless of whether the feature is enabled. It must stay lightweight:
|
|
4
|
+
// do not add top-level imports that pull in the gas-analytics-manager module
|
|
5
|
+
// graph (debug, node:crypto, file-system traversal, etc.), or the
|
|
6
|
+
// `--gas-stats` lazy-load is silently defeated for every caller.
|
|
7
|
+
// If a new helper needs a heavy dependency, put it in a sibling file
|
|
8
|
+
// (e.g. `helpers/utils.ts`) so the accessors file's import cost stays flat.
|
|
9
|
+
|
|
1
10
|
import type { HookContext } from "../../../../types/hooks.js";
|
|
2
11
|
import type { HardhatRuntimeEnvironment } from "../../../../types/hre.js";
|
|
3
12
|
import type { GasAnalyticsManager } from "../types.js";
|
|
@@ -5,16 +14,14 @@ import type { GasAnalyticsManager } from "../types.js";
|
|
|
5
14
|
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
6
15
|
|
|
7
16
|
import { HardhatRuntimeEnvironmentImplementation } from "../../../core/hre.js";
|
|
8
|
-
import { GasAnalyticsManagerImplementation } from "../gas-analytics-manager.js";
|
|
9
17
|
|
|
10
18
|
export function getGasAnalyticsManager(
|
|
11
19
|
hookContextOrHre: HookContext | HardhatRuntimeEnvironment,
|
|
12
20
|
): GasAnalyticsManager {
|
|
13
21
|
assertHardhatInvariant(
|
|
14
|
-
|
|
15
|
-
hookContextOrHre._gasAnalytics
|
|
16
|
-
|
|
17
|
-
"Expected _gasAnalytics to be an instance of GasAnalyticsManagerImplementation",
|
|
22
|
+
hookContextOrHre instanceof HardhatRuntimeEnvironmentImplementation &&
|
|
23
|
+
hookContextOrHre._gasAnalytics !== undefined,
|
|
24
|
+
"Expected _gasAnalytics to be installed on the HRE",
|
|
18
25
|
);
|
|
19
26
|
return hookContextOrHre._gasAnalytics;
|
|
20
27
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { styleText } from "node:util";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Converts an internal FQN (e.g. `"project/contracts/Foo.sol:Foo"` or
|
|
@@ -108,5 +108,5 @@ export function formatSectionHeader(
|
|
|
108
108
|
parts.push(`${removedLength} removed`);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
return `${sectionName}: ${
|
|
111
|
+
return `${sectionName}: ${styleText("gray", parts.join(", "))}`;
|
|
112
112
|
}
|
|
@@ -1,29 +1,41 @@
|
|
|
1
1
|
import type { HardhatRuntimeEnvironmentHooks } from "../../../../types/hooks.js";
|
|
2
|
+
import type { GasAnalyticsManagerImplementation as GasAnalyticsManagerImplementationT } from "../gas-analytics-manager.js";
|
|
2
3
|
|
|
3
|
-
import { GasAnalyticsManagerImplementation } from "../gas-analytics-manager.js";
|
|
4
4
|
import { setGasAnalyticsManager } from "../helpers/accessors.js";
|
|
5
5
|
|
|
6
|
+
let GasAnalyticsManagerImplementation:
|
|
7
|
+
| typeof GasAnalyticsManagerImplementationT
|
|
8
|
+
| undefined;
|
|
9
|
+
|
|
6
10
|
export default async (): Promise<Partial<HardhatRuntimeEnvironmentHooks>> => ({
|
|
7
11
|
created: async (context, hre) => {
|
|
8
12
|
if (
|
|
9
|
-
context.globalOptions.gasStats
|
|
10
|
-
context.globalOptions.gasStatsJson
|
|
13
|
+
!context.globalOptions.gasStats &&
|
|
14
|
+
context.globalOptions.gasStatsJson === undefined
|
|
11
15
|
) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
setGasAnalyticsManager(hre, gasAnalyticsManager);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
hre.hooks.registerHandlers("network", {
|
|
23
|
-
onGasMeasurement: (_context, gasMeasurement) => {
|
|
24
|
-
gasAnalyticsManager.addGasMeasurement(gasMeasurement);
|
|
25
|
-
},
|
|
26
|
-
});
|
|
19
|
+
if (GasAnalyticsManagerImplementation === undefined) {
|
|
20
|
+
({ GasAnalyticsManagerImplementation } = await import(
|
|
21
|
+
"../gas-analytics-manager.js"
|
|
22
|
+
));
|
|
27
23
|
}
|
|
24
|
+
|
|
25
|
+
const gasAnalyticsManager = new GasAnalyticsManagerImplementation(
|
|
26
|
+
hre.config.paths.cache,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
setGasAnalyticsManager(hre, gasAnalyticsManager);
|
|
30
|
+
|
|
31
|
+
// NOTE: We register this hook dynamically to avoid a circular dependency
|
|
32
|
+
// between gas-analytics and network-manager plugins. The network-manager
|
|
33
|
+
// checks for the existence of onGasReported handlers to determine if gas
|
|
34
|
+
// analytics is enabled, rather than directly checking the global option.
|
|
35
|
+
hre.hooks.registerHandlers("network", {
|
|
36
|
+
onGasMeasurement: (_context, gasMeasurement) => {
|
|
37
|
+
gasAnalyticsManager.addGasMeasurement(gasMeasurement);
|
|
38
|
+
},
|
|
39
|
+
});
|
|
28
40
|
},
|
|
29
41
|
});
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import type { SuiteResult } from "@nomicfoundation/edr";
|
|
2
2
|
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { styleText } from "node:util";
|
|
4
5
|
|
|
5
6
|
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
6
7
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
7
8
|
import {
|
|
8
9
|
FileNotFoundError,
|
|
9
10
|
readdir,
|
|
11
|
+
readdirOrEmpty,
|
|
10
12
|
readJsonFile,
|
|
11
13
|
remove,
|
|
12
14
|
writeJsonFile,
|
|
13
15
|
} from "@nomicfoundation/hardhat-utils/fs";
|
|
14
|
-
import chalk from "chalk";
|
|
15
16
|
|
|
16
17
|
import {
|
|
17
18
|
getFullyQualifiedName,
|
|
@@ -116,9 +117,8 @@ async function deleteOrphanedSnapshotFiles(
|
|
|
116
117
|
snapshotsDir: string,
|
|
117
118
|
currentGroups: Set<string>,
|
|
118
119
|
): Promise<void> {
|
|
119
|
-
let dirEntries: string[];
|
|
120
120
|
try {
|
|
121
|
-
dirEntries = await
|
|
121
|
+
const dirEntries = await readdirOrEmpty(snapshotsDir);
|
|
122
122
|
|
|
123
123
|
for (const entry of dirEntries) {
|
|
124
124
|
if (entry.endsWith(".json")) {
|
|
@@ -131,10 +131,6 @@ async function deleteOrphanedSnapshotFiles(
|
|
|
131
131
|
}
|
|
132
132
|
} catch (error) {
|
|
133
133
|
ensureError(error);
|
|
134
|
-
// Directory doesn't exist yet, nothing to clean up
|
|
135
|
-
if (error instanceof FileNotFoundError) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
134
|
throw new HardhatError(
|
|
139
135
|
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.SNAPSHOT_WRITE_ERROR,
|
|
140
136
|
{ snapshotsPath: snapshotsDir, error: error.message },
|
|
@@ -375,7 +371,8 @@ export function logSnapshotCheatcodesSection(
|
|
|
375
371
|
if (isFirstTimeWrite) {
|
|
376
372
|
logger();
|
|
377
373
|
logger(
|
|
378
|
-
|
|
374
|
+
styleText(
|
|
375
|
+
"green",
|
|
379
376
|
" No existing snapshots found. Snapshot cheatcodes written successfully",
|
|
380
377
|
),
|
|
381
378
|
);
|
|
@@ -395,7 +392,7 @@ export function logSnapshotCheatcodesSection(
|
|
|
395
392
|
"\n",
|
|
396
393
|
);
|
|
397
394
|
for (const line of addedLines) {
|
|
398
|
-
logger(
|
|
395
|
+
logger(styleText("green", ` + ${line}`));
|
|
399
396
|
}
|
|
400
397
|
}
|
|
401
398
|
|
|
@@ -406,7 +403,7 @@ export function logSnapshotCheatcodesSection(
|
|
|
406
403
|
"\n",
|
|
407
404
|
);
|
|
408
405
|
for (const line of removedLines) {
|
|
409
|
-
logger(
|
|
406
|
+
logger(styleText("red", ` - ${line}`));
|
|
410
407
|
}
|
|
411
408
|
}
|
|
412
409
|
|
|
@@ -422,7 +419,7 @@ export function printSnapshotCheatcodeChanges(
|
|
|
422
419
|
const isLast = i === changes.length - 1;
|
|
423
420
|
|
|
424
421
|
logger(` ${change.group}#${change.name}`);
|
|
425
|
-
logger(
|
|
422
|
+
logger(styleText("grey", ` (in ${change.source})`));
|
|
426
423
|
|
|
427
424
|
const diff = change.actual - change.expected;
|
|
428
425
|
const formattedDiff = diff > 0 ? `Δ+${diff}` : `Δ${diff}`;
|
|
@@ -437,13 +434,13 @@ export function printSnapshotCheatcodeChanges(
|
|
|
437
434
|
|
|
438
435
|
// Color: green for decrease (improvement), red for increase (regression)
|
|
439
436
|
const formattedGasChange =
|
|
440
|
-
diff < 0 ?
|
|
437
|
+
diff < 0 ? styleText("green", gasChange) : styleText("red", gasChange);
|
|
441
438
|
|
|
442
|
-
logger(
|
|
439
|
+
logger(styleText("grey", ` Expected: ${change.expected}`));
|
|
443
440
|
logger(
|
|
444
|
-
|
|
441
|
+
styleText("grey", ` Actual: ${change.actual} (`) +
|
|
445
442
|
formattedGasChange +
|
|
446
|
-
|
|
443
|
+
styleText("grey", ")"),
|
|
447
444
|
);
|
|
448
445
|
|
|
449
446
|
if (!isLast) {
|
|
@@ -5,8 +5,9 @@ import type { FunctionGasSnapshotCheckResult } from "../../function-gas-snapshot
|
|
|
5
5
|
import type { SnapshotCheatcodesCheckResult } from "../../snapshot-cheatcodes.js";
|
|
6
6
|
import type { SuiteResult } from "@nomicfoundation/edr";
|
|
7
7
|
|
|
8
|
+
import { styleText } from "node:util";
|
|
9
|
+
|
|
8
10
|
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
9
|
-
import chalk from "chalk";
|
|
10
11
|
|
|
11
12
|
import { errorResult } from "../../../../../utils/result.js";
|
|
12
13
|
import {
|
|
@@ -103,7 +104,7 @@ export function logSnapshotResult(
|
|
|
103
104
|
logger: typeof console.log = console.log,
|
|
104
105
|
): void {
|
|
105
106
|
if (result.functionGasSnapshotsWritten) {
|
|
106
|
-
logger(
|
|
107
|
+
logger(styleText("green", "Function gas snapshots written successfully"));
|
|
107
108
|
logger();
|
|
108
109
|
}
|
|
109
110
|
}
|
|
@@ -133,8 +134,8 @@ export function logSnapshotCheckResult(
|
|
|
133
134
|
): void {
|
|
134
135
|
logger(
|
|
135
136
|
functionGasSnapshotsCheck.passed && snapshotCheatcodesCheck.passed
|
|
136
|
-
?
|
|
137
|
-
:
|
|
137
|
+
? styleText("green", "Snapshot check passed")
|
|
138
|
+
: styleText("red", "Snapshot check failed"),
|
|
138
139
|
);
|
|
139
140
|
|
|
140
141
|
const functionGasHasOutput =
|
|
@@ -164,7 +165,12 @@ export function logSnapshotCheckResult(
|
|
|
164
165
|
logSnapshotCheatcodesSection(snapshotCheatcodesCheck, logger);
|
|
165
166
|
|
|
166
167
|
if (!functionGasSnapshotsCheck.passed || !snapshotCheatcodesCheck.passed) {
|
|
167
|
-
logger(
|
|
168
|
+
logger(
|
|
169
|
+
styleText(
|
|
170
|
+
"yellow",
|
|
171
|
+
"To update snapshots, run your tests with --snapshot",
|
|
172
|
+
),
|
|
173
|
+
);
|
|
168
174
|
logger();
|
|
169
175
|
}
|
|
170
176
|
}
|
|
@@ -36,7 +36,7 @@ import { DEFAULT_CHAIN_DESCRIPTORS } from "./chain-descriptors.js";
|
|
|
36
36
|
import {
|
|
37
37
|
DEFAULT_EDR_NETWORK_HD_ACCOUNTS_CONFIG_PARAMS,
|
|
38
38
|
EDR_NETWORK_DEFAULT_COINBASE,
|
|
39
|
-
} from "./edr/edr-
|
|
39
|
+
} from "./edr/edr-constants.js";
|
|
40
40
|
import { getCurrentHardfork } from "./edr/types/hardfork.js";
|
|
41
41
|
import { isHttpNetworkHdAccountsUserConfig } from "./type-validation.js";
|
|
42
42
|
|
|
@@ -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 {
|
|
@@ -31,16 +29,14 @@ import {
|
|
|
31
29
|
HardhatError,
|
|
32
30
|
} from "@nomicfoundation/hardhat-errors";
|
|
33
31
|
import { toSeconds } from "@nomicfoundation/hardhat-utils/date";
|
|
32
|
+
import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
|
|
34
33
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
35
34
|
import { numberToHexString } from "@nomicfoundation/hardhat-utils/hex";
|
|
36
|
-
import { deepEqual } from "@nomicfoundation/hardhat-utils/lang";
|
|
37
|
-
import debug from "debug";
|
|
38
35
|
|
|
39
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 {
|
|
@@ -63,62 +59,7 @@ import {
|
|
|
63
59
|
} from "./utils/convert-to-edr.js";
|
|
64
60
|
import { printLine, replaceLastLine } from "./utils/logger.js";
|
|
65
61
|
|
|
66
|
-
const log =
|
|
67
|
-
|
|
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 await 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
|
-
];
|
|
62
|
+
const log = createDebug("hardhat:core:network-manager:edr:provider");
|
|
122
63
|
|
|
123
64
|
interface EdrProviderConfig {
|
|
124
65
|
chainDescriptors: ChainDescriptorsConfig;
|