hardhat 3.1.9 → 3.1.11
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 +33 -0
- package/dist/src/config.d.ts +20 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +31 -0
- package/dist/src/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +33 -21
- package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +3 -5
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.js +7 -19
- package/dist/src/internal/builtin-plugins/coverage/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +42 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/index.js +1 -0
- package/dist/src/internal/builtin-plugins/coverage/index.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 +1 -1
- package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +2 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts +3 -5
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js +7 -19
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js +42 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +17 -20
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.d.ts +0 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.js +0 -6
- package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts +1 -3
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +0 -49
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.js +58 -20
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.js +8 -0
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.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 +1 -2
- package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-results.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/solidity/build-results.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-results.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity/build-results.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +14 -6
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +1 -1
- 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 +0 -3
- 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 +3 -5
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js +4 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts +5 -2
- 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 +8 -2
- 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/error-messages.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.js +19 -5
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts +21 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js +84 -25
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.d.ts +3 -12
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts +1 -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/solc-config-selection.d.ts +8 -6
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.js +103 -27
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.js.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/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js +5 -0
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +22 -0
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.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/edr-artifacts.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.js +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 +16 -27
- 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/telemetry/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/telemetry/task-action.js +3 -2
- package/dist/src/internal/builtin-plugins/telemetry/task-action.js.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 +40 -13
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts +27 -0
- package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/cli/banner-manager.d.ts +26 -0
- package/dist/src/internal/cli/banner-manager.d.ts.map +1 -0
- package/dist/src/internal/cli/banner-manager.js +146 -0
- package/dist/src/internal/cli/banner-manager.js.map +1 -0
- package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
- package/dist/src/internal/cli/error-handler.js +15 -0
- package/dist/src/internal/cli/error-handler.js.map +1 -1
- package/dist/src/internal/cli/init/init.d.ts.map +1 -1
- package/dist/src/internal/cli/init/init.js +8 -0
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/main.d.ts.map +1 -1
- package/dist/src/internal/cli/main.js +18 -1
- package/dist/src/internal/cli/main.js.map +1 -1
- package/dist/src/internal/cli/telemetry/analytics/subprocess.js +2 -0
- package/dist/src/internal/cli/telemetry/analytics/subprocess.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/anonymize-paths.js +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/reporter.js +4 -0
- package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.d.ts +1 -1
- package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.d.ts.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.js +47 -38
- package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.js.map +1 -1
- package/dist/src/internal/core/config-validation.d.ts +3 -3
- package/dist/src/internal/core/config-validation.d.ts.map +1 -1
- package/dist/src/internal/core/config-validation.js +48 -18
- package/dist/src/internal/core/config-validation.js.map +1 -1
- package/dist/src/internal/core/tasks/builders.d.ts +26 -16
- package/dist/src/internal/core/tasks/builders.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/builders.js +65 -6
- package/dist/src/internal/core/tasks/builders.js.map +1 -1
- package/dist/src/internal/core/tasks/resolved-task.d.ts +2 -2
- package/dist/src/internal/core/tasks/resolved-task.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/resolved-task.js +23 -9
- package/dist/src/internal/core/tasks/resolved-task.js.map +1 -1
- package/dist/src/internal/core/tasks/task-manager.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/task-manager.js +14 -6
- package/dist/src/internal/core/tasks/task-manager.js.map +1 -1
- package/dist/src/internal/core/tasks/validations.d.ts +2 -0
- package/dist/src/internal/core/tasks/validations.d.ts.map +1 -1
- package/dist/src/internal/core/tasks/validations.js +11 -0
- package/dist/src/internal/core/tasks/validations.js.map +1 -1
- package/dist/src/internal/core/user-interruptions.js +1 -1
- package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.d.ts +2 -0
- package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.d.ts.map +1 -0
- package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js +12 -0
- package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js.map +1 -0
- package/dist/src/internal/using-hardhat2-plugin-errors.d.ts +35 -0
- package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -0
- package/dist/src/internal/using-hardhat2-plugin-errors.js +98 -0
- package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -0
- package/dist/src/plugins.d.ts +8 -0
- package/dist/src/plugins.d.ts.map +1 -1
- package/dist/src/plugins.js +13 -0
- package/dist/src/plugins.js.map +1 -1
- package/dist/src/types/artifacts.d.ts +32 -3
- package/dist/src/types/artifacts.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +15 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/types/index.js +15 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/network.d.ts +1 -1
- package/dist/src/types/plugins.d.ts +2 -2
- package/dist/src/types/solidity/build-system.d.ts +56 -10
- package/dist/src/types/solidity/build-system.d.ts.map +1 -1
- package/dist/src/types/solidity/build-system.js +26 -2
- package/dist/src/types/solidity/build-system.js.map +1 -1
- package/dist/src/types/solidity/errors.d.ts +18 -0
- package/dist/src/types/solidity/errors.d.ts.map +1 -1
- package/dist/src/types/solidity/errors.js.map +1 -1
- package/dist/src/types/solidity/resolved-file.d.ts +2 -2
- package/dist/src/types/tasks.d.ts +103 -34
- package/dist/src/types/tasks.d.ts.map +1 -1
- package/dist/src/types/tasks.js.map +1 -1
- package/dist/src/types/test.d.ts +11 -0
- package/dist/src/types/test.d.ts.map +1 -1
- package/dist/src/types/utils.d.ts +16 -0
- package/dist/src/types/utils.d.ts.map +1 -1
- package/dist/src/utils/result.d.ts +33 -0
- package/dist/src/utils/result.d.ts.map +1 -0
- package/dist/src/utils/result.js +43 -0
- package/dist/src/utils/result.js.map +1 -0
- package/package.json +12 -7
- package/src/config.ts +37 -0
- package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +4 -1
- package/src/internal/builtin-plugins/artifacts/hook-handlers/hre.ts +4 -1
- package/src/internal/builtin-plugins/coverage/coverage-manager.ts +57 -50
- package/src/internal/builtin-plugins/coverage/helpers.ts +11 -29
- package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +68 -0
- package/src/internal/builtin-plugins/coverage/index.ts +1 -0
- package/src/internal/builtin-plugins/flatten/task-action.ts +1 -0
- package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +4 -4
- package/src/internal/builtin-plugins/gas-analytics/helpers.ts +11 -29
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts +68 -0
- package/src/internal/builtin-plugins/gas-analytics/index.ts +1 -0
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +21 -28
- package/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.ts +5 -2
- package/src/internal/builtin-plugins/network-manager/edr/type-validation.ts +0 -13
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +0 -64
- package/src/internal/builtin-plugins/network-manager/hook-handlers/config.ts +65 -21
- package/src/internal/builtin-plugins/network-manager/type-validation.ts +9 -0
- package/src/internal/builtin-plugins/node/task-action.ts +2 -2
- package/src/internal/builtin-plugins/solidity/build-results.ts +3 -1
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +16 -5
- package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +7 -6
- package/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.ts +23 -1
- package/src/internal/builtin-plugins/solidity/build-system/dependency-graph.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +17 -3
- package/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.ts +19 -5
- package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +139 -35
- package/src/internal/builtin-plugins/solidity/build-system/resolver/types.ts +3 -9
- package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.ts +125 -28
- package/src/internal/builtin-plugins/solidity/config.ts +2 -2
- package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +8 -0
- package/src/internal/builtin-plugins/solidity/tasks/build.ts +1 -1
- package/src/internal/builtin-plugins/solidity/type-extensions.ts +28 -0
- package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
- package/src/internal/builtin-plugins/solidity-test/edr-artifacts.ts +2 -2
- package/src/internal/builtin-plugins/solidity-test/runner.ts +1 -1
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +36 -38
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
- package/src/internal/builtin-plugins/telemetry/task-action.ts +4 -2
- package/src/internal/builtin-plugins/test/task-action.ts +71 -25
- package/src/internal/builtin-plugins/test/type-extensions.ts +42 -0
- package/src/internal/cli/banner-manager.ts +234 -0
- package/src/internal/cli/error-handler.ts +18 -0
- package/src/internal/cli/init/init.ts +8 -0
- package/src/internal/cli/main.ts +19 -1
- package/src/internal/cli/telemetry/analytics/subprocess.ts +2 -0
- package/src/internal/cli/telemetry/sentry/anonymize-paths.ts +1 -1
- package/src/internal/cli/telemetry/sentry/reporter.ts +5 -0
- package/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.ts +98 -50
- package/src/internal/core/config-validation.ts +67 -18
- package/src/internal/core/tasks/builders.ts +174 -30
- package/src/internal/core/tasks/resolved-task.ts +31 -13
- package/src/internal/core/tasks/task-manager.ts +23 -5
- package/src/internal/core/tasks/validations.ts +40 -0
- package/src/internal/core/user-interruptions.ts +1 -1
- package/src/internal/deprecated-module-imported-from-hardhat2-plugin.ts +12 -0
- package/src/internal/using-hardhat2-plugin-errors.ts +108 -0
- package/src/plugins.ts +16 -0
- package/src/types/artifacts.ts +40 -3
- package/src/types/hre.ts +1 -1
- package/src/types/index.ts +14 -0
- package/src/types/network.ts +1 -1
- package/src/types/plugins.ts +2 -2
- package/src/types/solidity/build-system.ts +75 -14
- package/src/types/solidity/errors.ts +22 -0
- package/src/types/solidity/resolved-file.ts +2 -2
- package/src/types/tasks.ts +143 -36
- package/src/types/test.ts +12 -0
- package/src/types/utils.ts +14 -0
- package/src/utils/result.ts +57 -0
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +11 -11
- package/templates/hardhat-3/02-mocha-ethers/package.json +16 -16
- package/templates/hardhat-3/03-minimal/package.json +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.d.ts +0 -19
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.d.ts.map +0 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.js +0 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.js.map +0 -1
- package/src/internal/builtin-plugins/network-manager/edr/types/output.ts +0 -19
|
@@ -8,7 +8,7 @@ import type { TableItem } from "@nomicfoundation/hardhat-utils/format";
|
|
|
8
8
|
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { formatTable } from "@nomicfoundation/hardhat-utils/format";
|
|
12
12
|
import {
|
|
13
13
|
ensureDir,
|
|
14
14
|
getAllFilesMatching,
|
|
@@ -433,55 +433,60 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
433
433
|
|
|
434
434
|
const rows: TableItem[] = [];
|
|
435
435
|
|
|
436
|
-
rows.push(
|
|
437
|
-
|
|
436
|
+
rows.push({
|
|
437
|
+
type: "title",
|
|
438
|
+
text: chalk.bold("Coverage Report"),
|
|
439
|
+
});
|
|
438
440
|
|
|
439
|
-
rows.push(
|
|
440
|
-
|
|
441
|
-
|
|
441
|
+
rows.push({
|
|
442
|
+
type: "section-header",
|
|
443
|
+
text: chalk.bold("File Coverage"),
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
rows.push({
|
|
447
|
+
type: "header",
|
|
448
|
+
cells: ["File Path", "Line %", "Statement %", "Uncovered Lines"].map(
|
|
449
|
+
(s) => chalk.yellow(s),
|
|
442
450
|
),
|
|
443
|
-
);
|
|
451
|
+
});
|
|
444
452
|
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
453
|
+
for (const [
|
|
454
|
+
relativePath,
|
|
455
|
+
{
|
|
456
|
+
executedStatementsCount,
|
|
457
|
+
unexecutedStatementsCount,
|
|
458
|
+
lineExecutionCounts,
|
|
459
|
+
executedLinesCount,
|
|
460
|
+
unexecutedLines,
|
|
461
|
+
},
|
|
462
|
+
] of Object.entries(report)) {
|
|
463
|
+
const lineCoverage =
|
|
464
|
+
lineExecutionCounts.size === 0
|
|
465
|
+
? 0
|
|
466
|
+
: (executedLinesCount * 100.0) / lineExecutionCounts.size;
|
|
467
|
+
const statementCoverage =
|
|
468
|
+
executedStatementsCount === 0
|
|
469
|
+
? 0
|
|
470
|
+
: (executedStatementsCount * 100.0) /
|
|
471
|
+
(executedStatementsCount + unexecutedStatementsCount);
|
|
472
|
+
|
|
473
|
+
totalExecutedLines += executedLinesCount;
|
|
474
|
+
totalExecutableLines += lineExecutionCounts.size;
|
|
475
|
+
|
|
476
|
+
totalExecutedStatements += executedStatementsCount;
|
|
477
|
+
totalExecutableStatements +=
|
|
478
|
+
executedStatementsCount + unexecutedStatementsCount;
|
|
479
|
+
|
|
480
|
+
rows.push({
|
|
481
|
+
type: "row",
|
|
482
|
+
cells: [
|
|
474
483
|
this.formatRelativePath(relativePath),
|
|
475
484
|
this.formatCoverage(lineCoverage),
|
|
476
485
|
this.formatCoverage(statementCoverage),
|
|
477
486
|
this.formatLines(unexecutedLines),
|
|
478
|
-
]
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
},
|
|
482
|
-
);
|
|
483
|
-
|
|
484
|
-
rows.push(...bodyRows);
|
|
487
|
+
],
|
|
488
|
+
});
|
|
489
|
+
}
|
|
485
490
|
|
|
486
491
|
const totalLineCoverage =
|
|
487
492
|
totalExecutableLines === 0
|
|
@@ -492,13 +497,15 @@ export class CoverageManagerImplementation implements CoverageManager {
|
|
|
492
497
|
? 0
|
|
493
498
|
: (totalExecutedStatements * 100.0) / totalExecutableStatements;
|
|
494
499
|
|
|
495
|
-
rows.push(
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
500
|
+
rows.push({
|
|
501
|
+
type: "header",
|
|
502
|
+
cells: [
|
|
503
|
+
chalk.yellow("Total"),
|
|
504
|
+
this.formatCoverage(totalLineCoverage),
|
|
505
|
+
this.formatCoverage(totalStatementCoverage),
|
|
506
|
+
"",
|
|
507
|
+
],
|
|
508
|
+
});
|
|
502
509
|
|
|
503
510
|
return formatTable(rows);
|
|
504
511
|
}
|
|
@@ -1,50 +1,32 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
testRunDone,
|
|
5
|
+
testRunStart,
|
|
6
|
+
testWorkerDone,
|
|
7
|
+
} from "./hook-handlers/test.js";
|
|
6
8
|
|
|
7
9
|
export function getCoveragePath(rootPath: string): string {
|
|
8
10
|
return path.join(rootPath, "coverage");
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* internal public API only.
|
|
16
|
-
* - We know the HRE has been initialized by the time they are used.
|
|
14
|
+
* The following helpers are kept for backward compatibility with older versions
|
|
15
|
+
* of test runner plugins (hardhat-mocha, hardhat-node-test-runner) that import
|
|
16
|
+
* from "hardhat/internal/coverage".
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
export async function markTestRunStart(id: string): Promise<void> {
|
|
20
20
|
const { default: hre } = await import("../../../index.js");
|
|
21
|
-
|
|
22
|
-
assertHardhatInvariant(
|
|
23
|
-
hre instanceof HardhatRuntimeEnvironmentImplementation,
|
|
24
|
-
"Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation",
|
|
25
|
-
);
|
|
26
|
-
await hre._coverage.clearData(id);
|
|
27
|
-
}
|
|
21
|
+
await testRunStart(hre, id);
|
|
28
22
|
}
|
|
29
23
|
|
|
30
24
|
export async function markTestWorkerDone(id: string): Promise<void> {
|
|
31
25
|
const { default: hre } = await import("../../../index.js");
|
|
32
|
-
|
|
33
|
-
assertHardhatInvariant(
|
|
34
|
-
hre instanceof HardhatRuntimeEnvironmentImplementation,
|
|
35
|
-
"Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation",
|
|
36
|
-
);
|
|
37
|
-
await hre._coverage.saveData(id);
|
|
38
|
-
}
|
|
26
|
+
await testWorkerDone(hre, id);
|
|
39
27
|
}
|
|
40
28
|
|
|
41
29
|
export async function markTestRunDone(id: string): Promise<void> {
|
|
42
30
|
const { default: hre } = await import("../../../index.js");
|
|
43
|
-
|
|
44
|
-
assertHardhatInvariant(
|
|
45
|
-
hre instanceof HardhatRuntimeEnvironmentImplementation,
|
|
46
|
-
"Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation",
|
|
47
|
-
);
|
|
48
|
-
await hre._coverage.report(id);
|
|
49
|
-
}
|
|
31
|
+
await testRunDone(hre, id);
|
|
50
32
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { HookContext, TestHooks } from "../../../../types/hooks.js";
|
|
2
|
+
|
|
3
|
+
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
4
|
+
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
5
|
+
|
|
6
|
+
import { CoverageManagerImplementation } from "../coverage-manager.js";
|
|
7
|
+
|
|
8
|
+
export default async (): Promise<Partial<TestHooks>> => ({
|
|
9
|
+
onTestRunStart: async (context, id, next) => {
|
|
10
|
+
await next(context, id);
|
|
11
|
+
await testRunStart(context, id);
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
onTestWorkerDone: async (context, id, next) => {
|
|
15
|
+
await next(context, id);
|
|
16
|
+
await testWorkerDone(context, id);
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
onTestRunDone: async (context, id, next) => {
|
|
20
|
+
await next(context, id);
|
|
21
|
+
await testRunDone(context, id);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export async function testRunStart(
|
|
26
|
+
context: HookContext,
|
|
27
|
+
id: string,
|
|
28
|
+
): Promise<void> {
|
|
29
|
+
if (context.globalOptions.coverage === true) {
|
|
30
|
+
assertHardhatInvariant(
|
|
31
|
+
"_coverage" in context &&
|
|
32
|
+
isObject(context._coverage) &&
|
|
33
|
+
context._coverage instanceof CoverageManagerImplementation,
|
|
34
|
+
"Expected HookContext#_coverage to be an instance of CoverageManagerImplementation",
|
|
35
|
+
);
|
|
36
|
+
await context._coverage.clearData(id);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function testWorkerDone(
|
|
41
|
+
context: HookContext,
|
|
42
|
+
id: string,
|
|
43
|
+
): Promise<void> {
|
|
44
|
+
if (context.globalOptions.coverage === true) {
|
|
45
|
+
assertHardhatInvariant(
|
|
46
|
+
"_coverage" in context &&
|
|
47
|
+
isObject(context._coverage) &&
|
|
48
|
+
context._coverage instanceof CoverageManagerImplementation,
|
|
49
|
+
"Expected HookContext#_coverage to be an instance of CoverageManagerImplementation",
|
|
50
|
+
);
|
|
51
|
+
await context._coverage.saveData(id);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export async function testRunDone(
|
|
56
|
+
context: HookContext,
|
|
57
|
+
id: string,
|
|
58
|
+
): Promise<void> {
|
|
59
|
+
if (context.globalOptions.coverage === true) {
|
|
60
|
+
assertHardhatInvariant(
|
|
61
|
+
"_coverage" in context &&
|
|
62
|
+
isObject(context._coverage) &&
|
|
63
|
+
context._coverage instanceof CoverageManagerImplementation,
|
|
64
|
+
"Expected HookContext#_coverage to be an instance of CoverageManagerImplementation",
|
|
65
|
+
);
|
|
66
|
+
await context._coverage.report(id);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -17,6 +17,7 @@ const hardhatPlugin: HardhatPlugin = {
|
|
|
17
17
|
clean: () => import("./hook-handlers/clean.js"),
|
|
18
18
|
hre: () => import("./hook-handlers/hre.js"),
|
|
19
19
|
solidity: () => import("./hook-handlers/solidity.js"),
|
|
20
|
+
test: () => import("./hook-handlers/test.js"),
|
|
20
21
|
},
|
|
21
22
|
npmPackage: "hardhat",
|
|
22
23
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { GasAnalyticsManager, GasMeasurement } from "./types.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { TableItem } from "@nomicfoundation/hardhat-utils/format";
|
|
3
3
|
|
|
4
4
|
import crypto from "node:crypto";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { formatTable } from "@nomicfoundation/hardhat-utils/format";
|
|
8
8
|
import {
|
|
9
9
|
ensureDir,
|
|
10
10
|
getAllFilesMatching,
|
|
@@ -209,7 +209,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
|
|
|
209
209
|
public _generateGasStatsReport(
|
|
210
210
|
gasStatsByContract: GasStatsByContract,
|
|
211
211
|
): string {
|
|
212
|
-
const rows:
|
|
212
|
+
const rows: TableItem[] = [];
|
|
213
213
|
|
|
214
214
|
if (gasStatsByContract.size > 0) {
|
|
215
215
|
rows.push({ type: "title", text: chalk.bold("Gas Usage Statistics") });
|
|
@@ -279,7 +279,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
|
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
return
|
|
282
|
+
return formatTable(rows);
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
|
|
@@ -1,44 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
testRunDone,
|
|
3
|
+
testRunStart,
|
|
4
|
+
testWorkerDone,
|
|
5
|
+
} from "./hook-handlers/test.js";
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* internal public API only.
|
|
10
|
-
* - We know the HRE has been initialized by the time they are used.
|
|
8
|
+
* The following helpers are kept for backward compatibility with older versions
|
|
9
|
+
* of test runner plugins (hardhat-mocha, hardhat-node-test-runner) that import
|
|
10
|
+
* from "hardhat/internal/gas-analytics".
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
export async function markTestRunStart(id: string): Promise<void> {
|
|
14
14
|
const { default: hre } = await import("../../../index.js");
|
|
15
|
-
|
|
16
|
-
assertHardhatInvariant(
|
|
17
|
-
hre instanceof HardhatRuntimeEnvironmentImplementation,
|
|
18
|
-
"Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation",
|
|
19
|
-
);
|
|
20
|
-
await hre._gasAnalytics.clearGasMeasurements(id);
|
|
21
|
-
}
|
|
15
|
+
await testRunStart(hre, id);
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
export async function markTestWorkerDone(id: string): Promise<void> {
|
|
25
19
|
const { default: hre } = await import("../../../index.js");
|
|
26
|
-
|
|
27
|
-
assertHardhatInvariant(
|
|
28
|
-
hre instanceof HardhatRuntimeEnvironmentImplementation,
|
|
29
|
-
"Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation",
|
|
30
|
-
);
|
|
31
|
-
await hre._gasAnalytics.saveGasMeasurements(id);
|
|
32
|
-
}
|
|
20
|
+
await testWorkerDone(hre, id);
|
|
33
21
|
}
|
|
34
22
|
|
|
35
23
|
export async function markTestRunDone(id: string): Promise<void> {
|
|
36
24
|
const { default: hre } = await import("../../../index.js");
|
|
37
|
-
|
|
38
|
-
assertHardhatInvariant(
|
|
39
|
-
hre instanceof HardhatRuntimeEnvironmentImplementation,
|
|
40
|
-
"Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation",
|
|
41
|
-
);
|
|
42
|
-
await hre._gasAnalytics.reportGasStats(id);
|
|
43
|
-
}
|
|
25
|
+
await testRunDone(hre, id);
|
|
44
26
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { HookContext, TestHooks } from "../../../../types/hooks.js";
|
|
2
|
+
|
|
3
|
+
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
4
|
+
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
5
|
+
|
|
6
|
+
import { GasAnalyticsManagerImplementation } from "../gas-analytics-manager.js";
|
|
7
|
+
|
|
8
|
+
export default async (): Promise<Partial<TestHooks>> => ({
|
|
9
|
+
onTestRunStart: async (context, id, next) => {
|
|
10
|
+
await next(context, id);
|
|
11
|
+
await testRunStart(context, id);
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
onTestWorkerDone: async (context, id, next) => {
|
|
15
|
+
await next(context, id);
|
|
16
|
+
await testWorkerDone(context, id);
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
onTestRunDone: async (context, id, next) => {
|
|
20
|
+
await next(context, id);
|
|
21
|
+
await testRunDone(context, id);
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export async function testRunStart(
|
|
26
|
+
context: HookContext,
|
|
27
|
+
id: string,
|
|
28
|
+
): Promise<void> {
|
|
29
|
+
if (context.globalOptions.gasStats === true) {
|
|
30
|
+
assertHardhatInvariant(
|
|
31
|
+
"_gasAnalytics" in context &&
|
|
32
|
+
isObject(context._gasAnalytics) &&
|
|
33
|
+
context._gasAnalytics instanceof GasAnalyticsManagerImplementation,
|
|
34
|
+
"Expected HookContext#_gasAnalytics to be an instance of GasAnalyticsManagerImplementation",
|
|
35
|
+
);
|
|
36
|
+
await context._gasAnalytics.clearGasMeasurements(id);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function testWorkerDone(
|
|
41
|
+
context: HookContext,
|
|
42
|
+
id: string,
|
|
43
|
+
): Promise<void> {
|
|
44
|
+
if (context.globalOptions.gasStats === true) {
|
|
45
|
+
assertHardhatInvariant(
|
|
46
|
+
"_gasAnalytics" in context &&
|
|
47
|
+
isObject(context._gasAnalytics) &&
|
|
48
|
+
context._gasAnalytics instanceof GasAnalyticsManagerImplementation,
|
|
49
|
+
"Expected HookContext#_gasAnalytics to be an instance of GasAnalyticsManagerImplementation",
|
|
50
|
+
);
|
|
51
|
+
await context._gasAnalytics.saveGasMeasurements(id);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export async function testRunDone(
|
|
56
|
+
context: HookContext,
|
|
57
|
+
id: string,
|
|
58
|
+
): Promise<void> {
|
|
59
|
+
if (context.globalOptions.gasStats === true) {
|
|
60
|
+
assertHardhatInvariant(
|
|
61
|
+
"_gasAnalytics" in context &&
|
|
62
|
+
isObject(context._gasAnalytics) &&
|
|
63
|
+
context._gasAnalytics instanceof GasAnalyticsManagerImplementation,
|
|
64
|
+
"Expected HookContext#_gasAnalytics to be an instance of GasAnalyticsManagerImplementation",
|
|
65
|
+
);
|
|
66
|
+
await context._gasAnalytics.reportGasStats(id);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { SolidityStackTrace } from "./stack-traces/solidity-stack-trace.js";
|
|
2
1
|
import type { CoverageConfig } from "./types/coverage.js";
|
|
3
2
|
import type { LoggerConfig } from "./types/logger.js";
|
|
4
3
|
import type {
|
|
@@ -63,14 +62,10 @@ import {
|
|
|
63
62
|
|
|
64
63
|
import { EdrProviderStackTraceGenerationError } from "./stack-traces/stack-trace-generation-errors.js";
|
|
65
64
|
import { createSolidityErrorWithStackTrace } from "./stack-traces/stack-trace-solidity-errors.js";
|
|
66
|
-
import {
|
|
67
|
-
isDebugTraceResult,
|
|
68
|
-
isEdrProviderErrorData,
|
|
69
|
-
} from "./type-validation.js";
|
|
65
|
+
import { isEdrProviderErrorData } from "./type-validation.js";
|
|
70
66
|
import { clientVersion } from "./utils/client-version.js";
|
|
71
67
|
import { ConsoleLogger } from "./utils/console-logger.js";
|
|
72
68
|
import {
|
|
73
|
-
edrRpcDebugTraceToHardhat,
|
|
74
69
|
hardhatMiningIntervalToEdrMiningInterval,
|
|
75
70
|
hardhatMempoolOrderToEdrMineOrdering,
|
|
76
71
|
hardhatHardforkToEdrSpecId,
|
|
@@ -289,15 +284,6 @@ export class EdrProvider extends BaseProvider {
|
|
|
289
284
|
"Invalid client version response",
|
|
290
285
|
);
|
|
291
286
|
return clientVersion(jsonRpcResponse.result);
|
|
292
|
-
} else if (
|
|
293
|
-
jsonRpcRequest.method === "debug_traceTransaction" ||
|
|
294
|
-
jsonRpcRequest.method === "debug_traceCall"
|
|
295
|
-
) {
|
|
296
|
-
assertHardhatInvariant(
|
|
297
|
-
isDebugTraceResult(jsonRpcResponse.result),
|
|
298
|
-
"Invalid debug trace response",
|
|
299
|
-
);
|
|
300
|
-
return edrRpcDebugTraceToHardhat(jsonRpcResponse.result);
|
|
301
287
|
} else {
|
|
302
288
|
return jsonRpcResponse.result;
|
|
303
289
|
}
|
|
@@ -339,18 +325,9 @@ export class EdrProvider extends BaseProvider {
|
|
|
339
325
|
const responseError = jsonRpcResponse.error;
|
|
340
326
|
let error;
|
|
341
327
|
|
|
342
|
-
|
|
343
|
-
try {
|
|
344
|
-
stackTrace = edrResponse.stackTrace();
|
|
345
|
-
} catch (e) {
|
|
346
|
-
if (e instanceof Error) {
|
|
347
|
-
await sendErrorTelemetry(new EdrProviderStackTraceGenerationError(e));
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
log("Failed to get stack trace: %O", e);
|
|
351
|
-
}
|
|
328
|
+
const stackTrace = edrResponse.stackTrace();
|
|
352
329
|
|
|
353
|
-
if (stackTrace
|
|
330
|
+
if (stackTrace?.kind === "StackTrace") {
|
|
354
331
|
// If we have a stack trace, we know that the json rpc response data
|
|
355
332
|
// is an object with the data and transactionHash fields
|
|
356
333
|
assertHardhatInvariant(
|
|
@@ -360,11 +337,27 @@ export class EdrProvider extends BaseProvider {
|
|
|
360
337
|
|
|
361
338
|
error = createSolidityErrorWithStackTrace(
|
|
362
339
|
responseError.message,
|
|
363
|
-
stackTrace,
|
|
340
|
+
stackTrace.entries,
|
|
364
341
|
responseError.data.data,
|
|
365
342
|
responseError.data.transactionHash,
|
|
366
343
|
);
|
|
367
344
|
} else {
|
|
345
|
+
if (stackTrace !== null) {
|
|
346
|
+
if (stackTrace.kind === "UnexpectedError") {
|
|
347
|
+
await sendErrorTelemetry(
|
|
348
|
+
new EdrProviderStackTraceGenerationError(stackTrace.errorMessage),
|
|
349
|
+
);
|
|
350
|
+
log(`Failed to get stack trace: ${stackTrace.errorMessage}`);
|
|
351
|
+
} else {
|
|
352
|
+
const errHeuristicFailed =
|
|
353
|
+
"Heuristic failed to generate stack trace";
|
|
354
|
+
await sendErrorTelemetry(
|
|
355
|
+
new EdrProviderStackTraceGenerationError(errHeuristicFailed),
|
|
356
|
+
);
|
|
357
|
+
log(`Failed to get stack trace: ${errHeuristicFailed}`);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
368
361
|
error =
|
|
369
362
|
responseError.code === InvalidArgumentsError.CODE
|
|
370
363
|
? new InvalidArgumentsError(responseError.message)
|
|
@@ -373,7 +366,7 @@ export class EdrProvider extends BaseProvider {
|
|
|
373
366
|
}
|
|
374
367
|
|
|
375
368
|
/* eslint-disable-next-line no-restricted-syntax -- we may throw
|
|
376
|
-
non-
|
|
369
|
+
non-Hardhat errors inside of an EthereumProvider */
|
|
377
370
|
throw error;
|
|
378
371
|
}
|
|
379
372
|
|
|
@@ -3,8 +3,11 @@ import { CustomError } from "@nomicfoundation/hardhat-utils/error";
|
|
|
3
3
|
abstract class StackTraceGenerationError extends CustomError {}
|
|
4
4
|
|
|
5
5
|
export class EdrProviderStackTraceGenerationError extends StackTraceGenerationError {
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
6
|
+
constructor(message: string) {
|
|
7
|
+
super(
|
|
8
|
+
"Failed to generate stack trace for the EDR provider",
|
|
9
|
+
new Error(message),
|
|
10
|
+
);
|
|
8
11
|
}
|
|
9
12
|
}
|
|
10
13
|
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import type { DebugTraceResult } from "@nomicfoundation/edr";
|
|
2
|
-
|
|
3
1
|
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
4
2
|
|
|
5
|
-
export function isDebugTraceResult(
|
|
6
|
-
result: unknown,
|
|
7
|
-
): result is DebugTraceResult {
|
|
8
|
-
return (
|
|
9
|
-
isObject(result) &&
|
|
10
|
-
"pass" in result &&
|
|
11
|
-
"gasUsed" in result &&
|
|
12
|
-
"structLogs" in result
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
3
|
interface EdrProviderErrorData {
|
|
17
4
|
data: string;
|
|
18
5
|
transactionHash?: string;
|
|
@@ -9,10 +9,8 @@ import type {
|
|
|
9
9
|
} from "../../../../../types/config.js";
|
|
10
10
|
import type { ChainType } from "../../../../../types/network.js";
|
|
11
11
|
import type { GasMeasurement } from "../../../gas-analytics/types.js";
|
|
12
|
-
import type { RpcDebugTraceOutput, RpcStructLog } from "../types/output.js";
|
|
13
12
|
import type {
|
|
14
13
|
IntervalRange,
|
|
15
|
-
DebugTraceResult,
|
|
16
14
|
ChainOverride,
|
|
17
15
|
ForkConfig,
|
|
18
16
|
GasReport,
|
|
@@ -51,7 +49,6 @@ import {
|
|
|
51
49
|
HOLOCENE,
|
|
52
50
|
ISTHMUS,
|
|
53
51
|
} from "@nomicfoundation/edr";
|
|
54
|
-
import { getUnprefixedHexString } from "@nomicfoundation/hardhat-utils/hex";
|
|
55
52
|
|
|
56
53
|
import {
|
|
57
54
|
GENERIC_CHAIN_TYPE,
|
|
@@ -274,67 +271,6 @@ export function hardhatMempoolOrderToEdrMineOrdering(
|
|
|
274
271
|
}
|
|
275
272
|
}
|
|
276
273
|
|
|
277
|
-
// TODO: EDR should handle this conversion. This is a temporary solution.
|
|
278
|
-
export function edrRpcDebugTraceToHardhat(
|
|
279
|
-
debugTraceResult: DebugTraceResult,
|
|
280
|
-
): RpcDebugTraceOutput {
|
|
281
|
-
const structLogs = debugTraceResult.structLogs.map((log) => {
|
|
282
|
-
const result: RpcStructLog = {
|
|
283
|
-
depth: Number(log.depth),
|
|
284
|
-
gas: Number(log.gas),
|
|
285
|
-
gasCost: Number(log.gasCost),
|
|
286
|
-
op: log.opName,
|
|
287
|
-
pc: Number(log.pc),
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
if (log.memory !== undefined) {
|
|
291
|
-
result.memory = log.memory;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
if (log.stack !== undefined) {
|
|
295
|
-
// Remove 0x prefix which is required by EIP-3155, but not expected by Hardhat.
|
|
296
|
-
result.stack = log.stack.map(getUnprefixedHexString);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
if (log.storage !== undefined) {
|
|
300
|
-
result.storage = Object.fromEntries(
|
|
301
|
-
Object.entries(log.storage).map(([key, value]) => [
|
|
302
|
-
getUnprefixedHexString(key),
|
|
303
|
-
getUnprefixedHexString(value),
|
|
304
|
-
]),
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
if (log.error !== undefined) {
|
|
309
|
-
result.error = {
|
|
310
|
-
message: log.error,
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return result;
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
// REVM trace adds initial STOP that Hardhat doesn't expect
|
|
318
|
-
// TODO: double check with EDR team that this is still the case
|
|
319
|
-
if (structLogs.length > 0 && structLogs[0].op === "STOP") {
|
|
320
|
-
structLogs.shift();
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions --
|
|
324
|
-
debugTraceResult.output is a string, but it's typed as Buffer in Edr */
|
|
325
|
-
let returnValue = (debugTraceResult.output as unknown as string) ?? "0x";
|
|
326
|
-
if (returnValue === "0x") {
|
|
327
|
-
returnValue = "";
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return {
|
|
331
|
-
failed: !debugTraceResult.pass,
|
|
332
|
-
gas: Number(debugTraceResult.gasUsed),
|
|
333
|
-
returnValue,
|
|
334
|
-
structLogs,
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
|
|
338
274
|
export async function hardhatAccountsToEdrOwnedAccounts(
|
|
339
275
|
accounts: EdrNetworkAccountsConfig,
|
|
340
276
|
): Promise<Array<{ secretKey: string; balance: bigint }>> {
|