hardhat 3.3.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 +54 -0
- 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/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/hook-handlers/hre.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/hre.js +22 -0
- 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 +17 -9
- package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js.map +1 -1
- package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts +11 -1
- 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 +86 -19
- 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 +22 -8
- 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/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/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 +3 -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 +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +114 -31
- 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 +2 -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 -1
- 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 +11 -3
- package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job.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-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.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.js +19 -16
- 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/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 +30 -4
- 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/helpers.d.ts +0 -2
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +0 -3
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.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.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +108 -32
- 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/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/test/task-action.js +3 -4
- package/dist/src/internal/builtin-plugins/test/task-action.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/types/artifacts.d.ts +5 -4
- package/dist/src/types/artifacts.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 +6 -0
- package/dist/src/types/solidity/compilation-job.d.ts.map +1 -1
- package/dist/src/types/solidity/solidity-artifacts.d.ts +14 -0
- package/dist/src/types/solidity/solidity-artifacts.d.ts.map +1 -1
- package/package.json +8 -8
- 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/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/hook-handlers/hre.ts +29 -0
- package/src/internal/builtin-plugins/network-manager/hook-handlers/network.ts +20 -14
- package/src/internal/builtin-plugins/network-manager/network-manager.ts +130 -27
- 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 +30 -13
- 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/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/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 +3 -0
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +156 -34
- package/src/internal/builtin-plugins/solidity/build-system/cache.ts +2 -0
- package/src/internal/builtin-plugins/solidity/build-system/compilation-job.ts +15 -9
- package/src/internal/builtin-plugins/solidity/build-system/dependency-graph.ts +9 -7
- 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 +23 -13
- package/src/internal/builtin-plugins/solidity/constants.ts +21 -0
- package/src/internal/builtin-plugins/solidity/tasks/build.ts +359 -74
- package/src/internal/builtin-plugins/solidity/type-extensions.ts +38 -8
- package/src/internal/builtin-plugins/solidity-test/config.ts +11 -2
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +0 -7
- 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 +161 -43
- package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -2
- package/src/internal/builtin-plugins/test/task-action.ts +3 -4
- package/src/internal/cli/main.ts +14 -0
- package/src/types/artifacts.ts +5 -4
- package/src/types/network.ts +48 -0
- package/src/types/solidity/build-system.ts +66 -3
- package/src/types/solidity/compilation-job.ts +7 -0
- package/src/types/solidity/solidity-artifacts.ts +16 -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 -14
- 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 -55
- package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js.map +0 -1
- package/src/internal/builtin-plugins/gas-analytics/helpers.ts +0 -96
|
@@ -17,13 +17,6 @@ import { getGlobalEdrContext } from "../../edr/context.js";
|
|
|
17
17
|
|
|
18
18
|
import { formatArtifactId } from "./formatters.js";
|
|
19
19
|
|
|
20
|
-
export interface RunOptions {
|
|
21
|
-
/**
|
|
22
|
-
* The maximum time in milliseconds to wait for all the test suites to finish.
|
|
23
|
-
*/
|
|
24
|
-
timeout?: number;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
20
|
/**
|
|
28
21
|
* Run all the given solidity tests and returns the stream of results.
|
|
29
22
|
*
|
|
@@ -38,7 +31,7 @@ export interface RunOptions {
|
|
|
38
31
|
* Despite the changes, the signature of the function should still be considered
|
|
39
32
|
* a draft that may change in the future.
|
|
40
33
|
*
|
|
41
|
-
* TODO:
|
|
34
|
+
* Important TODO: Transform this into an AsyncGenerator<SuiteResult, SolidityTestResult, void>
|
|
42
35
|
*/
|
|
43
36
|
export function run(
|
|
44
37
|
chainType: ChainType,
|
|
@@ -47,88 +40,76 @@ export function run(
|
|
|
47
40
|
testRunnerConfig: SolidityTestRunnerConfigArgs,
|
|
48
41
|
tracingConfig: TracingConfigWithBuffers,
|
|
49
42
|
sourceNameToUserSourceName: Map<string, string>,
|
|
50
|
-
options?: RunOptions,
|
|
51
43
|
): TestsStream {
|
|
52
|
-
const stream = new
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
let runCompleted = false;
|
|
44
|
+
const stream = new Readable({
|
|
45
|
+
objectMode: true,
|
|
46
|
+
read() {},
|
|
47
|
+
});
|
|
59
48
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
);
|
|
49
|
+
if (testSuiteIds.length === 0) {
|
|
50
|
+
stream.push(null);
|
|
51
|
+
return stream;
|
|
52
|
+
}
|
|
65
53
|
|
|
66
|
-
|
|
67
|
-
if (options?.timeout !== undefined) {
|
|
68
|
-
timeout = setTimeout(() => {
|
|
69
|
-
controller.error(
|
|
70
|
-
new HardhatError(
|
|
71
|
-
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.RUNNER_TIMEOUT,
|
|
72
|
-
{
|
|
73
|
-
duration: options.timeout,
|
|
74
|
-
suites: Array.from(remainingSuites).join(", "),
|
|
75
|
-
},
|
|
76
|
-
),
|
|
77
|
-
);
|
|
78
|
-
}, options.timeout);
|
|
79
|
-
}
|
|
54
|
+
let runCompleted = false;
|
|
80
55
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const solidityTestResult = await edrContext.runSolidityTests(
|
|
85
|
-
hardhatChainTypeToEdrChainType(chainType),
|
|
86
|
-
artifacts,
|
|
87
|
-
testSuiteIds,
|
|
88
|
-
testRunnerConfig,
|
|
89
|
-
tracingConfig,
|
|
90
|
-
(suiteResult) => {
|
|
91
|
-
controller.enqueue({
|
|
92
|
-
type: "suite:done",
|
|
93
|
-
data: suiteResult,
|
|
94
|
-
});
|
|
95
|
-
remainingSuites.delete(
|
|
96
|
-
formatArtifactId(suiteResult.id, sourceNameToUserSourceName),
|
|
97
|
-
);
|
|
98
|
-
if (remainingSuites.size === 0) {
|
|
99
|
-
clearTimeout(timeout);
|
|
56
|
+
const remainingSuites = new Set(
|
|
57
|
+
testSuiteIds.map((id) => formatArtifactId(id, sourceNameToUserSourceName)),
|
|
58
|
+
);
|
|
100
59
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
60
|
+
// Start the async work immediately. The read() callback is a no-op
|
|
61
|
+
// because we push data proactively from the EDR suite-completion
|
|
62
|
+
// callback. Using a native Readable (instead of a web ReadableStream
|
|
63
|
+
// wrapped with Readable.from) avoids a race where Node.js stream
|
|
64
|
+
// cleanup cancels the web reader while the async start callback still
|
|
65
|
+
// has pending work — push() on a destroyed Readable is a safe no-op.
|
|
66
|
+
// TODO: Add support for predeploys once EDR supports them.
|
|
67
|
+
void (async () => {
|
|
68
|
+
try {
|
|
69
|
+
const edrContext = await getGlobalEdrContext();
|
|
70
|
+
const solidityTestResult = await edrContext.runSolidityTests(
|
|
71
|
+
hardhatChainTypeToEdrChainType(chainType),
|
|
72
|
+
artifacts,
|
|
73
|
+
testSuiteIds,
|
|
74
|
+
testRunnerConfig,
|
|
75
|
+
tracingConfig,
|
|
76
|
+
(suiteResult) => {
|
|
77
|
+
stream.push({
|
|
78
|
+
type: "suite:done",
|
|
79
|
+
data: suiteResult,
|
|
80
|
+
} satisfies TestEvent);
|
|
81
|
+
remainingSuites.delete(
|
|
82
|
+
formatArtifactId(suiteResult.id, sourceNameToUserSourceName),
|
|
83
|
+
);
|
|
84
|
+
if (remainingSuites.size === 0) {
|
|
85
|
+
if (runCompleted) {
|
|
86
|
+
stream.push(null);
|
|
104
87
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (remainingSuites.size === 0) {
|
|
114
|
-
controller.close();
|
|
115
|
-
}
|
|
116
|
-
} catch (error) {
|
|
117
|
-
ensureError(error);
|
|
118
|
-
|
|
119
|
-
clearTimeout(timeout);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
stream.push({
|
|
92
|
+
type: "run:done",
|
|
93
|
+
data: solidityTestResult,
|
|
94
|
+
} satisfies TestEvent);
|
|
95
|
+
runCompleted = true;
|
|
120
96
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.UNHANDLED_EDR_ERROR_SOLIDITY_TESTS,
|
|
124
|
-
{
|
|
125
|
-
error: error.message,
|
|
126
|
-
},
|
|
127
|
-
),
|
|
128
|
-
);
|
|
97
|
+
if (remainingSuites.size === 0) {
|
|
98
|
+
stream.push(null);
|
|
129
99
|
}
|
|
130
|
-
}
|
|
131
|
-
|
|
100
|
+
} catch (error) {
|
|
101
|
+
ensureError(error);
|
|
102
|
+
|
|
103
|
+
stream.destroy(
|
|
104
|
+
new HardhatError(
|
|
105
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.UNHANDLED_EDR_ERROR_SOLIDITY_TESTS,
|
|
106
|
+
{
|
|
107
|
+
error: error.message,
|
|
108
|
+
},
|
|
109
|
+
),
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
})();
|
|
132
113
|
|
|
133
|
-
return
|
|
114
|
+
return stream;
|
|
134
115
|
}
|
|
@@ -2,7 +2,10 @@ import type { SolidityStackTraceEntry } from "../network-manager/edr/stack-trace
|
|
|
2
2
|
|
|
3
3
|
import { panicErrorCodeToMessage } from "@nomicfoundation/hardhat-utils/panic-errors";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
StackTraceEntryType,
|
|
7
|
+
CheatcodeErrorCode,
|
|
8
|
+
} from "../network-manager/edr/stack-traces/solidity-stack-trace.js";
|
|
6
9
|
|
|
7
10
|
export function getMessageFromLastStackTraceEntry(
|
|
8
11
|
stackTraceEntry: SolidityStackTraceEntry,
|
|
@@ -64,8 +67,18 @@ export function getMessageFromLastStackTraceEntry(
|
|
|
64
67
|
case StackTraceEntryType.CUSTOM_ERROR:
|
|
65
68
|
return stackTraceEntry.message;
|
|
66
69
|
|
|
67
|
-
case StackTraceEntryType.CHEATCODE_ERROR:
|
|
70
|
+
case StackTraceEntryType.CHEATCODE_ERROR: {
|
|
71
|
+
if (stackTraceEntry.details !== undefined) {
|
|
72
|
+
switch (stackTraceEntry.details.code) {
|
|
73
|
+
case CheatcodeErrorCode.UnsupportedCheatcode:
|
|
74
|
+
return `Cheatcode '${stackTraceEntry.details.cheatcode}' is not supported by Hardhat.`;
|
|
75
|
+
case CheatcodeErrorCode.MissingCheatcode:
|
|
76
|
+
return `Cheatcode '${stackTraceEntry.details.cheatcode}' is not yet available in this version of Hardhat.`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
68
80
|
return stackTraceEntry.message;
|
|
81
|
+
}
|
|
69
82
|
|
|
70
83
|
case StackTraceEntryType.CONTRACT_TOO_LARGE_ERROR:
|
|
71
84
|
return "Trying to deploy a contract whose code is too large";
|
|
@@ -3,6 +3,10 @@ import type {
|
|
|
3
3
|
EdrArtifactWithMetadata,
|
|
4
4
|
} from "./edr-artifacts.js";
|
|
5
5
|
import type { TestEvent } from "./types.js";
|
|
6
|
+
import type {
|
|
7
|
+
BuildScope,
|
|
8
|
+
SolidityBuildSystem,
|
|
9
|
+
} from "../../../types/solidity.js";
|
|
6
10
|
import type { NewTaskActionFunction } from "../../../types/tasks.js";
|
|
7
11
|
import type { TestRunResult } from "../../../types/test.js";
|
|
8
12
|
import type { Result } from "../../../types/utils.js";
|
|
@@ -15,6 +19,7 @@ import type {
|
|
|
15
19
|
import { finished } from "node:stream/promises";
|
|
16
20
|
|
|
17
21
|
import { HardhatError } from "@nomicfoundation/hardhat-errors";
|
|
22
|
+
import { exists } from "@nomicfoundation/hardhat-utils/fs";
|
|
18
23
|
import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
|
|
19
24
|
import { createNonClosingWriter } from "@nomicfoundation/hardhat-utils/stream";
|
|
20
25
|
|
|
@@ -23,7 +28,7 @@ import { errorResult, successfulResult } from "../../../utils/result.js";
|
|
|
23
28
|
import { isSupportedChainType } from "../../edr/chain-type.js";
|
|
24
29
|
import { ArtifactManagerImplementation } from "../artifacts/artifact-manager.js";
|
|
25
30
|
import { getCoverageManager } from "../coverage/helpers.js";
|
|
26
|
-
import { getGasAnalyticsManager } from "../gas-analytics/helpers.js";
|
|
31
|
+
import { getGasAnalyticsManager } from "../gas-analytics/helpers/accessors.js";
|
|
27
32
|
import { edrGasReportToHardhatGasMeasurements } from "../network-manager/edr/utils/convert-to-edr.js";
|
|
28
33
|
|
|
29
34
|
import {
|
|
@@ -33,7 +38,6 @@ import {
|
|
|
33
38
|
import {
|
|
34
39
|
isTestSuiteArtifact,
|
|
35
40
|
warnDeprecatedTestFail,
|
|
36
|
-
solidityTestConfigToRunOptions,
|
|
37
41
|
solidityTestConfigToSolidityTestRunnerConfigArgs,
|
|
38
42
|
} from "./helpers.js";
|
|
39
43
|
import { getTestFunctionOverrides } from "./inline-config/index.js";
|
|
@@ -61,6 +65,18 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
61
65
|
|
|
62
66
|
const verbosity = hre.globalOptions.verbosity;
|
|
63
67
|
|
|
68
|
+
// NOTE: The resolution from CWD mimics what `build` does. It's important for
|
|
69
|
+
// both tasks to be aligned.
|
|
70
|
+
const resolvedTestFilesArgument = testFiles.map((f) =>
|
|
71
|
+
resolveFromRoot(process.cwd(), f),
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
await validateThatProvidedFilesAreTests(
|
|
75
|
+
hre.solidity,
|
|
76
|
+
testFiles,
|
|
77
|
+
resolvedTestFilesArgument,
|
|
78
|
+
);
|
|
79
|
+
|
|
64
80
|
// Sets the NODE_ENV environment variable to "test" so the code can detect that tests are running
|
|
65
81
|
// This is done by other JS/TS test frameworks like vitest
|
|
66
82
|
process.env.NODE_ENV ??= "test";
|
|
@@ -76,34 +92,79 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
76
92
|
);
|
|
77
93
|
}
|
|
78
94
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
noTests: true,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
95
|
+
let testRootPathsToRun: string[];
|
|
96
|
+
let edrArtifactsWithMetadata: EdrArtifactWithMetadata[];
|
|
97
|
+
let allBuildInfosAndOutputs: BuildInfoAndOutput[];
|
|
85
98
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
93
|
-
console.log();
|
|
99
|
+
if (hre.config.solidity.splitTestsCompilation) {
|
|
100
|
+
if (noCompile !== true) {
|
|
101
|
+
await hre.tasks.getTask("build").run({
|
|
102
|
+
noTests: true,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
94
105
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
)
|
|
106
|
+
({ testRootPaths: testRootPathsToRun } = await hre.tasks
|
|
107
|
+
.getTask("build")
|
|
108
|
+
.run({
|
|
109
|
+
files: testFiles,
|
|
110
|
+
noContracts: true,
|
|
111
|
+
}));
|
|
112
|
+
console.log();
|
|
113
|
+
|
|
114
|
+
({ edrArtifactsWithMetadata, allBuildInfosAndOutputs } =
|
|
115
|
+
await loadArtifacts(hre.solidity, ["contracts", "tests"]));
|
|
116
|
+
} else {
|
|
117
|
+
if (noCompile !== true) {
|
|
118
|
+
({ testRootPaths: testRootPathsToRun } = await hre.tasks
|
|
119
|
+
.getTask("build")
|
|
120
|
+
.run({
|
|
121
|
+
files: testFiles,
|
|
122
|
+
}));
|
|
123
|
+
} else {
|
|
124
|
+
if (resolvedTestFilesArgument.length > 0) {
|
|
125
|
+
testRootPathsToRun = resolvedTestFilesArgument;
|
|
126
|
+
} else {
|
|
127
|
+
testRootPathsToRun = [];
|
|
128
|
+
const allRoots = await hre.solidity.getRootFilePaths({
|
|
129
|
+
scope: "contracts",
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
for (const root of allRoots) {
|
|
133
|
+
if ((await hre.solidity.getScope(root)) === "tests") {
|
|
134
|
+
testRootPathsToRun.push(root);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
console.log();
|
|
140
|
+
|
|
141
|
+
({ edrArtifactsWithMetadata, allBuildInfosAndOutputs } =
|
|
142
|
+
await loadArtifacts(hre.solidity, ["contracts"]));
|
|
143
|
+
|
|
144
|
+
// When noCompile, validate selected test roots have compiled artifacts
|
|
145
|
+
if (noCompile === true) {
|
|
146
|
+
const compiledSources = new Set(
|
|
147
|
+
edrArtifactsWithMetadata.map(({ userSourceName }) =>
|
|
148
|
+
resolveFromRoot(hre.config.paths.root, userSourceName),
|
|
149
|
+
),
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const notCompiledFiles: string[] = [];
|
|
153
|
+
for (const root of testRootPathsToRun) {
|
|
154
|
+
if (!compiledSources.has(root)) {
|
|
155
|
+
notCompiledFiles.push(root);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (notCompiledFiles.length > 0) {
|
|
160
|
+
throw new HardhatError(
|
|
161
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.SELECTED_TEST_FILES_NOT_COMPILED,
|
|
162
|
+
{
|
|
163
|
+
files: notCompiledFiles.map((f) => `- ${f}`).join("\n"),
|
|
164
|
+
},
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
107
168
|
}
|
|
108
169
|
|
|
109
170
|
const sourceNameToUserSourceName = new Map(
|
|
@@ -113,25 +174,19 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
113
174
|
]),
|
|
114
175
|
);
|
|
115
176
|
|
|
116
|
-
|
|
117
|
-
if (
|
|
118
|
-
testRootPaths.includes(
|
|
119
|
-
resolveFromRoot(hre.config.paths.root, userSourceName),
|
|
120
|
-
) &&
|
|
121
|
-
isTestSuiteArtifact(edrArtifact)
|
|
122
|
-
) {
|
|
123
|
-
warnDeprecatedTestFail(edrArtifact, sourceNameToUserSourceName);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
|
|
177
|
+
const testRootPathsSet = new Set(testRootPathsToRun);
|
|
127
178
|
const testSuiteArtifacts = edrArtifactsWithMetadata
|
|
128
179
|
.filter(({ userSourceName }) =>
|
|
129
|
-
|
|
180
|
+
testRootPathsSet.has(
|
|
130
181
|
resolveFromRoot(hre.config.paths.root, userSourceName),
|
|
131
182
|
),
|
|
132
183
|
)
|
|
133
184
|
.filter(({ edrArtifact }) => isTestSuiteArtifact(edrArtifact));
|
|
134
185
|
|
|
186
|
+
for (const { edrArtifact } of testSuiteArtifacts) {
|
|
187
|
+
warnDeprecatedTestFail(edrArtifact, sourceNameToUserSourceName);
|
|
188
|
+
}
|
|
189
|
+
|
|
135
190
|
const testSuiteIds = testSuiteArtifacts.map(
|
|
136
191
|
({ edrArtifact }) => edrArtifact.id,
|
|
137
192
|
);
|
|
@@ -195,8 +250,6 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
195
250
|
})),
|
|
196
251
|
ignoreContracts: false,
|
|
197
252
|
};
|
|
198
|
-
const runOptions = solidityTestConfigToRunOptions(solidityTestConfig);
|
|
199
|
-
|
|
200
253
|
await hre.hooks.runHandlerChain(
|
|
201
254
|
"test",
|
|
202
255
|
"onTestRunStart",
|
|
@@ -211,7 +264,6 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
211
264
|
testRunnerConfig,
|
|
212
265
|
tracingConfig,
|
|
213
266
|
sourceNameToUserSourceName,
|
|
214
|
-
runOptions,
|
|
215
267
|
);
|
|
216
268
|
|
|
217
269
|
let failed = 0;
|
|
@@ -314,4 +366,70 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
314
366
|
: successfulResult(result);
|
|
315
367
|
};
|
|
316
368
|
|
|
369
|
+
/**
|
|
370
|
+
* Validates that the test files provided by the user, resolved in this case,
|
|
371
|
+
* are actually test files.
|
|
372
|
+
*
|
|
373
|
+
* @param solidity The solidity build system
|
|
374
|
+
* @param testFiles The test files, as provided by the user
|
|
375
|
+
* @param resolvedTestFilesArgument The resolved testFiles
|
|
376
|
+
*/
|
|
377
|
+
async function validateThatProvidedFilesAreTests(
|
|
378
|
+
solidity: SolidityBuildSystem,
|
|
379
|
+
testFiles: string[],
|
|
380
|
+
resolvedTestFilesArgument: string[],
|
|
381
|
+
) {
|
|
382
|
+
const existsResults = await Promise.all(
|
|
383
|
+
resolvedTestFilesArgument.map((rootPath) => exists(rootPath)),
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
const missing: string[] = testFiles.filter((_, i) => !existsResults[i]);
|
|
387
|
+
|
|
388
|
+
if (missing.length > 0) {
|
|
389
|
+
throw new HardhatError(
|
|
390
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.SELECTED_TEST_FILES_DO_NOT_EXIST,
|
|
391
|
+
{
|
|
392
|
+
files: missing.map((f) => `- ${f}`).join("\n"),
|
|
393
|
+
},
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const scopes = await Promise.all(
|
|
398
|
+
resolvedTestFilesArgument.map((rootPath) => solidity.getScope(rootPath)),
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
const nonTests: string[] = testFiles.filter((_, i) => scopes[i] !== "tests");
|
|
402
|
+
|
|
403
|
+
if (nonTests.length > 0) {
|
|
404
|
+
throw new HardhatError(
|
|
405
|
+
HardhatError.ERRORS.CORE.SOLIDITY_TESTS.SELECTED_FILES_ARE_NOT_SOLIDITY_TESTS,
|
|
406
|
+
{
|
|
407
|
+
files: nonTests.map((f) => `- ${f}`).join("\n"),
|
|
408
|
+
},
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
async function loadArtifacts(
|
|
414
|
+
solidity: SolidityBuildSystem,
|
|
415
|
+
scopes: BuildScope[],
|
|
416
|
+
): Promise<{
|
|
417
|
+
edrArtifactsWithMetadata: EdrArtifactWithMetadata[];
|
|
418
|
+
allBuildInfosAndOutputs: BuildInfoAndOutput[];
|
|
419
|
+
}> {
|
|
420
|
+
const edrArtifactsWithMetadata: EdrArtifactWithMetadata[] = [];
|
|
421
|
+
const allBuildInfosAndOutputs: BuildInfoAndOutput[] = [];
|
|
422
|
+
for (const scope of scopes) {
|
|
423
|
+
const artifactsDir = await solidity.getArtifactsDirectory(scope);
|
|
424
|
+
const artifactManager = new ArtifactManagerImplementation(artifactsDir);
|
|
425
|
+
edrArtifactsWithMetadata.push(
|
|
426
|
+
...(await buildEdrArtifactsWithMetadata(artifactManager)),
|
|
427
|
+
);
|
|
428
|
+
allBuildInfosAndOutputs.push(
|
|
429
|
+
...(await getBuildInfosAndOutputs(artifactManager)),
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
return { edrArtifactsWithMetadata, allBuildInfosAndOutputs };
|
|
433
|
+
}
|
|
434
|
+
|
|
317
435
|
export default runSolidityTests;
|
|
@@ -31,7 +31,6 @@ declare module "../../../types/test.js" {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export interface SolidityTestConfigBase {
|
|
34
|
-
timeout?: number;
|
|
35
34
|
fsPermissions?: {
|
|
36
35
|
readWriteFile?: string[];
|
|
37
36
|
readFile?: string[];
|
|
@@ -69,7 +68,7 @@ declare module "../../../types/test.js" {
|
|
|
69
68
|
|
|
70
69
|
export interface SolidityTestForkingUserConfig {
|
|
71
70
|
url?: SensitiveString;
|
|
72
|
-
blockNumber?: bigint;
|
|
71
|
+
blockNumber?: number | bigint;
|
|
73
72
|
rpcEndpoints?: Record<string, SensitiveString>;
|
|
74
73
|
}
|
|
75
74
|
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
successfulResult,
|
|
18
18
|
} from "../../../utils/result.js";
|
|
19
19
|
import { getCoverageManager } from "../coverage/helpers.js";
|
|
20
|
-
import { getGasAnalyticsManager } from "../gas-analytics/helpers.js";
|
|
20
|
+
import { getGasAnalyticsManager } from "../gas-analytics/helpers/accessors.js";
|
|
21
21
|
|
|
22
22
|
interface TestActionArguments {
|
|
23
23
|
testFiles: string[];
|
|
@@ -64,9 +64,8 @@ const runAllTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
64
64
|
const thisTask = hre.tasks.getTask("test");
|
|
65
65
|
|
|
66
66
|
if (!noCompile) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
67
|
+
const noTests = hre.config.solidity.splitTestsCompilation;
|
|
68
|
+
await hre.tasks.getTask("build").run({ noTests });
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
if (hre.globalOptions.coverage === true) {
|
package/src/internal/cli/main.ts
CHANGED
|
@@ -236,6 +236,20 @@ export async function main(
|
|
|
236
236
|
log("Error showing banner", bannerError);
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
+
|
|
240
|
+
const deprecatedConnectWasCalled = Boolean(
|
|
241
|
+
"wasConnectCalled" in hre.network &&
|
|
242
|
+
hre.network.wasConnectCalled !== undefined &&
|
|
243
|
+
typeof hre.network.wasConnectCalled === "function" &&
|
|
244
|
+
hre.network.wasConnectCalled(),
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
if (deprecatedConnectWasCalled) {
|
|
248
|
+
console.warn(
|
|
249
|
+
"WARNING: hre.network.connect() is deprecated and will be removed in a future version. " +
|
|
250
|
+
"Use hre.network.create() or hre.network.getOrCreate() instead.",
|
|
251
|
+
);
|
|
252
|
+
}
|
|
239
253
|
} catch (error) {
|
|
240
254
|
ensureError(error);
|
|
241
255
|
printErrorMessages(error, builtinGlobalOptions?.showStackTraces);
|
package/src/types/artifacts.ts
CHANGED
|
@@ -89,11 +89,11 @@ export interface ArtifactManager {
|
|
|
89
89
|
/**
|
|
90
90
|
* Returns true if an artifact exists.
|
|
91
91
|
*
|
|
92
|
-
* This function doesn't throw if the name is not unique
|
|
92
|
+
* This function doesn't throw if the name is not unique, this means that
|
|
93
|
+
* this method may return `true`, and a successive call to `readArtifact` can
|
|
94
|
+
* throw because of a duplicated name.
|
|
93
95
|
*
|
|
94
96
|
* @param contractNameOrFullyQualifiedName Contract or fully qualified name.
|
|
95
|
-
* @throws Throws an error if a non-unique contract name is used,
|
|
96
|
-
* indicating which fully qualified names can be used instead.
|
|
97
97
|
*/
|
|
98
98
|
artifactExists(contractNameOrFullyQualifiedName: string): Promise<boolean>;
|
|
99
99
|
|
|
@@ -120,7 +120,8 @@ export interface ArtifactManager {
|
|
|
120
120
|
* If it does return an id, it's not guaranteed that the build info is
|
|
121
121
|
* present.
|
|
122
122
|
*
|
|
123
|
-
* @param contractNameOrFullyQualifiedName Contract or fully qualified name,
|
|
123
|
+
* @param contractNameOrFullyQualifiedName Contract or fully qualified name,
|
|
124
|
+
* whose artifact must exist.
|
|
124
125
|
* @throws Throws an error if a non-unique contract name is used,
|
|
125
126
|
* indicating which fully qualified names can be used instead.
|
|
126
127
|
* @throws Throws an error if the artifact doesn't exist.
|
package/src/types/network.ts
CHANGED
|
@@ -48,11 +48,59 @@ export interface NetworkConnectionParams<
|
|
|
48
48
|
override?: NetworkConfigOverride;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
export interface CachedNetworkConnectionParams<
|
|
52
|
+
ChainTypeT extends ChainType | string = DefaultChainType,
|
|
53
|
+
> extends NetworkConnectionParams<ChainTypeT> {
|
|
54
|
+
override?: never;
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
export interface NetworkManager {
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new network connection based on the provided parameters.
|
|
60
|
+
*
|
|
61
|
+
* @param networkOrParams The network name or connection parameters. When
|
|
62
|
+
* omitted, the default network is used.
|
|
63
|
+
*
|
|
64
|
+
* @returns A new {@link NetworkConnection} for the specified network.
|
|
65
|
+
*/
|
|
66
|
+
create<ChainTypeT extends ChainType | string = DefaultChainType>(
|
|
67
|
+
networkOrParams?: NetworkConnectionParams<ChainTypeT> | string,
|
|
68
|
+
): Promise<NetworkConnection<ChainTypeT>>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Creates a new network connection based on the provided parameters.
|
|
72
|
+
*
|
|
73
|
+
* @deprecated Use {@link NetworkManager.create} or
|
|
74
|
+
* {@link NetworkManager.getOrCreate} instead.
|
|
75
|
+
*
|
|
76
|
+
* - {@link NetworkManager.create} always creates a new network instance.
|
|
77
|
+
* - {@link NetworkManager.getOrCreate} returns an existing instance if one exists.
|
|
78
|
+
*
|
|
79
|
+
* `connect` will be removed in a future version of Hardhat.
|
|
80
|
+
*
|
|
81
|
+
* @param networkOrParams The network name or connection parameters. When
|
|
82
|
+
* omitted, the default network is used.
|
|
83
|
+
*
|
|
84
|
+
* @returns A new {@link NetworkConnection} for the specified network.
|
|
85
|
+
*/
|
|
52
86
|
connect<ChainTypeT extends ChainType | string = DefaultChainType>(
|
|
53
87
|
networkOrParams?: NetworkConnectionParams<ChainTypeT> | string,
|
|
54
88
|
): Promise<NetworkConnection<ChainTypeT>>;
|
|
55
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Returns an existing network connection if one was previously created
|
|
92
|
+
* with the same network name and chain type. Creates a new one otherwise.
|
|
93
|
+
*
|
|
94
|
+
* @param networkOrParams The network name or connection parameters. When
|
|
95
|
+
* omitted, the default network is used. Overrides are not supported.
|
|
96
|
+
*
|
|
97
|
+
* @returns A {@link NetworkConnection} for the specified network, cached
|
|
98
|
+
* by network name and chain type.
|
|
99
|
+
*/
|
|
100
|
+
getOrCreate<ChainTypeT extends ChainType | string = DefaultChainType>(
|
|
101
|
+
networkOrParams?: CachedNetworkConnectionParams<ChainTypeT> | string,
|
|
102
|
+
): Promise<NetworkConnection<ChainTypeT>>;
|
|
103
|
+
|
|
56
104
|
/**
|
|
57
105
|
* Spawns an Ethereum JSON-RPC server listening on HTTP and Websocket.
|
|
58
106
|
*
|