hardhat 3.1.12 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/dist/src/internal/builtin-global-options.d.ts.map +1 -1
- package/dist/src/internal/builtin-global-options.js +14 -1
- package/dist/src/internal/builtin-global-options.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +5 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/helpers.js +12 -0
- package/dist/src/internal/builtin-plugins/coverage/helpers.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 +2 -5
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +3 -5
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +4 -15
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts +11 -10
- 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 +80 -13
- 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 +5 -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 +25 -3
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.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 +4 -5
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js +13 -17
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js +8 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/types.d.ts +33 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/types.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.js +12 -2
- package/dist/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts +9 -3
- 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 +65 -42
- package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.d.ts +11 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.js +104 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/genesis-state.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts +6 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js +152 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts +19 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js +104 -0
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js +8 -8
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.js +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/http-provider.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js +78 -8
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.js +56 -33
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers-array.d.ts +0 -3
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers-array.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers-array.js +9 -12
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers-array.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js +1 -1
- 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.map +1 -1
- package/dist/src/internal/builtin-plugins/node/helpers.js +6 -2
- package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js +7 -2
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/artifacts.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/artifacts.js +4 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/artifacts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts +5 -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 +86 -47
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/cache.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/cache.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/cache.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.d.ts +3 -3
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js +24 -4
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.d.ts +16 -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 +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.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +1 -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.d.ts +10 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +29 -6
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.d.ts +2 -2
- 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.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +6 -0
- 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 +11 -0
- 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 +4 -2
- package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.js +249 -64
- package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/exports.d.ts +3 -0
- package/dist/src/internal/builtin-plugins/solidity/exports.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/exports.js +3 -0
- package/dist/src/internal/builtin-plugins/solidity/exports.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.js +2 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/solidity.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/solidity.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/solidity.js +7 -0
- package/dist/src/internal/builtin-plugins/solidity/hook-handlers/solidity.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/index.js +1 -0
- package/dist/src/internal/builtin-plugins/solidity/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.d.ts +18 -0
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.js +33 -0
- package/dist/src/internal/builtin-plugins/solidity/solidity-hooks.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +201 -28
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.d.ts +12 -6
- 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 +9 -7
- package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/formatters.d.ts +1 -12
- package/dist/src/internal/builtin-plugins/solidity-test/formatters.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/formatters.js +0 -150
- package/dist/src/internal/builtin-plugins/solidity-test/formatters.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +4 -3
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +5 -9
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/index.js +0 -7
- package/dist/src/internal/builtin-plugins/solidity-test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.d.ts +7 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.js +20 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.d.ts +24 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.js +68 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.d.ts +13 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.js +136 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/index.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.d.ts +19 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.js +133 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/parsing.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/types.d.ts +10 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/types.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/types.js +2 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/types.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.d.ts +12 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.js +81 -0
- package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.js.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +5 -2
- 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 +0 -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 +30 -20
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/index.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/index.js +0 -7
- package/dist/src/internal/builtin-plugins/test/index.js.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.d.ts +0 -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 +27 -13
- package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
- package/dist/src/internal/cli/help/get-help-string.d.ts.map +1 -1
- package/dist/src/internal/cli/help/get-help-string.js +1 -1
- 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 +1 -1
- package/dist/src/internal/cli/init/init.js.map +1 -1
- package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
- package/dist/src/internal/cli/init/prompt.js +1 -7
- package/dist/src/internal/cli/init/prompt.js.map +1 -1
- package/dist/src/internal/core/hre.d.ts +2 -1
- package/dist/src/internal/core/hre.d.ts.map +1 -1
- package/dist/src/internal/core/hre.js +18 -0
- package/dist/src/internal/core/hre.js.map +1 -1
- package/dist/src/internal/core/plugins/detect-plugin-npm-dependency-problems.d.ts.map +1 -1
- package/dist/src/internal/core/plugins/detect-plugin-npm-dependency-problems.js +6 -1
- package/dist/src/internal/core/plugins/detect-plugin-npm-dependency-problems.js.map +1 -1
- package/dist/src/internal/core/user-interruptions.d.ts.map +1 -1
- package/dist/src/internal/core/user-interruptions.js +2 -5
- package/dist/src/internal/core/user-interruptions.js.map +1 -1
- package/dist/src/internal/utils/colorizer.d.ts +10 -0
- package/dist/src/internal/utils/colorizer.d.ts.map +1 -0
- package/dist/src/internal/utils/colorizer.js +2 -0
- package/dist/src/internal/utils/colorizer.js.map +1 -0
- package/dist/src/internal/utils/package.d.ts.map +1 -1
- package/dist/src/internal/utils/package.js +1 -1
- package/dist/src/internal/utils/package.js.map +1 -1
- package/dist/src/types/global-options.d.ts +1 -0
- package/dist/src/types/global-options.d.ts.map +1 -1
- package/dist/src/types/hooks.d.ts +32 -0
- package/dist/src/types/hooks.d.ts.map +1 -1
- package/dist/src/types/network.d.ts +1 -1
- package/dist/src/types/network.d.ts.map +1 -1
- package/dist/src/types/solidity/compilation-job.d.ts +5 -5
- package/dist/src/types/solidity/compilation-job.d.ts.map +1 -1
- package/dist/src/types/solidity/solidity-artifacts.d.ts +15 -0
- package/dist/src/types/solidity/solidity-artifacts.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/internal/builtin-global-options.ts +15 -1
- package/src/internal/builtin-plugins/coverage/helpers.ts +31 -0
- package/src/internal/builtin-plugins/coverage/hook-handlers/hre.ts +2 -10
- package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +3 -12
- package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +4 -25
- package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +118 -18
- package/src/internal/builtin-plugins/gas-analytics/helpers.ts +44 -3
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +6 -10
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts +18 -26
- package/src/internal/builtin-plugins/gas-analytics/index.ts +9 -1
- package/src/internal/builtin-plugins/gas-analytics/type-extensions.ts +1 -0
- package/src/internal/builtin-plugins/gas-analytics/types.ts +37 -0
- package/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.ts +25 -3
- package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +107 -56
- package/src/internal/builtin-plugins/network-manager/edr/genesis-state.ts +179 -0
- package/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.ts +197 -0
- package/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.ts +137 -0
- package/src/internal/builtin-plugins/network-manager/hook-handlers/hre.ts +1 -0
- package/src/internal/builtin-plugins/network-manager/hook-handlers/network.ts +8 -11
- package/src/internal/builtin-plugins/network-manager/http-provider.ts +1 -0
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +112 -12
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.ts +98 -34
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers-array.ts +10 -30
- package/src/internal/builtin-plugins/node/artifacts/build-info-watcher.ts +1 -2
- package/src/internal/builtin-plugins/node/helpers.ts +9 -2
- package/src/internal/builtin-plugins/node/json-rpc/handler.ts +8 -2
- package/src/internal/builtin-plugins/solidity/build-system/artifacts.ts +7 -2
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +141 -65
- package/src/internal/builtin-plugins/solidity/build-system/cache.ts +1 -0
- package/src/internal/builtin-plugins/solidity/build-system/compilation-job.ts +34 -7
- package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +1 -1
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +1 -7
- package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +44 -9
- package/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.ts +4 -2
- package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +15 -0
- package/src/internal/builtin-plugins/solidity/config.ts +337 -105
- package/src/internal/builtin-plugins/solidity/exports.ts +2 -0
- package/src/internal/builtin-plugins/solidity/hook-handlers/config.ts +3 -0
- package/src/internal/builtin-plugins/solidity/hook-handlers/solidity.ts +9 -0
- package/src/internal/builtin-plugins/solidity/index.ts +1 -0
- package/src/internal/builtin-plugins/solidity/solidity-hooks.ts +53 -0
- package/src/internal/builtin-plugins/solidity/type-extensions.ts +258 -31
- package/src/internal/builtin-plugins/solidity-test/edr-artifacts.ts +22 -10
- package/src/internal/builtin-plugins/solidity-test/formatters.ts +1 -213
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +8 -8
- package/src/internal/builtin-plugins/solidity-test/index.ts +0 -7
- package/src/internal/builtin-plugins/solidity-test/inline-config/constants.ts +21 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/helpers.ts +99 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/index.ts +272 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/parsing.ts +186 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/types.ts +9 -0
- package/src/internal/builtin-plugins/solidity-test/inline-config/validation.ts +122 -0
- package/src/internal/builtin-plugins/solidity-test/reporter.ts +6 -6
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +52 -38
- package/src/internal/builtin-plugins/test/index.ts +0 -7
- package/src/internal/builtin-plugins/test/task-action.ts +39 -24
- package/src/internal/cli/help/get-help-string.ts +2 -2
- package/src/internal/cli/init/init.ts +1 -1
- package/src/internal/cli/init/prompt.ts +1 -14
- package/src/internal/core/hre.ts +33 -0
- package/src/internal/core/plugins/detect-plugin-npm-dependency-problems.ts +8 -1
- package/src/internal/core/user-interruptions.ts +3 -5
- package/src/internal/utils/colorizer.ts +9 -0
- package/src/internal/utils/package.ts +1 -2
- package/src/types/global-options.ts +1 -0
- package/src/types/hooks.ts +37 -0
- package/src/types/network.ts +2 -2
- package/src/types/solidity/compilation-job.ts +5 -5
- package/src/types/solidity/solidity-artifacts.ts +16 -0
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +6 -6
- package/templates/hardhat-3/02-mocha-ethers/package.json +11 -11
- package/templates/hardhat-3/03-minimal/package.json +1 -1
|
@@ -1,20 +1,42 @@
|
|
|
1
|
+
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
1
2
|
import chalk from "chalk";
|
|
3
|
+
import { HardhatRuntimeEnvironmentImplementation } from "../../core/hre.js";
|
|
4
|
+
import { GasAnalyticsManagerImplementation } from "./gas-analytics-manager.js";
|
|
2
5
|
import { testRunDone, testRunStart, testWorkerDone, } from "./hook-handlers/test.js";
|
|
6
|
+
export function getGasAnalyticsManager(hookContextOrHre) {
|
|
7
|
+
assertHardhatInvariant("_gasAnalytics" in hookContextOrHre &&
|
|
8
|
+
hookContextOrHre._gasAnalytics instanceof
|
|
9
|
+
GasAnalyticsManagerImplementation, "Expected _gasAnalytics to be an instance of GasAnalyticsManagerImplementation");
|
|
10
|
+
return hookContextOrHre._gasAnalytics;
|
|
11
|
+
}
|
|
12
|
+
export function setGasAnalyticsManager(hre, gasAnalyticsManager) {
|
|
13
|
+
assertHardhatInvariant(hre instanceof HardhatRuntimeEnvironmentImplementation, "Expected HRE to be an instance of HardhatRuntimeEnvironmentImplementation");
|
|
14
|
+
hre._gasAnalytics = gasAnalyticsManager;
|
|
15
|
+
}
|
|
3
16
|
/**
|
|
4
17
|
* The following helpers are kept for backward compatibility with older versions
|
|
5
18
|
* of test runner plugins (hardhat-mocha, hardhat-node-test-runner) that import
|
|
6
19
|
* from "hardhat/internal/gas-analytics".
|
|
7
20
|
*/
|
|
21
|
+
// Dynamically import the HRE when calling the helpers
|
|
22
|
+
let cachedHre;
|
|
23
|
+
async function getHre() {
|
|
24
|
+
if (cachedHre === undefined) {
|
|
25
|
+
const { default: hre } = await import("../../../index.js");
|
|
26
|
+
cachedHre = hre;
|
|
27
|
+
}
|
|
28
|
+
return cachedHre;
|
|
29
|
+
}
|
|
8
30
|
export async function markTestRunStart(id) {
|
|
9
|
-
const
|
|
31
|
+
const hre = await getHre();
|
|
10
32
|
await testRunStart(hre, id);
|
|
11
33
|
}
|
|
12
34
|
export async function markTestWorkerDone(id) {
|
|
13
|
-
const
|
|
35
|
+
const hre = await getHre();
|
|
14
36
|
await testWorkerDone(hre, id);
|
|
15
37
|
}
|
|
16
38
|
export async function markTestRunDone(id) {
|
|
17
|
-
const
|
|
39
|
+
const hre = await getHre();
|
|
18
40
|
await testRunDone(hre, id);
|
|
19
41
|
}
|
|
20
42
|
export function formatSectionHeader(sectionName, { changedLength, addedLength, removedLength, }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/helpers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,uCAAuC,EAAE,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EACL,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,yBAAyB,CAAC;AAEjC,MAAM,UAAU,sBAAsB,CACpC,gBAAyD;IAEzD,sBAAsB,CACpB,eAAe,IAAI,gBAAgB;QACjC,gBAAgB,CAAC,aAAa;YAC5B,iCAAiC,EACrC,+EAA+E,CACh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AC,CAAC;IACzC,CAAC;IACD,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QACpB,KAAK,CAAC,IAAI,CAAC,GAAG,WAAW,QAAQ,CAAC,CAAC;IACrC,CAAC;IACD,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,GAAG,aAAa,UAAU,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,GAAG,WAAW,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hre.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"hre.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;8BAKxD,OAAO,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAAzE,wBAuBG"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
|
|
2
|
-
import { HardhatRuntimeEnvironmentImplementation } from "../../../core/hre.js";
|
|
3
1
|
import { GasAnalyticsManagerImplementation } from "../gas-analytics-manager.js";
|
|
2
|
+
import { setGasAnalyticsManager } from "../helpers.js";
|
|
4
3
|
export default async () => ({
|
|
5
4
|
created: async (context, hre) => {
|
|
6
|
-
if (context.globalOptions.gasStats
|
|
5
|
+
if (context.globalOptions.gasStats ||
|
|
6
|
+
context.globalOptions.gasStatsJson !== undefined) {
|
|
7
7
|
const gasAnalyticsManager = new GasAnalyticsManagerImplementation(hre.config.paths.cache);
|
|
8
|
-
|
|
9
|
-
hre._gasAnalytics = gasAnalyticsManager;
|
|
8
|
+
setGasAnalyticsManager(hre, gasAnalyticsManager);
|
|
10
9
|
// NOTE: We register this hook dynamically to avoid a circular dependency
|
|
11
10
|
// between gas-analytics and network-manager plugins. The network-manager
|
|
12
11
|
// checks for the existence of onGasReported handlers to determine if gas
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hre.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"hre.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iCAAiC,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,eAAe,KAAK,IAAsD,EAAE,CAAC,CAAC;IAC5E,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;QAC9B,IACE,OAAO,CAAC,aAAa,CAAC,QAAQ;YAC9B,OAAO,CAAC,aAAa,CAAC,YAAY,KAAK,SAAS,EAChD,CAAC;YACD,MAAM,mBAAmB,GAAG,IAAI,iCAAiC,CAC/D,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CACvB,CAAC;YAEF,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;YAEjD,yEAAyE;YACzE,yEAAyE;YACzE,yEAAyE;YACzE,yEAAyE;YACzE,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE;gBACpC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,EAAE;oBAC7C,mBAAmB,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;gBACxD,CAAC;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;8BAIhD,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAApD,wBAeG;AASH,wBAAsB,YAAY,CAChC,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,IAAI,CAAC,CAUf"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
3
|
-
import { GasAnalyticsManagerImplementation } from "../gas-analytics-manager.js";
|
|
1
|
+
import { getGasAnalyticsManager } from "../helpers.js";
|
|
4
2
|
export default async () => ({
|
|
5
3
|
onTestRunStart: async (context, id, next) => {
|
|
6
4
|
await next(context, id);
|
|
@@ -15,28 +13,26 @@ export default async () => ({
|
|
|
15
13
|
await testRunDone(context, id);
|
|
16
14
|
},
|
|
17
15
|
});
|
|
16
|
+
function isGasStatsEnabled(context) {
|
|
17
|
+
return (context.globalOptions.gasStats === true ||
|
|
18
|
+
context.globalOptions.gasStatsJson !== undefined);
|
|
19
|
+
}
|
|
18
20
|
export async function testRunStart(context, id) {
|
|
19
|
-
if (context
|
|
20
|
-
|
|
21
|
-
isObject(context._gasAnalytics) &&
|
|
22
|
-
context._gasAnalytics instanceof GasAnalyticsManagerImplementation, "Expected HookContext#_gasAnalytics to be an instance of GasAnalyticsManagerImplementation");
|
|
23
|
-
await context._gasAnalytics.clearGasMeasurements(id);
|
|
21
|
+
if (isGasStatsEnabled(context)) {
|
|
22
|
+
await getGasAnalyticsManager(context).clearGasMeasurements(id);
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
export async function testWorkerDone(context, id) {
|
|
27
|
-
if (context
|
|
28
|
-
|
|
29
|
-
isObject(context._gasAnalytics) &&
|
|
30
|
-
context._gasAnalytics instanceof GasAnalyticsManagerImplementation, "Expected HookContext#_gasAnalytics to be an instance of GasAnalyticsManagerImplementation");
|
|
31
|
-
await context._gasAnalytics.saveGasMeasurements(id);
|
|
26
|
+
if (isGasStatsEnabled(context)) {
|
|
27
|
+
await getGasAnalyticsManager(context).saveGasMeasurements(id);
|
|
32
28
|
}
|
|
33
29
|
}
|
|
34
30
|
export async function testRunDone(context, id) {
|
|
35
31
|
if (context.globalOptions.gasStats === true) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
await context.
|
|
32
|
+
await getGasAnalyticsManager(context).reportGasStats(id);
|
|
33
|
+
}
|
|
34
|
+
if (context.globalOptions.gasStatsJson !== undefined) {
|
|
35
|
+
await getGasAnalyticsManager(context).writeGasStatsJson(context.globalOptions.gasStatsJson, id);
|
|
40
36
|
}
|
|
41
37
|
}
|
|
42
38
|
//# sourceMappingURL=test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":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AAC,EAAE,CAAC;QAC/B,MAAM,sBAAsB,CAAC,OAAO,CAAC,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,EAAU;IAEV,IAAI,OAAO,CAAC,aAAa,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,sBAAsB,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,OAAO,CAAC,aAAa,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACrD,MAAM,sBAAsB,CAAC,OAAO,CAAC,CAAC,iBAAiB,CACrD,OAAO,CAAC,aAAa,CAAC,YAAY,EAClC,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAK/D,OAAO,sBAAsB,CAAC;AAE9B,QAAA,MAAM,aAAa,EAAE,aAwDpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ArgumentType } from "../../../types/arguments.js";
|
|
2
|
+
import { globalFlag, globalOption, overrideTask } from "../../core/config.js";
|
|
2
3
|
import "./type-extensions.js";
|
|
3
4
|
const hardhatPlugin = {
|
|
4
5
|
id: "builtin:gas-analytics",
|
|
@@ -37,6 +38,12 @@ const hardhatPlugin = {
|
|
|
37
38
|
name: "gasStats",
|
|
38
39
|
description: "Collects and displays gas usage statistics for all function calls during tests",
|
|
39
40
|
}),
|
|
41
|
+
globalOption({
|
|
42
|
+
name: "gasStatsJson",
|
|
43
|
+
description: "Write gas usage statistics to a JSON file at the specified path",
|
|
44
|
+
type: ArgumentType.FILE_WITHOUT_DEFAULT,
|
|
45
|
+
defaultValue: undefined,
|
|
46
|
+
}),
|
|
40
47
|
],
|
|
41
48
|
hookHandlers: {
|
|
42
49
|
hre: () => import("./hook-handlers/hre.js"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,sBAAsB,CAAC;AAE9B,MAAM,aAAa,GAAkB;IACnC,EAAE,EAAE,uBAAuB;IAC3B,KAAK,EAAE;QACL,YAAY,CAAC,MAAM,CAAC;aACjB,OAAO,CAAC;YACP,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,wCAAwC;SACtD,CAAC;aACD,OAAO,CAAC;YACP,IAAI,EAAE,eAAe;YACrB,WAAW,EACT,mEAAmE;SACtE,CAAC;aACD,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YACtB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;gBACtC,mEAAmE;gBACnE,iCAAiC;gBACjC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;YACxB,CAAC;SACF,CAAC,CAAC;aACF,KAAK,EAAE;QACV,YAAY,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;aAC/B,OAAO,CAAC;YACP,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,kBAAkB;SAChC,CAAC;aACD,OAAO,CAAC;YACP,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,6CAA6C;SAC3D,CAAC;aACD,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC;aACrE,KAAK,EAAE;KACX;IACD,aAAa,EAAE;QACb,UAAU,CAAC;YACT,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,gFAAgF;SACnF,CAAC;QACF,YAAY,CAAC;YACX,IAAI,EAAE,cAAc;YACpB,WAAW,EACT,iEAAiE;YACnE,IAAI,EAAE,YAAY,CAAC,oBAAoB;YACvC,YAAY,EAAE,SAAS;SACxB,CAAC;KACH;IACD,YAAY,EAAE;QACZ,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,wBAAwB,CAAC;QAC3C,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,yBAAyB,CAAC;KAC9C;IACD,YAAY,EAAE,GAAG,EAAE,CAAC;QAClB,MAAM,CAAC,kBAAkB,CAAC;QAC1B,MAAM,CAAC,2BAA2B,CAAC;KACpC;IACD,UAAU,EAAE,SAAS;CACtB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-extensions.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/type-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAiB,aAAa;QAC5B,QAAQ,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"type-extensions.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/type-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAiB,aAAa;QAC5B,QAAQ,EAAE,OAAO,CAAC;QAClB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;KAClC;CACF"}
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gas statistics for a single function call or deployment (min/max/avg/median/count).
|
|
3
|
+
*/
|
|
4
|
+
export interface GasStatsJsonEntry {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
avg: number;
|
|
8
|
+
median: number;
|
|
9
|
+
count: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Gas statistics for a single contract in the JSON output.
|
|
13
|
+
* `deployment` is null when the contract was never deployed during the test run
|
|
14
|
+
* (e.g. deployed by a factory or via forking). `functions` is null when the
|
|
15
|
+
* contract was deployed but no functions were called.
|
|
16
|
+
*/
|
|
17
|
+
export interface ContractGasStatsJson {
|
|
18
|
+
sourceName: string;
|
|
19
|
+
contractName: string;
|
|
20
|
+
deployment: GasStatsJsonEntry | null;
|
|
21
|
+
functions: Record<string, GasStatsJsonEntry> | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Top-level JSON output shape produced by `--gas-stats-json`.
|
|
25
|
+
* Contract keys are user-friendly FQNs (e.g. `contracts/Foo.sol:Foo`),
|
|
26
|
+
* sorted alphabetically.
|
|
27
|
+
*/
|
|
28
|
+
export interface GasStatsJson {
|
|
29
|
+
contracts: Record<string, ContractGasStatsJson>;
|
|
30
|
+
}
|
|
1
31
|
interface BaseGasMeasurement {
|
|
2
32
|
contractFqn: string;
|
|
3
33
|
gas: number;
|
|
@@ -16,6 +46,9 @@ export interface GasAnalyticsManager {
|
|
|
16
46
|
clearGasMeasurements(id: string): Promise<void>;
|
|
17
47
|
saveGasMeasurements(id: string): Promise<void>;
|
|
18
48
|
reportGasStats(...ids: string[]): Promise<void>;
|
|
49
|
+
writeGasStatsJson(outputPath: string, ...ids: string[]): Promise<void>;
|
|
50
|
+
enableReport(): void;
|
|
51
|
+
disableReport(): void;
|
|
19
52
|
}
|
|
20
53
|
export {};
|
|
21
54
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/types.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,sBAAuB,SAAQ,kBAAkB;IACzD,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,wBAAyB,SAAQ,kBAAkB;IAC3D,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,cAAc,GAAG,sBAAsB,GAAG,wBAAwB,CAAC;AAE/E,MAAM,WAAW,mBAAmB;IAElC,iBAAiB,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACxD,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,cAAc,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/gas-analytics/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM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ys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive-private-keys.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"derive-private-keys.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.ts"],"names":[],"mappings":"AAcA,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CA+BnB"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
2
2
|
import { bytesToHexString } from "@nomicfoundation/hardhat-utils/bytes";
|
|
3
|
+
// ethereum-cryptography/bip39 is known to be slow to load, so we lazy load it
|
|
4
|
+
let mnemonicToSeedSync;
|
|
5
|
+
// ethereum-cryptography/hdkey is known to be slow to load, so we lazy load it
|
|
6
|
+
let HDKey;
|
|
3
7
|
const HD_PATH_REGEX = /^m(:?\/\d+'?)+\/?$/;
|
|
4
8
|
export async function derivePrivateKeys(mnemonic, hdpath, initialIndex, count, passphrase) {
|
|
5
9
|
if (!HD_PATH_REGEX.test(hdpath)) {
|
|
@@ -24,11 +28,17 @@ export async function derivePrivateKeys(mnemonic, hdpath, initialIndex, count, p
|
|
|
24
28
|
return privateKeys;
|
|
25
29
|
}
|
|
26
30
|
async function deriveKeyFromMnemonicAndPath(mnemonic, hdPath, passphrase) {
|
|
27
|
-
const { mnemonicToSeedSync } = await import("ethereum-cryptography/bip39");
|
|
28
|
-
const { HDKey } = await import("ethereum-cryptography/hdkey");
|
|
29
31
|
// NOTE: If mnemonic has space or newline at the beginning or end, it will be trimmed.
|
|
30
32
|
// This is because mnemonic containing them may generate different private keys.
|
|
31
33
|
const trimmedMnemonic = mnemonic.trim();
|
|
34
|
+
if (mnemonicToSeedSync === undefined) {
|
|
35
|
+
const { mnemonicToSeedSync: importedMnemonicToSeedSync } = await import("ethereum-cryptography/bip39");
|
|
36
|
+
mnemonicToSeedSync = importedMnemonicToSeedSync;
|
|
37
|
+
}
|
|
38
|
+
if (HDKey === undefined) {
|
|
39
|
+
const { HDKey: ImportedHDKey } = await import("ethereum-cryptography/hdkey");
|
|
40
|
+
HDKey = ImportedHDKey;
|
|
41
|
+
}
|
|
32
42
|
const seed = mnemonicToSeedSync(trimmedMnemonic, passphrase);
|
|
33
43
|
const masterKey = HDKey.fromMasterSeed(seed);
|
|
34
44
|
const derived = masterKey.derive(hdPath);
|
package/dist/src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive-private-keys.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"derive-private-keys.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/network-manager/accounts/derive-private-keys.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,8EAA8E;AAC9E,IAAI,kBAAgE,CAAC;AAErE,8EAA8E;AAC9E,IAAI,KAAgC,CAAC;AAErC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAgB,EAChB,MAAc,EACd,YAAoB,EACpB,KAAa,EACb,UAAkB;IAElB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CA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ED,MAAM,IAAI,GAAG,kBAAkB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;IAE7D,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEzC,OAAO,OAAO,CAAC,UAAU,KAAK,IAAI;QAChC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -6,6 +6,7 @@ import type { RequireField } from "../../../../types/utils.js";
|
|
|
6
6
|
import type { DefaultHDAccountsConfigParams } from "../accounts/constants.js";
|
|
7
7
|
import type { JsonRpcRequestWrapperFunction } from "../network-manager.js";
|
|
8
8
|
import type { SubscriptionEvent, ProviderConfig, TracingConfigWithBuffers, GasReportConfig } from "@nomicfoundation/edr";
|
|
9
|
+
import { ContractDecoder, IncludeTraces } from "@nomicfoundation/edr";
|
|
9
10
|
import { BaseProvider } from "../base-provider.js";
|
|
10
11
|
export declare const EDR_NETWORK_DEFAULT_COINBASE = "0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e";
|
|
11
12
|
interface EdrNetworkDefaultHDAccountsConfigParams extends DefaultHDAccountsConfigParams {
|
|
@@ -21,17 +22,22 @@ interface EdrProviderConfig {
|
|
|
21
22
|
chainDescriptors: ChainDescriptorsConfig;
|
|
22
23
|
networkConfig: RequireField<EdrNetworkConfig, "chainType">;
|
|
23
24
|
loggerConfig?: LoggerConfig;
|
|
24
|
-
|
|
25
|
+
contractDecoder: ContractDecoder;
|
|
25
26
|
jsonRpcRequestWrapper?: JsonRpcRequestWrapperFunction;
|
|
26
27
|
coverageConfig?: CoverageConfig;
|
|
27
28
|
gasReportConfig?: GasReportConfig;
|
|
29
|
+
includeCallTraces?: IncludeTraces;
|
|
30
|
+
connectionId: number;
|
|
31
|
+
networkName: string;
|
|
32
|
+
verbosity: number;
|
|
28
33
|
}
|
|
29
34
|
export declare class EdrProvider extends BaseProvider {
|
|
30
35
|
#private;
|
|
36
|
+
static createContractDecoder(tracingConfig: TracingConfigWithBuffers): Promise<ContractDecoder>;
|
|
31
37
|
/**
|
|
32
38
|
* Creates a new instance of `EdrProvider`.
|
|
33
39
|
*/
|
|
34
|
-
static create({ chainDescriptors, networkConfig, loggerConfig,
|
|
40
|
+
static create({ chainDescriptors, networkConfig, loggerConfig, contractDecoder, jsonRpcRequestWrapper, coverageConfig, gasReportConfig, includeCallTraces, verbosity, connectionId, networkName, }: EdrProviderConfig): Promise<EdrProvider>;
|
|
35
41
|
/**
|
|
36
42
|
* @private
|
|
37
43
|
*
|
|
@@ -45,6 +51,6 @@ export declare class EdrProvider extends BaseProvider {
|
|
|
45
51
|
addCompilationResult(solcVersion: string, compilerInput: any, compilerOutput: any): Promise<void>;
|
|
46
52
|
onSubscriptionEvent(event: SubscriptionEvent): void;
|
|
47
53
|
}
|
|
48
|
-
export declare function getProviderConfig(networkConfig: RequireField<EdrNetworkConfig, "chainType">, coverageConfig: CoverageConfig | undefined, gasReportConfig: GasReportConfig | undefined, chainDescriptors: ChainDescriptorsConfig): Promise<ProviderConfig>;
|
|
54
|
+
export declare function getProviderConfig(networkConfig: RequireField<EdrNetworkConfig, "chainType">, coverageConfig: CoverageConfig | undefined, gasReportConfig: GasReportConfig | undefined, chainDescriptors: ChainDescriptorsConfig, includeCallTraces?: IncludeTraces): Promise<ProviderConfig>;
|
|
49
55
|
export {};
|
|
50
56
|
//# sourceMappingURL=edr-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edr-provider.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/network-manager/edr/edr-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAIV,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"edr-provider.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/network-manager/edr/edr-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAIV,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,KAAK,EACV,iBAAiB,EAGjB,cAAc,EACd,wBAAwB,EACxB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAgBtE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAwBnD,eAAO,MAAM,4BAA4B,+CACK,CAAC;AAE/C,UAAU,uCACR,SAAQ,6BAA6B;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,E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CAC/B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,GAAG,EAClB,cAAc,EAAE,GAAG,GAClB,OAAO,CAAC,IAAI,CAAC;IA0GT,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;CAsD3D;AAED,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,YAAY,CAAC,gBAAgB,EAAE,WAAW,CAAC,EAC1D,cAAc,EAAE,cAAc,GAAG,SAAS,EAC1C,eAAe,EAAE,eAAe,GAAG,SAAS,EAC5C,gBAAgB,EAAE,sBAAsB,EACxC,iBAAiB,CAAC,EAAE,aAAa,GAChC,OAAO,CAAC,cAAc,CAAC,CAmDzB"}
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContractDecoder, IncludeTraces } from "@nomicfoundation/edr";
|
|
2
2
|
import { assertHardhatInvariant, HardhatError, } from "@nomicfoundation/hardhat-errors";
|
|
3
3
|
import { toSeconds } from "@nomicfoundation/hardhat-utils/date";
|
|
4
4
|
import { ensureError } from "@nomicfoundation/hardhat-utils/error";
|
|
5
5
|
import { numberToHexString } from "@nomicfoundation/hardhat-utils/hex";
|
|
6
6
|
import { deepEqual } from "@nomicfoundation/hardhat-utils/lang";
|
|
7
7
|
import debug from "debug";
|
|
8
|
-
import { hexToBytes } from "ethereum-cryptography/utils";
|
|
9
|
-
import { addr } from "micro-eth-signer";
|
|
10
8
|
import { sendErrorTelemetry } from "../../../cli/telemetry/sentry/reporter.js";
|
|
11
|
-
import { EDR_NETWORK_REVERT_SNAPSHOT_EVENT
|
|
9
|
+
import { EDR_NETWORK_REVERT_SNAPSHOT_EVENT } from "../../../constants.js";
|
|
12
10
|
import { hardhatChainTypeToEdrChainType } from "../../../edr/chain-type.js";
|
|
13
11
|
import { getGlobalEdrContext } from "../../../edr/context.js";
|
|
14
12
|
import { DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS } from "../accounts/constants.js";
|
|
15
13
|
import { BaseProvider } from "../base-provider.js";
|
|
16
14
|
import { getJsonRpcRequest, isFailedJsonRpcResponse } from "../json-rpc.js";
|
|
17
15
|
import { InvalidArgumentsError, ProviderError, UnknownError, } from "../provider-errors.js";
|
|
16
|
+
import { getGenesisStateAndOwnedAccounts } from "./genesis-state.js";
|
|
18
17
|
import { EdrProviderStackTraceGenerationError } from "./stack-traces/stack-trace-generation-errors.js";
|
|
19
18
|
import { createSolidityErrorWithStackTrace } from "./stack-traces/stack-trace-solidity-errors.js";
|
|
20
19
|
import { isEdrProviderErrorData } from "./type-validation.js";
|
|
21
20
|
import { clientVersion } from "./utils/client-version.js";
|
|
22
21
|
import { ConsoleLogger } from "./utils/console-logger.js";
|
|
23
|
-
import { hardhatMiningIntervalToEdrMiningInterval, hardhatMempoolOrderToEdrMineOrdering, hardhatHardforkToEdrSpecId,
|
|
22
|
+
import { hardhatMiningIntervalToEdrMiningInterval, hardhatMempoolOrderToEdrMineOrdering, hardhatHardforkToEdrSpecId, hardhatForkingConfigToEdrForkConfig, } from "./utils/convert-to-edr.js";
|
|
24
23
|
import { printLine, replaceLastLine } from "./utils/logger.js";
|
|
25
24
|
const log = debug("hardhat:core:hardhat-network:provider");
|
|
26
25
|
export const EDR_NETWORK_DEFAULT_COINBASE = "0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e";
|
|
@@ -64,18 +63,24 @@ export class EdrProvider extends BaseProvider {
|
|
|
64
63
|
#jsonRpcRequestWrapper;
|
|
65
64
|
#provider;
|
|
66
65
|
#nextRequestId = 1;
|
|
66
|
+
#traceOutput;
|
|
67
|
+
static async createContractDecoder(tracingConfig) {
|
|
68
|
+
return ContractDecoder.withContracts(tracingConfig);
|
|
69
|
+
}
|
|
67
70
|
/**
|
|
68
71
|
* Creates a new instance of `EdrProvider`.
|
|
69
72
|
*/
|
|
70
|
-
static async create({ chainDescriptors, networkConfig, loggerConfig = { enabled: false },
|
|
73
|
+
static async create({ chainDescriptors, networkConfig, loggerConfig = { enabled: false }, contractDecoder, jsonRpcRequestWrapper, coverageConfig, gasReportConfig, includeCallTraces, verbosity, connectionId, networkName, }) {
|
|
71
74
|
const printLineFn = loggerConfig.printLineFn ?? printLine;
|
|
72
75
|
const replaceLastLineFn = loggerConfig.replaceLastLineFn ?? replaceLastLine;
|
|
73
|
-
const providerConfig = await getProviderConfig(networkConfig, coverageConfig, gasReportConfig, chainDescriptors);
|
|
76
|
+
const providerConfig = await getProviderConfig(networkConfig, coverageConfig, gasReportConfig, chainDescriptors, includeCallTraces);
|
|
74
77
|
let edrProvider;
|
|
78
|
+
// We use a WeakRef to the provider to prevent the subscriptionCallback
|
|
79
|
+
// below from creating a cycle and leaking the provider.
|
|
80
|
+
let edrProviderWeakRef;
|
|
75
81
|
// We need to catch errors here, as the provider creation can panic unexpectedly,
|
|
76
82
|
// and we want to make sure such a crash is propagated as a ProviderError.
|
|
77
83
|
try {
|
|
78
|
-
const contractDecoder = ContractDecoder.withContracts(tracingConfig);
|
|
79
84
|
const context = await getGlobalEdrContext();
|
|
80
85
|
const provider = await context.createProvider(hardhatChainTypeToEdrChainType(networkConfig.chainType), providerConfig, {
|
|
81
86
|
enable: loggerConfig.enabled || networkConfig.loggingEnabled,
|
|
@@ -94,10 +99,21 @@ export class EdrProvider extends BaseProvider {
|
|
|
94
99
|
},
|
|
95
100
|
}, {
|
|
96
101
|
subscriptionCallback: (event) => {
|
|
97
|
-
|
|
102
|
+
const deferredProvider = edrProviderWeakRef?.deref();
|
|
103
|
+
if (deferredProvider !== undefined) {
|
|
104
|
+
deferredProvider.onSubscriptionEvent(event);
|
|
105
|
+
}
|
|
98
106
|
},
|
|
99
107
|
}, contractDecoder);
|
|
100
|
-
|
|
108
|
+
const tracesEnabled = includeCallTraces !== undefined &&
|
|
109
|
+
includeCallTraces !== IncludeTraces.None;
|
|
110
|
+
let traceOutput;
|
|
111
|
+
if (tracesEnabled) {
|
|
112
|
+
const { TraceOutputManager: TraceOutputManagerImpl } = await import("./utils/trace-output.js");
|
|
113
|
+
traceOutput = new TraceOutputManagerImpl(printLineFn, connectionId, networkName, verbosity);
|
|
114
|
+
}
|
|
115
|
+
edrProvider = new EdrProvider(provider, traceOutput, jsonRpcRequestWrapper);
|
|
116
|
+
edrProviderWeakRef = new WeakRef(edrProvider);
|
|
101
117
|
}
|
|
102
118
|
catch (error) {
|
|
103
119
|
ensureError(error);
|
|
@@ -113,10 +129,18 @@ export class EdrProvider extends BaseProvider {
|
|
|
113
129
|
* Use the static method {@link EdrProvider.create} to create an instance of
|
|
114
130
|
* `EdrProvider`.
|
|
115
131
|
*/
|
|
116
|
-
constructor(provider, jsonRpcRequestWrapper) {
|
|
132
|
+
constructor(provider, traceOutput, jsonRpcRequestWrapper) {
|
|
117
133
|
super();
|
|
118
134
|
this.#provider = provider;
|
|
135
|
+
this.#traceOutput = traceOutput;
|
|
119
136
|
this.#jsonRpcRequestWrapper = jsonRpcRequestWrapper;
|
|
137
|
+
// After a snapshot revert, the same transactions may run again.
|
|
138
|
+
// Reset traced hashes so their traces are printed a second time.
|
|
139
|
+
if (this.#traceOutput !== undefined) {
|
|
140
|
+
this.on(EDR_NETWORK_REVERT_SNAPSHOT_EVENT, () => {
|
|
141
|
+
this.#traceOutput?.clearTracedHashes();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
120
144
|
}
|
|
121
145
|
async request(requestArguments) {
|
|
122
146
|
if (this.#provider === undefined) {
|
|
@@ -153,8 +177,10 @@ export class EdrProvider extends BaseProvider {
|
|
|
153
177
|
}
|
|
154
178
|
}
|
|
155
179
|
async close() {
|
|
180
|
+
this.removeAllListeners();
|
|
156
181
|
// Clear the provider reference to help with garbage collection
|
|
157
182
|
this.#provider = undefined;
|
|
183
|
+
this.#traceOutput?.clearTracedHashes();
|
|
158
184
|
}
|
|
159
185
|
async addCompilationResult(solcVersion, compilerInput, compilerOutput) {
|
|
160
186
|
if (this.#provider === undefined) {
|
|
@@ -162,8 +188,9 @@ export class EdrProvider extends BaseProvider {
|
|
|
162
188
|
}
|
|
163
189
|
await this.#provider.addCompilationResult(solcVersion, compilerInput, compilerOutput);
|
|
164
190
|
}
|
|
165
|
-
async #handleEdrResponse(edrResponse) {
|
|
191
|
+
async #handleEdrResponse(edrResponse, method, params) {
|
|
166
192
|
let jsonRpcResponse;
|
|
193
|
+
let txHash;
|
|
167
194
|
if (typeof edrResponse.data === "string") {
|
|
168
195
|
jsonRpcResponse = JSON.parse(edrResponse.data);
|
|
169
196
|
}
|
|
@@ -173,6 +200,11 @@ export class EdrProvider extends BaseProvider {
|
|
|
173
200
|
if (isFailedJsonRpcResponse(jsonRpcResponse)) {
|
|
174
201
|
const responseError = jsonRpcResponse.error;
|
|
175
202
|
let error;
|
|
203
|
+
// Grab the tx hash so trace deduplication can recognize this transaction later
|
|
204
|
+
const errorData = responseError.data;
|
|
205
|
+
if (isEdrProviderErrorData(errorData)) {
|
|
206
|
+
txHash = errorData.transactionHash;
|
|
207
|
+
}
|
|
176
208
|
const stackTrace = edrResponse.stackTrace();
|
|
177
209
|
if (stackTrace?.kind === "StackTrace") {
|
|
178
210
|
// If we have a stack trace, we know that the json rpc response data
|
|
@@ -198,10 +230,27 @@ export class EdrProvider extends BaseProvider {
|
|
|
198
230
|
: new ProviderError(responseError.message, responseError.code);
|
|
199
231
|
error.data = responseError.data;
|
|
200
232
|
}
|
|
233
|
+
this.#traceOutput?.outputCallTraces(edrResponse, method, txHash, true);
|
|
201
234
|
/* eslint-disable-next-line no-restricted-syntax -- we may throw
|
|
202
235
|
non-Hardhat errors inside of an EthereumProvider */
|
|
203
236
|
throw error;
|
|
204
237
|
}
|
|
238
|
+
if (this.#traceOutput !== undefined) {
|
|
239
|
+
// Output call traces for successful responses. The tx hash is resolved
|
|
240
|
+
// from the response/params so the trace manager can deduplicate.
|
|
241
|
+
if (method === "eth_sendTransaction" ||
|
|
242
|
+
method === "eth_sendRawTransaction") {
|
|
243
|
+
txHash =
|
|
244
|
+
typeof jsonRpcResponse.result === "string"
|
|
245
|
+
? jsonRpcResponse.result
|
|
246
|
+
: undefined;
|
|
247
|
+
}
|
|
248
|
+
else if (method === "eth_getTransactionReceipt") {
|
|
249
|
+
// params[0] is the tx hash being queried — used to dedup receipt polling
|
|
250
|
+
txHash = typeof params?.[0] === "string" ? params[0] : undefined;
|
|
251
|
+
}
|
|
252
|
+
this.#traceOutput.outputCallTraces(edrResponse, method, txHash, false);
|
|
253
|
+
}
|
|
205
254
|
return jsonRpcResponse;
|
|
206
255
|
}
|
|
207
256
|
onSubscriptionEvent(event) {
|
|
@@ -242,39 +291,12 @@ export class EdrProvider extends BaseProvider {
|
|
|
242
291
|
// eslint-disable-next-line no-restricted-syntax -- allow throwing UnknownError
|
|
243
292
|
throw new UnknownError(error.message, error);
|
|
244
293
|
}
|
|
245
|
-
return this.#handleEdrResponse(edrResponse);
|
|
294
|
+
return this.#handleEdrResponse(edrResponse, request.method, Array.isArray(request.params) ? request.params : undefined);
|
|
246
295
|
}
|
|
247
296
|
}
|
|
248
|
-
export async function getProviderConfig(networkConfig, coverageConfig, gasReportConfig, chainDescriptors) {
|
|
297
|
+
export async function getProviderConfig(networkConfig, coverageConfig, gasReportConfig, chainDescriptors, includeCallTraces) {
|
|
249
298
|
const specId = hardhatHardforkToEdrSpecId(networkConfig.hardfork, networkConfig.chainType);
|
|
250
|
-
const ownedAccounts = await
|
|
251
|
-
const genesisState = new Map(ownedAccounts.map(({ secretKey, balance }) => {
|
|
252
|
-
const address = hexToBytes(addr.fromPrivateKey(secretKey));
|
|
253
|
-
const accountOverride = {
|
|
254
|
-
address,
|
|
255
|
-
balance: BigInt(balance),
|
|
256
|
-
code: new Uint8Array(), // Empty account code, removing potential delegation code when forking
|
|
257
|
-
};
|
|
258
|
-
return [address, accountOverride];
|
|
259
|
-
}));
|
|
260
|
-
const chainGenesisState = networkConfig.forking !== undefined
|
|
261
|
-
? [] // TODO: Add support for overriding remote fork state when the local fork is different
|
|
262
|
-
: networkConfig.chainType === OPTIMISM_CHAIN_TYPE
|
|
263
|
-
? opGenesisState(opHardforkFromString(specId))
|
|
264
|
-
: l1GenesisState(l1HardforkFromString(specId));
|
|
265
|
-
for (const account of chainGenesisState) {
|
|
266
|
-
const existingOverride = genesisState.get(account.address);
|
|
267
|
-
if (existingOverride !== undefined) {
|
|
268
|
-
// Favor the genesis state specified by the user
|
|
269
|
-
account.balance = account.balance ?? existingOverride.balance;
|
|
270
|
-
account.nonce = account.nonce ?? existingOverride.nonce;
|
|
271
|
-
account.code = account.code ?? existingOverride.code;
|
|
272
|
-
account.storage = account.storage ?? existingOverride.storage;
|
|
273
|
-
}
|
|
274
|
-
else {
|
|
275
|
-
genesisState.set(account.address, account);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
299
|
+
const { genesisState, ownedAccounts } = await getGenesisStateAndOwnedAccounts(networkConfig.accounts, networkConfig.forking, networkConfig.chainType, specId);
|
|
278
300
|
return {
|
|
279
301
|
allowBlocksWithSameTimestamp: networkConfig.allowBlocksWithSameTimestamp,
|
|
280
302
|
allowUnlimitedContractSize: networkConfig.allowUnlimitedContractSize,
|
|
@@ -300,6 +322,7 @@ export async function getProviderConfig(networkConfig, coverageConfig, gasReport
|
|
|
300
322
|
observability: {
|
|
301
323
|
codeCoverage: coverageConfig,
|
|
302
324
|
gasReport: gasReportConfig,
|
|
325
|
+
includeCallTraces,
|
|
303
326
|
},
|
|
304
327
|
ownedAccounts: ownedAccounts.map((account) => account.secretKey),
|
|
305
328
|
precompileOverrides: [],
|