hardhat 3.2.0 → 3.4.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 +88 -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/artifacts/artifact-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js +5 -13
- package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/console/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/console/task-action.js +2 -1
- package/dist/src/internal/builtin-plugins/console/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/exports.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/exports.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/exports.js +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/exports.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +1 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts +7 -5
- 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 +60 -44
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.d.ts +6 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js +14 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/compat.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/compat.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/compat.js +27 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/compat.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.d.ts +36 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js +86 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js +1 -1
- 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.js +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +1 -2
- package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/types.d.ts +10 -2
- 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/stack-traces/solidity-stack-trace.d.ts +4 -4
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/solidity-stack-trace.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/solidity-stack-trace.js +2 -2
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/solidity-stack-trace.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.d.ts +6 -3
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.js +23 -5
- package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.js.map +1 -1
- 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 +2 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts +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.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js +23 -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 +25 -17
- 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 +12 -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 +149 -26
- 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/hd-wallet-handler.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/hd-wallet-handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.d.ts +1 -0
- 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 +70 -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/accounts/sender.d.ts +2 -0
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/sender.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/sender.js +19 -12
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/sender.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/chain-id/chain-id-handler.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/chain-id/chain-id-handler.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/chain-id/chain-id-handler.js +9 -3
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/chain-id/chain-id-handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/automatic-gas-handler.d.ts +2 -0
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/automatic-gas-handler.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/automatic-gas-handler.js +5 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/automatic-gas-handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/automatic-gas-price-handler.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/automatic-gas-price-handler.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/automatic-gas-price-handler.js +5 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/automatic-gas-price-handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/fixed-gas-handler.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/fixed-gas-handler.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/fixed-gas-handler.js +5 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/fixed-gas-handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/fixed-gas-price-handler.d.ts +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/fixed-gas-price-handler.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/fixed-gas-price-handler.js +5 -1
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/fixed-gas-price-handler.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/network-manager/request-handlers/types.d.ts +9 -0
- package/dist/src/internal/builtin-plugins/network-manager/request-handlers/types.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/revert-error-code.d.ts +2 -0
- package/dist/src/internal/builtin-plugins/network-manager/revert-error-code.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/revert-error-code.js +3 -0
- package/dist/src/internal/builtin-plugins/network-manager/revert-error-code.js.map +1 -0
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts.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 +2 -1
- package/dist/src/internal/builtin-plugins/network-manager/type-validation.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.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js +8 -2
- package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js.map +1 -1
- package/dist/src/internal/builtin-plugins/node/task-action.js +2 -2
- package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
- package/dist/src/internal/builtin-plugins/run/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/run/task-action.js +2 -1
- package/dist/src/internal/builtin-plugins/run/task-action.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 +7 -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 +6 -2
- 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 +198 -76
- 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 +3 -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 +5 -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 +35 -7
- 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 -1
- 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.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph.js +5 -5
- package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph.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.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +1 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/warning-suppression.js +2 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/warning-suppression.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 +266 -84
- package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +3 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.js +19 -0
- package/dist/src/internal/builtin-plugins/solidity/constants.js.map +1 -0
- 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/tasks/build.d.ts +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js +225 -55
- package/dist/src/internal/builtin-plugins/solidity/tasks/build.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +227 -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/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/config.js +5 -3
- 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 +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 -5
- 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 -12
- 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/runner.d.ts +2 -8
- package/dist/src/internal/builtin-plugins/solidity-test/runner.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/runner.js +47 -50
- package/dist/src/internal/builtin-plugins/solidity-test/runner.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.js +11 -2
- package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.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 +122 -39
- 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 -2
- package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.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 +4 -8
- 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/cli/main.d.ts.map +1 -1
- package/dist/src/internal/cli/main.js +8 -0
- package/dist/src/internal/cli/main.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/artifacts.d.ts +5 -4
- package/dist/src/types/artifacts.d.ts.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 +39 -0
- package/dist/src/types/network.d.ts.map +1 -1
- package/dist/src/types/solidity/build-system.d.ts +66 -3
- package/dist/src/types/solidity/build-system.d.ts.map +1 -1
- package/dist/src/types/solidity/build-system.js.map +1 -1
- package/dist/src/types/solidity/compilation-job.d.ts +11 -5
- package/dist/src/types/solidity/compilation-job.d.ts.map +1 -1
- package/dist/src/types/solidity/solidity-artifacts.d.ts +29 -0
- package/dist/src/types/solidity/solidity-artifacts.d.ts.map +1 -1
- package/package.json +10 -9
- package/src/internal/builtin-global-options.ts +15 -1
- package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +9 -15
- package/src/internal/builtin-plugins/console/task-action.ts +2 -1
- package/src/internal/builtin-plugins/gas-analytics/exports.ts +1 -1
- package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +1 -2
- package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +100 -61
- package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +31 -0
- package/src/internal/builtin-plugins/gas-analytics/helpers/compat.ts +37 -0
- package/src/internal/builtin-plugins/gas-analytics/helpers/utils.ts +112 -0
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +1 -1
- package/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts +1 -1
- package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +1 -2
- package/src/internal/builtin-plugins/gas-analytics/types.ts +11 -2
- 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/stack-traces/solidity-stack-trace.ts +4 -0
- package/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.ts +28 -4
- package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +2 -1
- 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 +30 -0
- package/src/internal/builtin-plugins/network-manager/hook-handlers/network.ts +27 -24
- package/src/internal/builtin-plugins/network-manager/http-provider.ts +1 -0
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +213 -37
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/hd-wallet-handler.ts +1 -0
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.ts +115 -34
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/sender.ts +25 -17
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/chain-id/chain-id-handler.ts +13 -5
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/automatic-gas-handler.ts +7 -1
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/automatic-gas-price-handler.ts +7 -1
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/fixed-gas-handler.ts +7 -1
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/gas/fixed-gas-price-handler.ts +7 -1
- package/src/internal/builtin-plugins/network-manager/request-handlers/handlers-array.ts +10 -30
- package/src/internal/builtin-plugins/network-manager/request-handlers/types.ts +10 -0
- package/src/internal/builtin-plugins/network-manager/revert-error-code.ts +2 -0
- package/src/internal/builtin-plugins/network-manager/type-extensions/config.ts +1 -1
- package/src/internal/builtin-plugins/network-manager/type-validation.ts +5 -1
- 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 +10 -2
- package/src/internal/builtin-plugins/node/task-action.ts +2 -2
- package/src/internal/builtin-plugins/run/task-action.ts +2 -1
- package/src/internal/builtin-plugins/solidity/build-system/artifacts.ts +10 -2
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +297 -99
- package/src/internal/builtin-plugins/solidity/build-system/cache.ts +3 -0
- package/src/internal/builtin-plugins/solidity/build-system/compilation-job.ts +49 -16
- 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 -2
- package/src/internal/builtin-plugins/solidity/build-system/dependency-graph.ts +9 -7
- 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 +1 -0
- package/src/internal/builtin-plugins/solidity/build-system/warning-suppression.ts +2 -2
- package/src/internal/builtin-plugins/solidity/config.ts +359 -124
- package/src/internal/builtin-plugins/solidity/constants.ts +21 -0
- 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/tasks/build.ts +359 -74
- package/src/internal/builtin-plugins/solidity/type-extensions.ts +289 -32
- package/src/internal/builtin-plugins/solidity-test/config.ts +11 -2
- 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 -15
- 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/runner.ts +64 -83
- package/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.ts +15 -2
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +192 -57
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -2
- package/src/internal/builtin-plugins/test/index.ts +0 -7
- package/src/internal/builtin-plugins/test/task-action.ts +4 -10
- 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/cli/main.ts +14 -0
- 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/artifacts.ts +5 -4
- package/src/types/global-options.ts +1 -0
- package/src/types/hooks.ts +37 -0
- package/src/types/network.ts +48 -0
- package/src/types/solidity/build-system.ts +66 -3
- package/src/types/solidity/compilation-job.ts +12 -5
- package/src/types/solidity/solidity-artifacts.ts +32 -0
- package/templates/hardhat-2/04-mocha-viem-ts/package.json +1 -1
- package/templates/hardhat-3/01-node-test-runner-viem/gitignore +11 -0
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +12 -12
- package/templates/hardhat-3/01-node-test-runner-viem/scripts/send-op-tx.ts +1 -1
- package/templates/hardhat-3/01-node-test-runner-viem/test/Counter.ts +1 -1
- package/templates/hardhat-3/02-mocha-ethers/gitignore +11 -0
- package/templates/hardhat-3/02-mocha-ethers/package.json +14 -14
- package/templates/hardhat-3/02-mocha-ethers/scripts/send-op-tx.ts +1 -1
- package/templates/hardhat-3/02-mocha-ethers/test/Counter.ts +1 -1
- package/templates/hardhat-3/03-minimal/gitignore +11 -0
- package/templates/hardhat-3/03-minimal/package.json +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts +0 -19
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts.map +0 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js +0 -46
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js.map +0 -1
- package/src/internal/builtin-plugins/gas-analytics/helpers.ts +0 -86
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { CompileCache } from "./cache.js";
|
|
2
2
|
import type { DependencyGraphImplementation } from "./dependency-graph.js";
|
|
3
3
|
import type { Artifact } from "../../../../types/artifacts.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
SolidityCompilerConfig,
|
|
6
|
+
SolcSolidityCompilerConfig,
|
|
7
|
+
SolidityConfig,
|
|
8
|
+
} from "../../../../types/config.js";
|
|
5
9
|
import type { HookManager } from "../../../../types/hooks.js";
|
|
6
10
|
import type {
|
|
7
11
|
SolidityBuildSystem,
|
|
@@ -18,6 +22,7 @@ import type {
|
|
|
18
22
|
CacheHitInfo,
|
|
19
23
|
} from "../../../../types/solidity/build-system.js";
|
|
20
24
|
import type {
|
|
25
|
+
ToolVersions,
|
|
21
26
|
CompilationJob,
|
|
22
27
|
Compiler,
|
|
23
28
|
CompilerOutput,
|
|
@@ -53,7 +58,9 @@ import debug from "debug";
|
|
|
53
58
|
import pMap from "p-map";
|
|
54
59
|
|
|
55
60
|
import { FileBuildResultType } from "../../../../types/solidity/build-system.js";
|
|
61
|
+
import { getHardhatVersion } from "../../../utils/package.js";
|
|
56
62
|
import { DEFAULT_BUILD_PROFILE } from "../build-profiles.js";
|
|
63
|
+
import { getSolcCompilerForConfig } from "../solidity-hooks.js";
|
|
57
64
|
|
|
58
65
|
import {
|
|
59
66
|
getArtifactsDeclarationFile,
|
|
@@ -79,14 +86,12 @@ import { shouldSuppressWarning } from "./warning-suppression.js";
|
|
|
79
86
|
const log = debug("hardhat:core:solidity:build-system");
|
|
80
87
|
|
|
81
88
|
/**
|
|
82
|
-
*
|
|
83
|
-
* to the build profile's preferWasm if not set on the compiler.
|
|
89
|
+
* Returns true if the given compiler config is a SolcSolidityCompilerConfig.
|
|
84
90
|
*/
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return solcConfig.preferWasm ?? buildProfilePreferWasm;
|
|
91
|
+
export function isSolcSolidityCompilerConfig(
|
|
92
|
+
config: SolidityCompilerConfig,
|
|
93
|
+
): config is SolcSolidityCompilerConfig {
|
|
94
|
+
return config.type === undefined || config.type === "solc";
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
// Compiler warnings to suppress from build output.
|
|
@@ -150,15 +155,17 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
150
155
|
|
|
151
156
|
public async getScope(fsPath: string): Promise<BuildScope> {
|
|
152
157
|
if (
|
|
153
|
-
fsPath.startsWith(this.#options.solidityTestsPath) &&
|
|
158
|
+
fsPath.startsWith(this.#options.solidityTestsPath + path.sep) &&
|
|
154
159
|
fsPath.endsWith(".sol")
|
|
155
160
|
) {
|
|
156
161
|
return "tests";
|
|
157
162
|
}
|
|
158
163
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
if (fsPath.endsWith(".t.sol")) {
|
|
165
|
+
for (const sourcesPath of this.#options.soliditySourcesPaths) {
|
|
166
|
+
if (fsPath.startsWith(sourcesPath + path.sep)) {
|
|
167
|
+
return "tests";
|
|
168
|
+
}
|
|
162
169
|
}
|
|
163
170
|
}
|
|
164
171
|
|
|
@@ -169,10 +176,13 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
169
176
|
options: { scope?: BuildScope } = {},
|
|
170
177
|
): Promise<string[]> {
|
|
171
178
|
const scope = options.scope ?? "contracts";
|
|
179
|
+
const unified = !this.#options.solidityConfig.splitTestsCompilation;
|
|
180
|
+
|
|
181
|
+
this.#ensureSplitCompilationModeIfTestsScope(scope);
|
|
172
182
|
|
|
173
183
|
switch (scope) {
|
|
174
|
-
case "contracts":
|
|
175
|
-
const
|
|
184
|
+
case "contracts": {
|
|
185
|
+
const localContractFiles = (
|
|
176
186
|
await Promise.all(
|
|
177
187
|
this.#options.soliditySourcesPaths.map((dir) =>
|
|
178
188
|
getAllFilesMatching(
|
|
@@ -188,8 +198,30 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
188
198
|
npmModuleToNpmRootPath,
|
|
189
199
|
);
|
|
190
200
|
|
|
191
|
-
|
|
192
|
-
|
|
201
|
+
if (!unified) {
|
|
202
|
+
return [...localContractFiles, ...npmFilesToBuild];
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// In unified mode, contracts scope returns all roots: contracts,
|
|
206
|
+
// tests, and npm files.
|
|
207
|
+
const testFiles = (
|
|
208
|
+
await Promise.all([
|
|
209
|
+
getAllFilesMatching(this.#options.solidityTestsPath, (f) =>
|
|
210
|
+
f.endsWith(".sol"),
|
|
211
|
+
),
|
|
212
|
+
...this.#options.soliditySourcesPaths.map(async (dir) => {
|
|
213
|
+
return getAllFilesMatching(dir, (f) => f.endsWith(".t.sol"));
|
|
214
|
+
}),
|
|
215
|
+
])
|
|
216
|
+
).flat(1);
|
|
217
|
+
|
|
218
|
+
// Remove duplicates in case there is an intersection between
|
|
219
|
+
// the tests.solidity paths and the sources paths
|
|
220
|
+
return Array.from(
|
|
221
|
+
new Set([...localContractFiles, ...npmFilesToBuild, ...testFiles]),
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
case "tests": {
|
|
193
225
|
let rootFilePaths = (
|
|
194
226
|
await Promise.all([
|
|
195
227
|
getAllFilesMatching(this.#options.solidityTestsPath, (f) =>
|
|
@@ -205,6 +237,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
205
237
|
// the tests.solidity paths and the sources paths
|
|
206
238
|
rootFilePaths = Array.from(new Set(rootFilePaths));
|
|
207
239
|
return rootFilePaths;
|
|
240
|
+
}
|
|
208
241
|
}
|
|
209
242
|
}
|
|
210
243
|
|
|
@@ -216,12 +249,14 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
216
249
|
|
|
217
250
|
public async build(
|
|
218
251
|
rootFilePaths: string[],
|
|
219
|
-
|
|
252
|
+
options?: BuildOptions,
|
|
220
253
|
): Promise<CompilationJobCreationError | Map<string, FileBuildResult>> {
|
|
254
|
+
this.#ensureSplitCompilationModeIfTestsScope(options?.scope);
|
|
255
|
+
|
|
221
256
|
return this.#hooks.runHandlerChain(
|
|
222
257
|
"solidity",
|
|
223
258
|
"build",
|
|
224
|
-
[rootFilePaths,
|
|
259
|
+
[rootFilePaths, options],
|
|
225
260
|
async (_context, nextRootFilePaths, nextOptions) =>
|
|
226
261
|
this.#build(nextRootFilePaths, nextOptions),
|
|
227
262
|
);
|
|
@@ -229,25 +264,27 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
229
264
|
|
|
230
265
|
async #build(
|
|
231
266
|
rootFilePaths: string[],
|
|
232
|
-
|
|
267
|
+
options?: BuildOptions,
|
|
233
268
|
): Promise<CompilationJobCreationError | Map<string, FileBuildResult>> {
|
|
234
|
-
const
|
|
269
|
+
const resolvedOptions: Required<BuildOptions> = {
|
|
235
270
|
buildProfile: DEFAULT_BUILD_PROFILE,
|
|
236
271
|
concurrency: Math.max(os.cpus().length - 1, 1),
|
|
237
272
|
force: false,
|
|
238
273
|
isolated: false,
|
|
239
274
|
quiet: false,
|
|
240
275
|
scope: "contracts",
|
|
241
|
-
...
|
|
276
|
+
...options,
|
|
242
277
|
};
|
|
243
278
|
|
|
244
|
-
await this.#downloadConfiguredCompilers(
|
|
279
|
+
await this.#downloadConfiguredCompilers(resolvedOptions.quiet);
|
|
245
280
|
|
|
246
|
-
const { buildProfile } = this.#getBuildProfile(
|
|
281
|
+
const { buildProfile } = this.#getBuildProfile(
|
|
282
|
+
resolvedOptions.buildProfile,
|
|
283
|
+
);
|
|
247
284
|
|
|
248
285
|
const compilationJobsResult = await this.getCompilationJobs(
|
|
249
286
|
rootFilePaths,
|
|
250
|
-
|
|
287
|
+
resolvedOptions,
|
|
251
288
|
);
|
|
252
289
|
|
|
253
290
|
if (!compilationJobsResult.success) {
|
|
@@ -255,7 +292,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
255
292
|
}
|
|
256
293
|
|
|
257
294
|
const spinner = createSpinner({
|
|
258
|
-
text: `Compiling your Solidity ${
|
|
295
|
+
text: `Compiling your Solidity ${resolvedOptions.scope}...`,
|
|
259
296
|
enabled: true,
|
|
260
297
|
});
|
|
261
298
|
spinner.start();
|
|
@@ -281,7 +318,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
281
318
|
async (runnableCompilationJob) => {
|
|
282
319
|
const { output, compiler } = await this.runCompilationJob(
|
|
283
320
|
runnableCompilationJob,
|
|
284
|
-
|
|
321
|
+
resolvedOptions,
|
|
285
322
|
);
|
|
286
323
|
|
|
287
324
|
return {
|
|
@@ -291,7 +328,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
291
328
|
};
|
|
292
329
|
},
|
|
293
330
|
{
|
|
294
|
-
concurrency:
|
|
331
|
+
concurrency: resolvedOptions.concurrency,
|
|
295
332
|
// An error when running the compiler is not a compilation failure, but
|
|
296
333
|
// a fatal failure trying to run it, so we just throw on the first error
|
|
297
334
|
stopOnError: true,
|
|
@@ -316,7 +353,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
316
353
|
const emitArtifactsResult = await this.emitArtifacts(
|
|
317
354
|
compilationResult.compilationJob,
|
|
318
355
|
compilationResult.compilerOutput,
|
|
319
|
-
|
|
356
|
+
resolvedOptions,
|
|
320
357
|
);
|
|
321
358
|
|
|
322
359
|
const { artifactsPerFile } = emitArtifactsResult;
|
|
@@ -332,7 +369,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
332
369
|
compilationResult,
|
|
333
370
|
emitArtifactsResult,
|
|
334
371
|
buildProfile.isolated,
|
|
335
|
-
|
|
372
|
+
resolvedOptions.scope,
|
|
336
373
|
);
|
|
337
374
|
}),
|
|
338
375
|
);
|
|
@@ -400,10 +437,10 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
400
437
|
});
|
|
401
438
|
}
|
|
402
439
|
|
|
403
|
-
if (!
|
|
440
|
+
if (!resolvedOptions.quiet) {
|
|
404
441
|
if (isSuccessfulBuild) {
|
|
405
442
|
await this.#printCompilationResult(runnableCompilationJobs, {
|
|
406
|
-
scope:
|
|
443
|
+
scope: resolvedOptions.scope,
|
|
407
444
|
});
|
|
408
445
|
}
|
|
409
446
|
}
|
|
@@ -418,6 +455,8 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
418
455
|
rootFilePaths: string[],
|
|
419
456
|
options?: GetCompilationJobsOptions,
|
|
420
457
|
): Promise<CompilationJobCreationError | GetCompilationJobsResult> {
|
|
458
|
+
this.#ensureSplitCompilationModeIfTestsScope(options?.scope);
|
|
459
|
+
|
|
421
460
|
await this.#downloadConfiguredCompilers(options?.quiet);
|
|
422
461
|
|
|
423
462
|
const dependencyGraph = await buildDependencyGraph(
|
|
@@ -433,13 +472,18 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
433
472
|
|
|
434
473
|
log(`Using build profile ${buildProfileName}`);
|
|
435
474
|
|
|
475
|
+
let toolVersions: ToolVersions | undefined;
|
|
476
|
+
if (buildProfile.toolVersionsInBuildInfo === true) {
|
|
477
|
+
toolVersions = { hardhat: await getHardhatVersion() };
|
|
478
|
+
}
|
|
479
|
+
|
|
436
480
|
const solcConfigSelector = new SolcConfigSelector(
|
|
437
481
|
buildProfileName,
|
|
438
482
|
buildProfile,
|
|
439
483
|
);
|
|
440
484
|
|
|
441
485
|
let subgraphsWithConfig: Array<
|
|
442
|
-
[
|
|
486
|
+
[SolidityCompilerConfig, DependencyGraphImplementation]
|
|
443
487
|
> = [];
|
|
444
488
|
for (const [rootFile, resolvedFile] of dependencyGraph.getRoots()) {
|
|
445
489
|
log(
|
|
@@ -459,19 +503,47 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
459
503
|
}
|
|
460
504
|
|
|
461
505
|
// get longVersion and isWasm from the compiler for each version
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
506
|
+
// These maps are keyed by compiler type first, then version, to avoid
|
|
507
|
+
// collisions between different compiler types using the same version string.
|
|
508
|
+
const solidityVersionToLongVersionPerCompilerType = new Map<
|
|
509
|
+
string,
|
|
510
|
+
Map<string, string>
|
|
511
|
+
>();
|
|
512
|
+
const versionIsWasmPerCompilerType = new Map<
|
|
513
|
+
string,
|
|
514
|
+
Map<string, boolean>
|
|
515
|
+
>();
|
|
516
|
+
for (const [compilerConfig] of subgraphsWithConfig) {
|
|
517
|
+
const compilerType = compilerConfig.type ?? "solc";
|
|
518
|
+
let longVersionMap =
|
|
519
|
+
solidityVersionToLongVersionPerCompilerType.get(compilerType);
|
|
520
|
+
if (longVersionMap === undefined) {
|
|
521
|
+
longVersionMap = new Map();
|
|
522
|
+
solidityVersionToLongVersionPerCompilerType.set(
|
|
523
|
+
compilerType,
|
|
524
|
+
longVersionMap,
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
let isWasmMap = versionIsWasmPerCompilerType.get(compilerType);
|
|
529
|
+
if (isWasmMap === undefined) {
|
|
530
|
+
isWasmMap = new Map();
|
|
531
|
+
versionIsWasmPerCompilerType.set(compilerType, isWasmMap);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
let longVersion = longVersionMap.get(compilerConfig.version);
|
|
535
|
+
|
|
536
|
+
if (longVersion === undefined) {
|
|
537
|
+
const compiler = await this.#hooks.runHandlerChain(
|
|
538
|
+
"solidity",
|
|
539
|
+
"getCompiler",
|
|
540
|
+
[compilerConfig],
|
|
541
|
+
async (_context, cfg) =>
|
|
542
|
+
getSolcCompilerForConfig(cfg, buildProfile.preferWasm),
|
|
543
|
+
);
|
|
544
|
+
longVersion = compiler.longVersion;
|
|
545
|
+
longVersionMap.set(compilerConfig.version, longVersion);
|
|
546
|
+
isWasmMap.set(compilerConfig.version, compiler.isSolcJs);
|
|
475
547
|
}
|
|
476
548
|
}
|
|
477
549
|
|
|
@@ -480,19 +552,29 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
480
552
|
const sharedContentHashes = new Map<string, string>();
|
|
481
553
|
await Promise.all(
|
|
482
554
|
subgraphsWithConfig.map(async ([config, subgraph]) => {
|
|
483
|
-
const
|
|
555
|
+
const compilerType = config.type ?? "solc";
|
|
556
|
+
const longVersionMap =
|
|
557
|
+
solidityVersionToLongVersionPerCompilerType.get(compilerType);
|
|
484
558
|
|
|
485
559
|
assertHardhatInvariant(
|
|
486
|
-
|
|
487
|
-
|
|
560
|
+
longVersionMap !== undefined,
|
|
561
|
+
`No long version map for compiler type ${compilerType}`,
|
|
562
|
+
);
|
|
563
|
+
|
|
564
|
+
const longVersion = longVersionMap.get(config.version);
|
|
565
|
+
|
|
566
|
+
assertHardhatInvariant(
|
|
567
|
+
longVersion !== undefined,
|
|
568
|
+
"longVersion should not be undefined",
|
|
488
569
|
);
|
|
489
570
|
|
|
490
571
|
const individualJob = new CompilationJobImplementation(
|
|
491
572
|
subgraph,
|
|
492
573
|
config,
|
|
493
|
-
|
|
574
|
+
longVersion,
|
|
494
575
|
this.#hooks,
|
|
495
576
|
sharedContentHashes,
|
|
577
|
+
toolVersions,
|
|
496
578
|
);
|
|
497
579
|
|
|
498
580
|
await individualJob.getBuildId(); // precompute
|
|
@@ -516,7 +598,15 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
516
598
|
for (const [rootFile, compilationJob] of indexedIndividualJobs.entries()) {
|
|
517
599
|
const jobHash = await compilationJob.getBuildId();
|
|
518
600
|
const cacheResult = this.#compileCache[rootFile];
|
|
519
|
-
const
|
|
601
|
+
const compilerType = compilationJob.solcConfig.type ?? "solc";
|
|
602
|
+
const isWasmMap = versionIsWasmPerCompilerType.get(compilerType);
|
|
603
|
+
|
|
604
|
+
assertHardhatInvariant(
|
|
605
|
+
isWasmMap !== undefined,
|
|
606
|
+
`No isWasm map for compiler type ${compilerType}`,
|
|
607
|
+
);
|
|
608
|
+
|
|
609
|
+
const isWasm = isWasmMap.get(compilationJob.solcConfig.version);
|
|
520
610
|
|
|
521
611
|
assertHardhatInvariant(
|
|
522
612
|
isWasm !== undefined,
|
|
@@ -529,12 +619,33 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
529
619
|
cacheResult === undefined ||
|
|
530
620
|
cacheResult.jobHash !== jobHash ||
|
|
531
621
|
cacheResult.isolated !== isolated ||
|
|
622
|
+
cacheResult.compilerType !== compilerType ||
|
|
532
623
|
cacheResult.wasm !== isWasm
|
|
533
624
|
) {
|
|
534
625
|
rootFilesToCompile.add(rootFile);
|
|
535
626
|
continue;
|
|
536
627
|
}
|
|
537
628
|
|
|
629
|
+
// Validate output layout: if the cached layout doesn't match the
|
|
630
|
+
// expected layout for the current config, treat it as a miss.
|
|
631
|
+
// Pre-existing cache entries without these fields are also treated
|
|
632
|
+
// as misses.
|
|
633
|
+
const expectedLayout = await this.#getExpectedOutputLayout(
|
|
634
|
+
rootFile,
|
|
635
|
+
options?.scope ?? "contracts",
|
|
636
|
+
);
|
|
637
|
+
|
|
638
|
+
if (
|
|
639
|
+
cacheResult.artifactsDirectory === undefined ||
|
|
640
|
+
cacheResult.emitsTypeDeclarations === undefined ||
|
|
641
|
+
cacheResult.artifactsDirectory !== expectedLayout.artifactsDirectory ||
|
|
642
|
+
cacheResult.emitsTypeDeclarations !==
|
|
643
|
+
expectedLayout.emitsTypeDeclarations
|
|
644
|
+
) {
|
|
645
|
+
rootFilesToCompile.add(rootFile);
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
|
|
538
649
|
// If any of the emitted files are not present anymore, compile it
|
|
539
650
|
const {
|
|
540
651
|
artifactPaths,
|
|
@@ -576,13 +687,15 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
576
687
|
log(`Merging compilation jobs`);
|
|
577
688
|
|
|
578
689
|
const mergedSubgraphsByConfig: Map<
|
|
579
|
-
|
|
690
|
+
SolidityCompilerConfig,
|
|
580
691
|
DependencyGraphImplementation
|
|
581
692
|
> = new Map();
|
|
582
693
|
|
|
583
|
-
// Note: This groups the subgraphs by
|
|
584
|
-
// based on reference, and not by deep equality.
|
|
585
|
-
//
|
|
694
|
+
// Note: This groups the subgraphs by compiler config. It compares the
|
|
695
|
+
// configs based on reference, and not by deep equality. This is
|
|
696
|
+
// inherently type-aware: two configs with different types will always be
|
|
697
|
+
// different references. It misses some merging opportunities, but this is
|
|
698
|
+
// Hardhat v2's behavior and works well enough.
|
|
586
699
|
for (const [config, subgraph] of subgraphsWithConfig) {
|
|
587
700
|
const rootFile = getSingleRootFilePath(subgraph);
|
|
588
701
|
|
|
@@ -613,20 +726,30 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
613
726
|
}
|
|
614
727
|
|
|
615
728
|
const compilationJobsPerFile = new Map<string, CompilationJob>();
|
|
616
|
-
for (const [
|
|
617
|
-
const
|
|
729
|
+
for (const [compilerConfig, subgraph] of subgraphsWithConfig) {
|
|
730
|
+
const compilerType = compilerConfig.type ?? "solc";
|
|
731
|
+
const longVersionMap =
|
|
732
|
+
solidityVersionToLongVersionPerCompilerType.get(compilerType);
|
|
618
733
|
|
|
619
734
|
assertHardhatInvariant(
|
|
620
|
-
|
|
621
|
-
|
|
735
|
+
longVersionMap !== undefined,
|
|
736
|
+
`No long version map for compiler type ${compilerType}`,
|
|
737
|
+
);
|
|
738
|
+
|
|
739
|
+
const longVersion = longVersionMap.get(compilerConfig.version);
|
|
740
|
+
|
|
741
|
+
assertHardhatInvariant(
|
|
742
|
+
longVersion !== undefined,
|
|
743
|
+
"longVersion should not be undefined",
|
|
622
744
|
);
|
|
623
745
|
|
|
624
746
|
const runnableCompilationJob = new CompilationJobImplementation(
|
|
625
747
|
subgraph,
|
|
626
|
-
|
|
627
|
-
|
|
748
|
+
compilerConfig,
|
|
749
|
+
longVersion,
|
|
628
750
|
this.#hooks,
|
|
629
751
|
sharedContentHashes,
|
|
752
|
+
toolVersions,
|
|
630
753
|
);
|
|
631
754
|
|
|
632
755
|
for (const [userSourceName, root] of subgraph.getRoots().entries()) {
|
|
@@ -677,19 +800,16 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
677
800
|
|
|
678
801
|
const { buildProfile } = this.#getBuildProfile(options?.buildProfile);
|
|
679
802
|
|
|
680
|
-
const compiler = await
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
),
|
|
687
|
-
compilerPath: runnableCompilationJob.solcConfig.path,
|
|
688
|
-
},
|
|
803
|
+
const compiler = await this.#hooks.runHandlerChain(
|
|
804
|
+
"solidity",
|
|
805
|
+
"getCompiler",
|
|
806
|
+
[runnableCompilationJob.solcConfig],
|
|
807
|
+
async (_context, cfg) =>
|
|
808
|
+
getSolcCompilerForConfig(cfg, buildProfile.preferWasm),
|
|
689
809
|
);
|
|
690
810
|
|
|
691
811
|
log(
|
|
692
|
-
`Compiling ${numberOfRootFiles} root files and ${numberOfFiles - numberOfRootFiles} dependency files with solc ${runnableCompilationJob.solcConfig.version} using ${compiler.compilerPath}`,
|
|
812
|
+
`Compiling ${numberOfRootFiles} root files and ${numberOfFiles - numberOfRootFiles} dependency files with ${runnableCompilationJob.solcConfig.type ?? "solc"} ${runnableCompilationJob.solcConfig.version} using ${compiler.compilerPath}`,
|
|
693
813
|
);
|
|
694
814
|
|
|
695
815
|
assertHardhatInvariant(
|
|
@@ -751,6 +871,10 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
751
871
|
): Promise<EmitArtifactsResult> {
|
|
752
872
|
const scope = options.scope ?? "contracts";
|
|
753
873
|
|
|
874
|
+
this.#ensureSplitCompilationModeIfTestsScope(scope);
|
|
875
|
+
|
|
876
|
+
const unified = !this.#options.solidityConfig.splitTestsCompilation;
|
|
877
|
+
|
|
754
878
|
const artifactsPerFile = new Map<string, string[]>();
|
|
755
879
|
const typeFilePaths = new Map<string, string>();
|
|
756
880
|
const buildId = await runnableCompilationJob.getBuildId();
|
|
@@ -801,8 +925,15 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
801
925
|
|
|
802
926
|
artifactsPerFile.set(formatRootPath(userSourceName, root), paths);
|
|
803
927
|
|
|
804
|
-
//
|
|
805
|
-
|
|
928
|
+
// In split mode, test roots are never part of a "contracts"-scoped pass,
|
|
929
|
+
// so the scope guard below is sufficient. In unified mode, both contract
|
|
930
|
+
// and test roots share the same pass, so we check individually.
|
|
931
|
+
const isTestRoot = unified
|
|
932
|
+
? (await this.getScope(root.fsPath)) === "tests"
|
|
933
|
+
: false;
|
|
934
|
+
|
|
935
|
+
// Write the type declaration file for contract roots only.
|
|
936
|
+
if (scope === "contracts" && !isTestRoot) {
|
|
806
937
|
const artifactsDeclarationFilePath = path.join(
|
|
807
938
|
fileFolder,
|
|
808
939
|
"artifacts.d.ts",
|
|
@@ -897,6 +1028,12 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
897
1028
|
}
|
|
898
1029
|
|
|
899
1030
|
public async getArtifactsDirectory(scope: BuildScope): Promise<string> {
|
|
1031
|
+
// In unified mode, both scopes point to the main artifacts directory
|
|
1032
|
+
// because contract and test artifacts live together.
|
|
1033
|
+
if (!this.#options.solidityConfig.splitTestsCompilation) {
|
|
1034
|
+
return this.#options.artifactsPath;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
900
1037
|
return scope === "contracts"
|
|
901
1038
|
? this.#options.artifactsPath
|
|
902
1039
|
: path.join(this.#options.cachePath, "test-artifacts");
|
|
@@ -906,9 +1043,11 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
906
1043
|
rootFilePaths: string[],
|
|
907
1044
|
options: { scope?: BuildScope } = {},
|
|
908
1045
|
): Promise<void> {
|
|
909
|
-
log(`Cleaning up artifacts`);
|
|
910
|
-
|
|
911
1046
|
const scope = options.scope ?? "contracts";
|
|
1047
|
+
|
|
1048
|
+
this.#ensureSplitCompilationModeIfTestsScope(scope);
|
|
1049
|
+
|
|
1050
|
+
log(`Cleaning up artifacts`);
|
|
912
1051
|
const artifactsDirectory = await this.getArtifactsDirectory(scope);
|
|
913
1052
|
|
|
914
1053
|
const userSourceNames = rootFilePaths.map((rootFilePath) => {
|
|
@@ -960,7 +1099,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
960
1099
|
|
|
961
1100
|
// Get all the reachable build info files
|
|
962
1101
|
const buildInfoFiles = await getAllFilesMatching(buildInfosDir, (f) =>
|
|
963
|
-
f.startsWith(buildInfosDir),
|
|
1102
|
+
f.startsWith(buildInfosDir + path.sep),
|
|
964
1103
|
);
|
|
965
1104
|
|
|
966
1105
|
for (const buildInfoFile of buildInfoFiles) {
|
|
@@ -1016,8 +1155,10 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1016
1155
|
): Promise<CompilerOutput> {
|
|
1017
1156
|
const quiet = options?.quiet ?? false;
|
|
1018
1157
|
|
|
1019
|
-
//
|
|
1020
|
-
//
|
|
1158
|
+
// Build info recompilation is always solc-only: build info files are
|
|
1159
|
+
// produced by solc and must be recompiled with the same solc version.
|
|
1160
|
+
// We bypass both downloadCompilers and getCompiler hooks — this is a
|
|
1161
|
+
// self-contained solc replay path, not plugin-configurable compilation.
|
|
1021
1162
|
await downloadSolcCompilers(new Set([buildInfo.solcVersion]), quiet);
|
|
1022
1163
|
|
|
1023
1164
|
const compiler = await getCompiler(buildInfo.solcVersion, {
|
|
@@ -1034,20 +1175,17 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1034
1175
|
return;
|
|
1035
1176
|
}
|
|
1036
1177
|
|
|
1037
|
-
|
|
1178
|
+
const allSolidityCompilerConfigs = this.#getAllSolidityCompilerConfigs();
|
|
1179
|
+
await this.#hooks.runParallelHandlers("solidity", "downloadCompilers", [
|
|
1180
|
+
allSolidityCompilerConfigs,
|
|
1181
|
+
quiet,
|
|
1182
|
+
]);
|
|
1038
1183
|
this.#configuredCompilersDownloaded = true;
|
|
1039
1184
|
}
|
|
1040
1185
|
|
|
1041
|
-
#
|
|
1042
|
-
return
|
|
1043
|
-
Object.values(
|
|
1044
|
-
.map((profile) => [
|
|
1045
|
-
...profile.compilers.map((compiler) => compiler.version),
|
|
1046
|
-
...Object.values(profile.overrides).map(
|
|
1047
|
-
(override) => override.version,
|
|
1048
|
-
),
|
|
1049
|
-
])
|
|
1050
|
-
.flat(1),
|
|
1186
|
+
#getAllSolidityCompilerConfigs(): SolidityCompilerConfig[] {
|
|
1187
|
+
return Object.values(this.#options.solidityConfig.profiles).flatMap(
|
|
1188
|
+
(profile) => [...profile.compilers, ...Object.values(profile.overrides)],
|
|
1051
1189
|
);
|
|
1052
1190
|
}
|
|
1053
1191
|
|
|
@@ -1085,6 +1223,34 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1085
1223
|
return `${error.type}: ${error.message}`.replace(/[:\s]*$/g, "").trim();
|
|
1086
1224
|
}
|
|
1087
1225
|
|
|
1226
|
+
async #getExpectedOutputLayout(
|
|
1227
|
+
rootFilePath: string,
|
|
1228
|
+
scope: BuildScope,
|
|
1229
|
+
): Promise<{ artifactsDirectory: string; emitsTypeDeclarations: boolean }> {
|
|
1230
|
+
const artifactsDirectory = await this.getArtifactsDirectory(scope);
|
|
1231
|
+
|
|
1232
|
+
const unified = !this.#options.solidityConfig.splitTestsCompilation;
|
|
1233
|
+
|
|
1234
|
+
// In unified mode, test roots under contracts scope don't emit type
|
|
1235
|
+
// declarations. In split mode, the scope alone determines this.
|
|
1236
|
+
let emitsTypeDeclarations: boolean;
|
|
1237
|
+
if (scope === "contracts") {
|
|
1238
|
+
if (unified) {
|
|
1239
|
+
const parsed = parseRootPath(rootFilePath);
|
|
1240
|
+
const isTestRoot = isNpmParsedRootPath(parsed)
|
|
1241
|
+
? false
|
|
1242
|
+
: (await this.getScope(parsed.fsPath)) === "tests";
|
|
1243
|
+
emitsTypeDeclarations = !isTestRoot;
|
|
1244
|
+
} else {
|
|
1245
|
+
emitsTypeDeclarations = true;
|
|
1246
|
+
}
|
|
1247
|
+
} else {
|
|
1248
|
+
emitsTypeDeclarations = false;
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
return { artifactsDirectory, emitsTypeDeclarations };
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1088
1254
|
async #cacheCompilationResult(
|
|
1089
1255
|
indexedIndividualJobs: Map<string, CompilationJob>,
|
|
1090
1256
|
result: CompilationResult,
|
|
@@ -1113,22 +1279,24 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1113
1279
|
|
|
1114
1280
|
const typeFilePath = emitArtifactsResult.typeFilePaths.get(rootFilePath);
|
|
1115
1281
|
|
|
1116
|
-
// Type declaration file is not generated for solidity tests
|
|
1117
|
-
assertHardhatInvariant(
|
|
1118
|
-
scope === "tests" || typeFilePath !== undefined,
|
|
1119
|
-
`No type file found on map for contract ${rootFilePath}`,
|
|
1120
|
-
);
|
|
1121
|
-
|
|
1122
1282
|
const jobHash = await individualJob.getBuildId();
|
|
1123
1283
|
|
|
1284
|
+
const expectedLayout = await this.#getExpectedOutputLayout(
|
|
1285
|
+
rootFilePath,
|
|
1286
|
+
scope,
|
|
1287
|
+
);
|
|
1288
|
+
|
|
1124
1289
|
this.#compileCache[rootFilePath] = {
|
|
1125
1290
|
jobHash,
|
|
1126
1291
|
isolated,
|
|
1292
|
+
compilerType: individualJob.solcConfig.type ?? "solc",
|
|
1127
1293
|
artifactPaths,
|
|
1128
1294
|
buildInfoPath: emitArtifactsResult.buildInfoPath,
|
|
1129
1295
|
buildInfoOutputPath: emitArtifactsResult.buildInfoOutputPath,
|
|
1130
1296
|
typeFilePath,
|
|
1131
1297
|
wasm: result.compiler.isSolcJs,
|
|
1298
|
+
artifactsDirectory: expectedLayout.artifactsDirectory,
|
|
1299
|
+
emitsTypeDeclarations: expectedLayout.emitsTypeDeclarations,
|
|
1132
1300
|
};
|
|
1133
1301
|
}
|
|
1134
1302
|
}
|
|
@@ -1208,16 +1376,21 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1208
1376
|
}
|
|
1209
1377
|
|
|
1210
1378
|
for (const job of runnableCompilationJobs) {
|
|
1379
|
+
const compilerType = job.solcConfig.type ?? "solc";
|
|
1211
1380
|
const solcVersion = job.solcConfig.version;
|
|
1212
1381
|
const solcInput = await job.getSolcInput();
|
|
1213
1382
|
const evmVersion =
|
|
1214
1383
|
solcInput.settings.evmVersion ??
|
|
1215
1384
|
`Check solc ${solcVersion}'s doc for its default evm version`;
|
|
1216
1385
|
|
|
1217
|
-
|
|
1386
|
+
// Group by compiler type + Solidity version to produce separate log
|
|
1387
|
+
// lines for e.g. "solc 0.8.33" vs "solx 0.1.3 (Solidity 0.8.33)".
|
|
1388
|
+
const groupKey = `${compilerType}#${solcVersion}`;
|
|
1389
|
+
|
|
1390
|
+
let jobsPerVersion = jobsPerVersionAndEvmVersion.get(groupKey);
|
|
1218
1391
|
if (jobsPerVersion === undefined) {
|
|
1219
1392
|
jobsPerVersion = new Map();
|
|
1220
|
-
jobsPerVersionAndEvmVersion.set(
|
|
1393
|
+
jobsPerVersionAndEvmVersion.set(groupKey, jobsPerVersion);
|
|
1221
1394
|
}
|
|
1222
1395
|
|
|
1223
1396
|
let jobsPerEvmVersion = jobsPerVersion.get(evmVersion);
|
|
@@ -1229,10 +1402,11 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1229
1402
|
jobsPerEvmVersion.push(job);
|
|
1230
1403
|
}
|
|
1231
1404
|
|
|
1232
|
-
for (const
|
|
1405
|
+
for (const groupKey of [...jobsPerVersionAndEvmVersion.keys()].sort()) {
|
|
1233
1406
|
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion --
|
|
1234
1407
|
This is a valid key, just sorted */
|
|
1235
|
-
const jobsPerEvmVersion = jobsPerVersionAndEvmVersion.get(
|
|
1408
|
+
const jobsPerEvmVersion = jobsPerVersionAndEvmVersion.get(groupKey)!;
|
|
1409
|
+
const [compilerType, solidityVersion] = groupKey.split("#");
|
|
1236
1410
|
|
|
1237
1411
|
for (const evmVersion of [...jobsPerEvmVersion.keys()].sort()) {
|
|
1238
1412
|
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion --
|
|
@@ -1244,18 +1418,42 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
|
|
|
1244
1418
|
0,
|
|
1245
1419
|
);
|
|
1246
1420
|
|
|
1421
|
+
// For solc, the compiler version is the Solidity version.
|
|
1422
|
+
// For other compilers, extract the compiler's own version from the
|
|
1423
|
+
// longVersion stored on the compilation job, and show the Solidity
|
|
1424
|
+
// version separately.
|
|
1425
|
+
let compilerLabel: string;
|
|
1426
|
+
if (compilerType === "solc") {
|
|
1427
|
+
compilerLabel = `solc ${solidityVersion}`;
|
|
1428
|
+
} else {
|
|
1429
|
+
const longVersion = jobs[0].solcLongVersion;
|
|
1430
|
+
const compilerVersion = longVersion.split("+")[0];
|
|
1431
|
+
compilerLabel = `${compilerType} ${compilerVersion} (Solidity ${solidityVersion})`;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1247
1434
|
console.log(
|
|
1248
1435
|
chalk.bold(
|
|
1249
1436
|
`Compiled ${rootFiles} Solidity ${pluralize(
|
|
1250
1437
|
options.scope === "contracts" ? "file" : "test file",
|
|
1251
1438
|
rootFiles,
|
|
1252
|
-
)} with
|
|
1439
|
+
)} with ${compilerLabel}`,
|
|
1253
1440
|
),
|
|
1254
1441
|
`(evm target: ${evmVersion})`,
|
|
1255
1442
|
);
|
|
1256
1443
|
}
|
|
1257
1444
|
}
|
|
1258
1445
|
}
|
|
1446
|
+
|
|
1447
|
+
#ensureSplitCompilationModeIfTestsScope(scope: BuildScope = "contracts") {
|
|
1448
|
+
if (
|
|
1449
|
+
scope === "tests" &&
|
|
1450
|
+
!this.#options.solidityConfig.splitTestsCompilation
|
|
1451
|
+
) {
|
|
1452
|
+
throw new HardhatError(
|
|
1453
|
+
HardhatError.ERRORS.CORE.SOLIDITY.SPLIT_TESTS_COMPILATION_DISABLED,
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1259
1457
|
}
|
|
1260
1458
|
|
|
1261
1459
|
function toForwardSlash(str: string): string {
|