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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CompilerInput } from "../../../types/solidity.js";
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_OUTPUT_SELECTION: CompilerInput["settings"]["outputSelection"] =
|
|
4
|
+
{
|
|
5
|
+
"*": {
|
|
6
|
+
"": ["ast"],
|
|
7
|
+
"*": [
|
|
8
|
+
"abi",
|
|
9
|
+
"evm.bytecode.linkReferences",
|
|
10
|
+
"evm.bytecode.object",
|
|
11
|
+
"evm.bytecode.opcodes",
|
|
12
|
+
"evm.bytecode.sourceMap",
|
|
13
|
+
"evm.deployedBytecode.immutableReferences",
|
|
14
|
+
"evm.deployedBytecode.linkReferences",
|
|
15
|
+
"evm.deployedBytecode.object",
|
|
16
|
+
"evm.deployedBytecode.opcodes",
|
|
17
|
+
"evm.deployedBytecode.sourceMap",
|
|
18
|
+
"evm.methodIdentifiers",
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
BuildScope,
|
|
3
|
+
SolidityBuildSystem,
|
|
4
|
+
} from "../../../../types/solidity.js";
|
|
3
5
|
import type { NewTaskActionFunction } from "../../../../types/tasks.js";
|
|
4
6
|
|
|
5
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
assertHardhatInvariant,
|
|
9
|
+
HardhatError,
|
|
10
|
+
} from "@nomicfoundation/hardhat-errors";
|
|
6
11
|
import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
|
|
7
12
|
|
|
8
13
|
import { throwIfSolidityBuildFailed } from "../build-results.js";
|
|
@@ -12,115 +17,395 @@ interface BuildActionArguments {
|
|
|
12
17
|
force: boolean;
|
|
13
18
|
files: string[];
|
|
14
19
|
quiet: boolean;
|
|
15
|
-
defaultBuildProfile: string
|
|
20
|
+
defaultBuildProfile: string;
|
|
16
21
|
noTests: boolean;
|
|
17
22
|
noContracts: boolean;
|
|
18
23
|
}
|
|
19
24
|
|
|
25
|
+
interface BuildActionResult {
|
|
26
|
+
contractRootPaths: string[];
|
|
27
|
+
testRootPaths: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
const buildAction: NewTaskActionFunction<BuildActionArguments> = async (
|
|
21
31
|
args: BuildActionArguments,
|
|
22
32
|
hre,
|
|
23
|
-
) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
): Promise<BuildActionResult> => {
|
|
34
|
+
const buildProfile =
|
|
35
|
+
hre.globalOptions.buildProfile ?? args.defaultBuildProfile;
|
|
36
|
+
|
|
37
|
+
const files = normalizeRootPaths(args.files);
|
|
38
|
+
|
|
39
|
+
const partitionedFiles = await partitionRootPathsByScope(hre.solidity, files);
|
|
40
|
+
|
|
41
|
+
if (args.noContracts && partitionedFiles.contractRootPaths.length > 0) {
|
|
42
|
+
throw new HardhatError(
|
|
43
|
+
HardhatError.ERRORS.CORE.SOLIDITY.INCOMPATIBLE_FILES_WITH_BUILD_FLAGS,
|
|
44
|
+
{
|
|
45
|
+
files: partitionedFiles.contractRootPaths
|
|
46
|
+
.sort()
|
|
47
|
+
.map((f) => `- ${f}`)
|
|
48
|
+
.join("\n"),
|
|
49
|
+
},
|
|
33
50
|
);
|
|
51
|
+
}
|
|
34
52
|
|
|
35
|
-
|
|
36
|
-
|
|
53
|
+
if (args.noTests && partitionedFiles.testRootPaths.length > 0) {
|
|
54
|
+
throw new HardhatError(
|
|
55
|
+
HardhatError.ERRORS.CORE.SOLIDITY.INCOMPATIBLE_FILES_WITH_BUILD_FLAGS,
|
|
56
|
+
{
|
|
57
|
+
files: partitionedFiles.testRootPaths
|
|
58
|
+
.sort()
|
|
59
|
+
.map((f) => `- ${f}`)
|
|
60
|
+
.join("\n"),
|
|
61
|
+
},
|
|
62
|
+
);
|
|
37
63
|
}
|
|
38
64
|
|
|
39
|
-
if (
|
|
40
|
-
const
|
|
65
|
+
if (hre.config.solidity.splitTestsCompilation) {
|
|
66
|
+
const contractRootPaths: string[] = [];
|
|
67
|
+
const testRootPaths: string[] = [];
|
|
41
68
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
69
|
+
const shouldBuildContracts =
|
|
70
|
+
!args.noContracts &&
|
|
71
|
+
(files.length === 0 || partitionedFiles.contractRootPaths.length > 0);
|
|
45
72
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
73
|
+
if (shouldBuildContracts) {
|
|
74
|
+
const contractBuildResults = await runSolidityBuild({
|
|
75
|
+
buildProfile,
|
|
76
|
+
files: partitionedFiles.contractRootPaths,
|
|
77
|
+
force: args.force,
|
|
78
|
+
isUnifiedModeOrScope: "contracts",
|
|
79
|
+
noContracts: args.noContracts,
|
|
80
|
+
noTests: args.noTests,
|
|
81
|
+
quiet: args.quiet,
|
|
82
|
+
solidity: hre.solidity,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
assertHardhatInvariant(
|
|
86
|
+
contractBuildResults.testRootPaths.length === 0,
|
|
87
|
+
"The contracts scope should build no test in split test compilation mode",
|
|
61
88
|
);
|
|
89
|
+
|
|
90
|
+
contractRootPaths.push(...contractBuildResults.contractRootPaths);
|
|
91
|
+
testRootPaths.push(...contractBuildResults.testRootPaths);
|
|
62
92
|
}
|
|
93
|
+
|
|
94
|
+
const shouldBuildTests =
|
|
95
|
+
!args.noTests &&
|
|
96
|
+
(files.length === 0 || partitionedFiles.testRootPaths.length > 0);
|
|
97
|
+
|
|
98
|
+
if (shouldBuildTests) {
|
|
99
|
+
const testBuildResults = await runSolidityBuild({
|
|
100
|
+
buildProfile,
|
|
101
|
+
files: partitionedFiles.testRootPaths,
|
|
102
|
+
force: args.force,
|
|
103
|
+
isUnifiedModeOrScope: "tests",
|
|
104
|
+
noContracts: args.noContracts,
|
|
105
|
+
noTests: args.noTests,
|
|
106
|
+
quiet: args.quiet,
|
|
107
|
+
solidity: hre.solidity,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
assertHardhatInvariant(
|
|
111
|
+
testBuildResults.contractRootPaths.length === 0,
|
|
112
|
+
"The tests scope should build no contract in split test compilation mode",
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
contractRootPaths.push(...testBuildResults.contractRootPaths);
|
|
116
|
+
testRootPaths.push(...testBuildResults.testRootPaths);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return { contractRootPaths, testRootPaths };
|
|
63
120
|
}
|
|
64
121
|
|
|
65
|
-
return {
|
|
122
|
+
return runSolidityBuild({
|
|
123
|
+
buildProfile,
|
|
124
|
+
files,
|
|
125
|
+
force: args.force,
|
|
126
|
+
isUnifiedModeOrScope: true,
|
|
127
|
+
noContracts: args.noContracts,
|
|
128
|
+
noTests: args.noTests,
|
|
129
|
+
quiet: args.quiet,
|
|
130
|
+
solidity: hre.solidity,
|
|
131
|
+
});
|
|
66
132
|
};
|
|
67
133
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
134
|
+
/**
|
|
135
|
+
* Runs a solidity build for a scope/unified mode.
|
|
136
|
+
*
|
|
137
|
+
* Note: The files array should be pre-classified by scope if using split
|
|
138
|
+
* compilation. i.e. it should only include files of the scope being used.
|
|
139
|
+
*/
|
|
140
|
+
async function runSolidityBuild({
|
|
141
|
+
buildProfile,
|
|
142
|
+
files,
|
|
143
|
+
force,
|
|
144
|
+
isUnifiedModeOrScope,
|
|
145
|
+
noContracts,
|
|
146
|
+
noTests,
|
|
147
|
+
quiet,
|
|
148
|
+
solidity,
|
|
149
|
+
}: {
|
|
150
|
+
buildProfile: string;
|
|
151
|
+
files: string[];
|
|
152
|
+
force: boolean;
|
|
153
|
+
isUnifiedModeOrScope: true | BuildScope;
|
|
154
|
+
noContracts: boolean;
|
|
155
|
+
noTests: boolean;
|
|
156
|
+
quiet: boolean;
|
|
157
|
+
solidity: SolidityBuildSystem;
|
|
158
|
+
}): Promise<{ contractRootPaths: string[]; testRootPaths: string[] }> {
|
|
159
|
+
const scope =
|
|
160
|
+
isUnifiedModeOrScope === true ? "contracts" : isUnifiedModeOrScope;
|
|
161
|
+
|
|
162
|
+
const { isFullBuild, contractRootPaths, testRootPaths } =
|
|
163
|
+
await getRootsToBuild({
|
|
164
|
+
solidity,
|
|
165
|
+
isUnifiedModeOrScope,
|
|
166
|
+
files,
|
|
167
|
+
noTests,
|
|
168
|
+
noContracts,
|
|
169
|
+
});
|
|
74
170
|
|
|
75
|
-
// If
|
|
76
|
-
|
|
171
|
+
// If there's nothing to build and this isn't a full build, we exit early.
|
|
172
|
+
// Full builds with no roots still need to run cleanup to remove stale
|
|
173
|
+
// artifacts.
|
|
174
|
+
if (
|
|
175
|
+
!isFullBuild &&
|
|
176
|
+
contractRootPaths.length === 0 &&
|
|
177
|
+
testRootPaths.length === 0
|
|
178
|
+
) {
|
|
179
|
+
return { contractRootPaths, testRootPaths };
|
|
180
|
+
}
|
|
77
181
|
|
|
78
|
-
const
|
|
182
|
+
const results = await solidity.build(
|
|
183
|
+
[...contractRootPaths, ...testRootPaths],
|
|
184
|
+
{
|
|
185
|
+
force,
|
|
186
|
+
buildProfile,
|
|
187
|
+
quiet,
|
|
188
|
+
scope,
|
|
189
|
+
},
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
throwIfSolidityBuildFailed(solidity, results);
|
|
79
193
|
|
|
80
|
-
|
|
81
|
-
|
|
194
|
+
// We use the result keys in case a hook added or removed root files
|
|
195
|
+
const builtRootPaths = [...results.keys()];
|
|
196
|
+
|
|
197
|
+
if (isFullBuild) {
|
|
198
|
+
await solidity.cleanupArtifacts(builtRootPaths, {
|
|
199
|
+
scope,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const preBuildRoots = new Set([...contractRootPaths, ...testRootPaths]);
|
|
204
|
+
if (
|
|
205
|
+
builtRootPaths.length === preBuildRoots.size &&
|
|
206
|
+
builtRootPaths.every((p) => preBuildRoots.has(p))
|
|
207
|
+
) {
|
|
208
|
+
return { contractRootPaths, testRootPaths };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return partitionRootPathsByScope(solidity, builtRootPaths);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Returns the files to build, classified by testRootPaths and
|
|
216
|
+
* contractRootPaths, and a boolean indicating if this represents a full build
|
|
217
|
+
* for the scope/unified build.
|
|
218
|
+
*
|
|
219
|
+
* Note: The files array should be pre-classified by scope if using split
|
|
220
|
+
* compilation. i.e. it should only include files of the scope being used.
|
|
221
|
+
*/
|
|
222
|
+
async function getRootsToBuild({
|
|
223
|
+
solidity,
|
|
224
|
+
isUnifiedModeOrScope,
|
|
225
|
+
files,
|
|
226
|
+
noTests,
|
|
227
|
+
noContracts,
|
|
228
|
+
}: {
|
|
229
|
+
solidity: SolidityBuildSystem;
|
|
230
|
+
isUnifiedModeOrScope: true | BuildScope;
|
|
231
|
+
files: string[];
|
|
232
|
+
noTests: boolean;
|
|
233
|
+
noContracts: boolean;
|
|
234
|
+
}): Promise<{
|
|
235
|
+
testRootPaths: string[];
|
|
236
|
+
contractRootPaths: string[];
|
|
237
|
+
isFullBuild: boolean;
|
|
238
|
+
}> {
|
|
239
|
+
if (isUnifiedModeOrScope === true) {
|
|
240
|
+
return getRootsToBuildInUnifiedMode({
|
|
241
|
+
files,
|
|
242
|
+
noContracts,
|
|
243
|
+
noTests,
|
|
244
|
+
solidity,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return getRootsToBuildForScope({
|
|
249
|
+
files,
|
|
250
|
+
scope: isUnifiedModeOrScope,
|
|
251
|
+
solidity,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Returns the root files to build in unified mode. While they are returned
|
|
257
|
+
* classified as contractRootPaths and testRootPaths, they are expected to be
|
|
258
|
+
* build together. It also returns a boolean indicating if this represents a
|
|
259
|
+
* full unified build.
|
|
260
|
+
*
|
|
261
|
+
* Note: The files array should be normalized already.
|
|
262
|
+
*/
|
|
263
|
+
async function getRootsToBuildInUnifiedMode({
|
|
264
|
+
files,
|
|
265
|
+
noContracts,
|
|
266
|
+
noTests,
|
|
267
|
+
solidity,
|
|
268
|
+
}: {
|
|
269
|
+
files: string[];
|
|
270
|
+
noContracts: boolean;
|
|
271
|
+
noTests: boolean;
|
|
272
|
+
solidity: SolidityBuildSystem;
|
|
273
|
+
}): Promise<{
|
|
274
|
+
testRootPaths: string[];
|
|
275
|
+
contractRootPaths: string[];
|
|
276
|
+
isFullBuild: boolean;
|
|
277
|
+
}> {
|
|
278
|
+
const isFullBuild = files.length === 0 && !noTests && !noContracts;
|
|
279
|
+
|
|
280
|
+
let rootFilePaths: string[];
|
|
281
|
+
|
|
282
|
+
if (isFullBuild) {
|
|
283
|
+
// In this mode, "contracts" also returns the tests
|
|
284
|
+
rootFilePaths = await solidity.getRootFilePaths({
|
|
285
|
+
scope: "contracts",
|
|
286
|
+
});
|
|
82
287
|
} else {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
288
|
+
const allRoots =
|
|
289
|
+
files.length > 0
|
|
290
|
+
? files
|
|
291
|
+
: await solidity.getRootFilePaths({
|
|
292
|
+
scope: "contracts",
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
rootFilePaths = [];
|
|
296
|
+
for (const root of allRoots) {
|
|
297
|
+
if (isNpmRootPath(root)) {
|
|
298
|
+
// npm files are considered contract files, so we skip them if
|
|
299
|
+
// --no-contracts
|
|
300
|
+
if (!noContracts) {
|
|
301
|
+
rootFilePaths.push(root);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
continue;
|
|
86
305
|
}
|
|
87
306
|
|
|
88
|
-
const
|
|
307
|
+
const scope = await solidity.getScope(root);
|
|
89
308
|
|
|
90
|
-
if (
|
|
309
|
+
if (noTests && scope === "tests") {
|
|
91
310
|
continue;
|
|
92
311
|
}
|
|
93
312
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
313
|
+
if (noContracts && scope === "contracts") {
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
97
316
|
|
|
98
|
-
|
|
99
|
-
if (rootPaths.length === 0) {
|
|
100
|
-
return { rootPaths, usedFiles };
|
|
317
|
+
rootFilePaths.push(root);
|
|
101
318
|
}
|
|
102
319
|
}
|
|
103
320
|
|
|
104
|
-
const
|
|
321
|
+
const partitionedRootPaths = await partitionRootPathsByScope(
|
|
322
|
+
solidity,
|
|
323
|
+
rootFilePaths,
|
|
324
|
+
);
|
|
105
325
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
});
|
|
326
|
+
return {
|
|
327
|
+
isFullBuild,
|
|
328
|
+
...partitionedRootPaths,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
112
331
|
|
|
113
|
-
|
|
332
|
+
/**
|
|
333
|
+
* Returns the root files to build for a certain scope, and a boolean indicating
|
|
334
|
+
* if it's a full build for that scope.
|
|
335
|
+
*
|
|
336
|
+
* Note: The files array should be pre-classified by scope if using split
|
|
337
|
+
* compilation. i.e. it should only include files of the scope being used.
|
|
338
|
+
*
|
|
339
|
+
* Note: One of the returned arrays is always empty, depending on the scope
|
|
340
|
+
* being used.
|
|
341
|
+
*/
|
|
342
|
+
async function getRootsToBuildForScope({
|
|
343
|
+
files,
|
|
344
|
+
scope,
|
|
345
|
+
solidity,
|
|
346
|
+
}: {
|
|
347
|
+
files: string[];
|
|
348
|
+
scope: BuildScope;
|
|
349
|
+
solidity: SolidityBuildSystem;
|
|
350
|
+
}): Promise<{
|
|
351
|
+
isFullBuild: boolean;
|
|
352
|
+
contractRootPaths: string[];
|
|
353
|
+
testRootPaths: string[];
|
|
354
|
+
}> {
|
|
355
|
+
const isFullBuild = files.length === 0;
|
|
356
|
+
|
|
357
|
+
const rootPaths = isFullBuild
|
|
358
|
+
? await solidity.getRootFilePaths({ scope })
|
|
359
|
+
: files; // This is safe because the files have already been partitioned by scope
|
|
360
|
+
|
|
361
|
+
if (scope === "contracts") {
|
|
362
|
+
return { isFullBuild, contractRootPaths: rootPaths, testRootPaths: [] };
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
return { isFullBuild, contractRootPaths: [], testRootPaths: rootPaths };
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Partitions root paths by scope, as returned by `solidity.getScope(rootPath)`.
|
|
370
|
+
*/
|
|
371
|
+
async function partitionRootPathsByScope(
|
|
372
|
+
solidity: SolidityBuildSystem,
|
|
373
|
+
rootPaths: string[],
|
|
374
|
+
): Promise<{ contractRootPaths: string[]; testRootPaths: string[] }> {
|
|
375
|
+
const contractRootPaths: string[] = [];
|
|
376
|
+
const testRootPaths: string[] = [];
|
|
114
377
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
378
|
+
for (const rootPath of rootPaths) {
|
|
379
|
+
if (isNpmRootPath(rootPath)) {
|
|
380
|
+
contractRootPaths.push(rootPath);
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
const scope = await solidity.getScope(rootPath);
|
|
385
|
+
if (scope === "tests") {
|
|
386
|
+
testRootPaths.push(rootPath);
|
|
387
|
+
} else {
|
|
388
|
+
contractRootPaths.push(rootPath);
|
|
389
|
+
}
|
|
121
390
|
}
|
|
122
391
|
|
|
123
|
-
return {
|
|
392
|
+
return { contractRootPaths, testRootPaths };
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Normalizes the received root paths.
|
|
397
|
+
*
|
|
398
|
+
* If a file is an npm root path or absolute file path, it's returned as is.
|
|
399
|
+
* If it's a relative path it's resolved from the CWD.
|
|
400
|
+
*/
|
|
401
|
+
function normalizeRootPaths(files: string[]): string[] {
|
|
402
|
+
return files.map((f) => {
|
|
403
|
+
if (isNpmRootPath(f)) {
|
|
404
|
+
return f;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
return resolveFromRoot(process.cwd(), f);
|
|
408
|
+
});
|
|
124
409
|
}
|
|
125
410
|
|
|
126
411
|
export default buildAction;
|
|
@@ -44,12 +44,34 @@ declare module "../../../types/config.js" {
|
|
|
44
44
|
* Fields that all the object-typed variants of SolidityUserConfig share.
|
|
45
45
|
*
|
|
46
46
|
* Note: All the variants of SolidityUserConfig except for the string and
|
|
47
|
-
* array of strings MUST extend this interface.
|
|
48
|
-
*
|
|
47
|
+
* array of strings MUST extend this interface. For plugins creating their
|
|
48
|
+
* own `SingleVersionSolidityUserConfig` variant, see
|
|
49
|
+
* {@link CommonSingleVersionSolidityUserConfig}.
|
|
49
50
|
*/
|
|
50
51
|
export interface CommonSolidityUserConfig {
|
|
51
52
|
isolated?: boolean;
|
|
52
53
|
npmFilesToBuild?: string[];
|
|
54
|
+
/**
|
|
55
|
+
* Controls whether Solidity test files are compiled in a separate pass
|
|
56
|
+
* from contract files.
|
|
57
|
+
*
|
|
58
|
+
* When `false` (the default), contracts and tests are compiled together
|
|
59
|
+
* in a single pass.
|
|
60
|
+
*
|
|
61
|
+
* When `true`, contracts and tests are compiled separately.
|
|
62
|
+
*/
|
|
63
|
+
splitTestsCompilation?: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Common fields for every SingleVersionSolidityUserConfig variant.
|
|
68
|
+
*
|
|
69
|
+
* NOTE: All the variants of SingleVersionSolidityUserConfig must extend this
|
|
70
|
+
* interface.
|
|
71
|
+
*/
|
|
72
|
+
export interface CommonSingleVersionSolidityUserConfig
|
|
73
|
+
extends CommonSolidityUserConfig {
|
|
74
|
+
toolVersionsInBuildInfo?: boolean;
|
|
53
75
|
}
|
|
54
76
|
|
|
55
77
|
/**
|
|
@@ -110,7 +132,7 @@ declare module "../../../types/config.js" {
|
|
|
110
132
|
*/
|
|
111
133
|
export interface SingleVersionSolcUserConfig
|
|
112
134
|
extends SolcSolidityCompilerUserConfig,
|
|
113
|
-
|
|
135
|
+
CommonSingleVersionSolidityUserConfig {}
|
|
114
136
|
|
|
115
137
|
/**
|
|
116
138
|
* Solc-specific SingleVersionSolidityUserConfig.
|
|
@@ -123,7 +145,7 @@ declare module "../../../types/config.js" {
|
|
|
123
145
|
/**
|
|
124
146
|
* A map from compiler type to its SingleVersionSolidityUserConfig type.
|
|
125
147
|
*
|
|
126
|
-
* Note: The types MUST extend `
|
|
148
|
+
* Note: The types MUST extend `CommonSingleVersionSolidityUserConfig`.
|
|
127
149
|
*/
|
|
128
150
|
export interface SingleVersionSolidityUserConfigPerType {
|
|
129
151
|
solc: SolcSingleVersionSolidityUserConfig;
|
|
@@ -165,7 +187,9 @@ declare module "../../../types/config.js" {
|
|
|
165
187
|
*/
|
|
166
188
|
export interface MultiVersionSolidityUserConfig
|
|
167
189
|
extends MultiVersionSolcUserConfig,
|
|
168
|
-
CommonSolidityUserConfig {
|
|
190
|
+
CommonSolidityUserConfig {
|
|
191
|
+
toolVersionsInBuildInfo?: boolean;
|
|
192
|
+
}
|
|
169
193
|
|
|
170
194
|
/**
|
|
171
195
|
* The type of a single-version build profile user config.
|
|
@@ -173,15 +197,17 @@ declare module "../../../types/config.js" {
|
|
|
173
197
|
export type SingleVersionBuildProfileUserConfig =
|
|
174
198
|
SolidityCompilerUserConfig & {
|
|
175
199
|
isolated?: boolean;
|
|
200
|
+
toolVersionsInBuildInfo?: boolean;
|
|
176
201
|
};
|
|
177
202
|
|
|
178
203
|
/**
|
|
179
204
|
* The type of a multi-version build profile user config.
|
|
205
|
+
* Mostly defined in `MultiVersionSolcUserConfig` for backwards compatibility
|
|
180
206
|
*/
|
|
181
|
-
/* eslint-disable-next-line @typescript-eslint/no-empty-interface -- Defined
|
|
182
|
-
in `MultiVersionSolcUserConfig` for backwards compatibility. */
|
|
183
207
|
export interface MultiVersionBuildProfileUserConfig
|
|
184
|
-
extends MultiVersionSolcUserConfig {
|
|
208
|
+
extends MultiVersionSolcUserConfig {
|
|
209
|
+
toolVersionsInBuildInfo?: boolean;
|
|
210
|
+
}
|
|
185
211
|
|
|
186
212
|
/**
|
|
187
213
|
* The type of the build profile version of the SolidityUserConfig.
|
|
@@ -259,6 +285,9 @@ declare module "../../../types/config.js" {
|
|
|
259
285
|
export interface SolidityBuildProfileConfig {
|
|
260
286
|
isolated: boolean;
|
|
261
287
|
preferWasm: boolean;
|
|
288
|
+
// Note: This is optional for backwards compatibility.
|
|
289
|
+
// If `undefined` is present, it's equivalent to `false`.
|
|
290
|
+
toolVersionsInBuildInfo?: boolean;
|
|
262
291
|
compilers: SolidityCompilerConfig[];
|
|
263
292
|
overrides: Record<string, SolidityCompilerConfig>;
|
|
264
293
|
}
|
|
@@ -270,6 +299,7 @@ declare module "../../../types/config.js" {
|
|
|
270
299
|
profiles: Record<string, SolidityBuildProfileConfig>;
|
|
271
300
|
npmFilesToBuild: string[];
|
|
272
301
|
registeredCompilerTypes: SolidityCompilerType[];
|
|
302
|
+
splitTestsCompilation: boolean;
|
|
273
303
|
}
|
|
274
304
|
|
|
275
305
|
/**
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
conditionalUnionType,
|
|
20
20
|
sensitiveStringSchema,
|
|
21
21
|
sensitiveUrlSchema,
|
|
22
|
+
unionType,
|
|
22
23
|
validateUserConfigZodType,
|
|
23
24
|
} from "@nomicfoundation/hardhat-zod-utils";
|
|
24
25
|
import { z } from "zod";
|
|
@@ -28,7 +29,6 @@ export const DEFAULT_FUZZ_SEED =
|
|
|
28
29
|
"0x7727ea51af0441c20da14dcd68a15dac8c9ebd589c5be8fa8c87c1d3720450bc";
|
|
29
30
|
|
|
30
31
|
const solidityTestUserConfigType = z.object({
|
|
31
|
-
timeout: z.number().optional(),
|
|
32
32
|
fsPermissions: z
|
|
33
33
|
.object({
|
|
34
34
|
readWriteFile: z.array(z.string()).optional(),
|
|
@@ -66,7 +66,12 @@ const solidityTestUserConfigType = z.object({
|
|
|
66
66
|
forking: z
|
|
67
67
|
.object({
|
|
68
68
|
url: z.optional(sensitiveUrlSchema),
|
|
69
|
-
blockNumber: z.
|
|
69
|
+
blockNumber: z.optional(
|
|
70
|
+
unionType(
|
|
71
|
+
[z.number().int().nonnegative().safe(), z.bigint().nonnegative()],
|
|
72
|
+
"Expected a nonnegative safe int or a nonnegative bigint",
|
|
73
|
+
),
|
|
74
|
+
),
|
|
70
75
|
rpcEndpoints: z.record(sensitiveStringSchema).optional(),
|
|
71
76
|
})
|
|
72
77
|
.optional(),
|
|
@@ -122,6 +127,10 @@ export function resolveSolidityTestForkingConfig(
|
|
|
122
127
|
|
|
123
128
|
return {
|
|
124
129
|
...forkingUserConfig,
|
|
130
|
+
blockNumber:
|
|
131
|
+
forkingUserConfig.blockNumber !== undefined
|
|
132
|
+
? BigInt(forkingUserConfig.blockNumber)
|
|
133
|
+
: undefined,
|
|
125
134
|
url:
|
|
126
135
|
forkingUserConfig.url !== undefined
|
|
127
136
|
? resolveConfigurationVariable(forkingUserConfig.url)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { RunOptions } from "./runner.js";
|
|
2
1
|
import type { Abi } from "../../../types/artifacts.js";
|
|
3
2
|
import type { ChainType } from "../../../types/network.js";
|
|
4
3
|
import type { SolidityTestConfig } from "../../../types/test.js";
|
|
@@ -41,12 +40,6 @@ interface SolidityTestConfigParams {
|
|
|
41
40
|
testFunctionOverrides?: TestFunctionOverride[];
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
export function solidityTestConfigToRunOptions(
|
|
45
|
-
config: SolidityTestConfig,
|
|
46
|
-
): RunOptions {
|
|
47
|
-
return config;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
43
|
export async function solidityTestConfigToSolidityTestRunnerConfigArgs({
|
|
51
44
|
chainType,
|
|
52
45
|
projectRoot,
|