hardhat 3.1.9 → 3.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/src/config.d.ts +20 -0
  3. package/dist/src/config.d.ts.map +1 -1
  4. package/dist/src/config.js +31 -0
  5. package/dist/src/config.js.map +1 -1
  6. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts +2 -2
  7. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts.map +1 -1
  8. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
  9. package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.d.ts.map +1 -1
  10. package/dist/src/internal/builtin-plugins/artifacts/hook-handlers/hre.js.map +1 -1
  11. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts.map +1 -1
  12. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +33 -21
  13. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
  14. package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +3 -5
  15. package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +1 -1
  16. package/dist/src/internal/builtin-plugins/coverage/helpers.js +7 -19
  17. package/dist/src/internal/builtin-plugins/coverage/helpers.js.map +1 -1
  18. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts +7 -0
  19. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.d.ts.map +1 -0
  20. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +42 -0
  21. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -0
  22. package/dist/src/internal/builtin-plugins/coverage/index.d.ts.map +1 -1
  23. package/dist/src/internal/builtin-plugins/coverage/index.js +1 -0
  24. package/dist/src/internal/builtin-plugins/coverage/index.js.map +1 -1
  25. package/dist/src/internal/builtin-plugins/flatten/task-action.d.ts.map +1 -1
  26. package/dist/src/internal/builtin-plugins/flatten/task-action.js +1 -1
  27. package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
  28. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +2 -2
  29. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
  30. package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts +3 -5
  31. package/dist/src/internal/builtin-plugins/gas-analytics/helpers.d.ts.map +1 -1
  32. package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js +7 -19
  33. package/dist/src/internal/builtin-plugins/gas-analytics/helpers.js.map +1 -1
  34. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts +7 -0
  35. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.d.ts.map +1 -0
  36. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js +42 -0
  37. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.js.map +1 -0
  38. package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
  39. package/dist/src/internal/builtin-plugins/gas-analytics/index.js +1 -0
  40. package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
  41. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
  42. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +17 -20
  43. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
  44. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.d.ts +1 -1
  45. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.d.ts.map +1 -1
  46. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.js +2 -2
  47. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.js.map +1 -1
  48. package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.d.ts +0 -2
  49. package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.d.ts.map +1 -1
  50. package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.js +0 -6
  51. package/dist/src/internal/builtin-plugins/network-manager/edr/type-validation.js.map +1 -1
  52. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts +1 -3
  53. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts.map +1 -1
  54. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +0 -49
  55. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
  56. package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.d.ts.map +1 -1
  57. package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.js +58 -20
  58. package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/config.js.map +1 -1
  59. package/dist/src/internal/builtin-plugins/network-manager/type-validation.d.ts.map +1 -1
  60. package/dist/src/internal/builtin-plugins/network-manager/type-validation.js +8 -0
  61. package/dist/src/internal/builtin-plugins/network-manager/type-validation.js.map +1 -1
  62. package/dist/src/internal/builtin-plugins/node/task-action.d.ts.map +1 -1
  63. package/dist/src/internal/builtin-plugins/node/task-action.js +1 -2
  64. package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
  65. package/dist/src/internal/builtin-plugins/solidity/build-results.d.ts +2 -2
  66. package/dist/src/internal/builtin-plugins/solidity/build-results.d.ts.map +1 -1
  67. package/dist/src/internal/builtin-plugins/solidity/build-results.js +2 -2
  68. package/dist/src/internal/builtin-plugins/solidity/build-results.js.map +1 -1
  69. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts +1 -0
  70. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
  71. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +14 -6
  72. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
  73. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +1 -1
  74. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js.map +1 -1
  75. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts +0 -3
  76. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
  77. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +3 -5
  78. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
  79. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.d.ts +2 -1
  80. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.d.ts.map +1 -1
  81. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js +4 -2
  82. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.js.map +1 -1
  83. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph.d.ts +1 -1
  84. package/dist/src/internal/builtin-plugins/solidity/build-system/dependency-graph.js +1 -1
  85. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts +5 -2
  86. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts.map +1 -1
  87. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +8 -2
  88. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
  89. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.d.ts.map +1 -1
  90. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.js +19 -5
  91. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.js.map +1 -1
  92. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts +21 -2
  93. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts.map +1 -1
  94. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js +84 -25
  95. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
  96. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.d.ts +3 -12
  97. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.d.ts.map +1 -1
  98. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/types.js.map +1 -1
  99. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts +1 -1
  100. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts.map +1 -1
  101. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.d.ts +8 -6
  102. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.d.ts.map +1 -1
  103. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.js +103 -27
  104. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.js.map +1 -1
  105. package/dist/src/internal/builtin-plugins/solidity/config.js +2 -2
  106. package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
  107. package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.d.ts.map +1 -1
  108. package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js +5 -0
  109. package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
  110. package/dist/src/internal/builtin-plugins/solidity/tasks/build.js +1 -1
  111. package/dist/src/internal/builtin-plugins/solidity/tasks/build.js.map +1 -1
  112. package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +22 -0
  113. package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.map +1 -1
  114. package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
  115. package/dist/src/internal/builtin-plugins/solidity-test/config.js +1 -0
  116. package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
  117. package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.d.ts +1 -1
  118. package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.d.ts.map +1 -1
  119. package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js +1 -1
  120. package/dist/src/internal/builtin-plugins/solidity-test/edr-artifacts.js.map +1 -1
  121. package/dist/src/internal/builtin-plugins/solidity-test/runner.d.ts +1 -1
  122. package/dist/src/internal/builtin-plugins/solidity-test/runner.js +1 -1
  123. package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
  124. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +16 -27
  125. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
  126. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +1 -0
  127. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
  128. package/dist/src/internal/builtin-plugins/telemetry/task-action.d.ts.map +1 -1
  129. package/dist/src/internal/builtin-plugins/telemetry/task-action.js +3 -2
  130. package/dist/src/internal/builtin-plugins/telemetry/task-action.js.map +1 -1
  131. package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
  132. package/dist/src/internal/builtin-plugins/test/task-action.js +40 -13
  133. package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
  134. package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts +27 -0
  135. package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts.map +1 -1
  136. package/dist/src/internal/cli/banner-manager.d.ts +26 -0
  137. package/dist/src/internal/cli/banner-manager.d.ts.map +1 -0
  138. package/dist/src/internal/cli/banner-manager.js +146 -0
  139. package/dist/src/internal/cli/banner-manager.js.map +1 -0
  140. package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
  141. package/dist/src/internal/cli/error-handler.js +15 -0
  142. package/dist/src/internal/cli/error-handler.js.map +1 -1
  143. package/dist/src/internal/cli/init/init.d.ts.map +1 -1
  144. package/dist/src/internal/cli/init/init.js +8 -0
  145. package/dist/src/internal/cli/init/init.js.map +1 -1
  146. package/dist/src/internal/cli/main.d.ts.map +1 -1
  147. package/dist/src/internal/cli/main.js +18 -1
  148. package/dist/src/internal/cli/main.js.map +1 -1
  149. package/dist/src/internal/cli/telemetry/analytics/subprocess.js +2 -0
  150. package/dist/src/internal/cli/telemetry/analytics/subprocess.js.map +1 -1
  151. package/dist/src/internal/cli/telemetry/sentry/anonymize-paths.js +1 -1
  152. package/dist/src/internal/cli/telemetry/sentry/reporter.d.ts.map +1 -1
  153. package/dist/src/internal/cli/telemetry/sentry/reporter.js +4 -0
  154. package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
  155. package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.d.ts +1 -1
  156. package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.d.ts.map +1 -1
  157. package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.js +47 -38
  158. package/dist/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.js.map +1 -1
  159. package/dist/src/internal/core/config-validation.d.ts +3 -3
  160. package/dist/src/internal/core/config-validation.d.ts.map +1 -1
  161. package/dist/src/internal/core/config-validation.js +48 -18
  162. package/dist/src/internal/core/config-validation.js.map +1 -1
  163. package/dist/src/internal/core/tasks/builders.d.ts +26 -16
  164. package/dist/src/internal/core/tasks/builders.d.ts.map +1 -1
  165. package/dist/src/internal/core/tasks/builders.js +65 -6
  166. package/dist/src/internal/core/tasks/builders.js.map +1 -1
  167. package/dist/src/internal/core/tasks/resolved-task.d.ts +2 -2
  168. package/dist/src/internal/core/tasks/resolved-task.d.ts.map +1 -1
  169. package/dist/src/internal/core/tasks/resolved-task.js +23 -9
  170. package/dist/src/internal/core/tasks/resolved-task.js.map +1 -1
  171. package/dist/src/internal/core/tasks/task-manager.d.ts.map +1 -1
  172. package/dist/src/internal/core/tasks/task-manager.js +14 -6
  173. package/dist/src/internal/core/tasks/task-manager.js.map +1 -1
  174. package/dist/src/internal/core/tasks/validations.d.ts +2 -0
  175. package/dist/src/internal/core/tasks/validations.d.ts.map +1 -1
  176. package/dist/src/internal/core/tasks/validations.js +11 -0
  177. package/dist/src/internal/core/tasks/validations.js.map +1 -1
  178. package/dist/src/internal/core/user-interruptions.js +1 -1
  179. package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.d.ts +2 -0
  180. package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.d.ts.map +1 -0
  181. package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js +12 -0
  182. package/dist/src/internal/deprecated-module-imported-from-hardhat2-plugin.js.map +1 -0
  183. package/dist/src/internal/using-hardhat2-plugin-errors.d.ts +35 -0
  184. package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -0
  185. package/dist/src/internal/using-hardhat2-plugin-errors.js +98 -0
  186. package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -0
  187. package/dist/src/plugins.d.ts +8 -0
  188. package/dist/src/plugins.d.ts.map +1 -1
  189. package/dist/src/plugins.js +13 -0
  190. package/dist/src/plugins.js.map +1 -1
  191. package/dist/src/types/artifacts.d.ts +32 -3
  192. package/dist/src/types/artifacts.d.ts.map +1 -1
  193. package/dist/src/types/index.d.ts +15 -0
  194. package/dist/src/types/index.d.ts.map +1 -0
  195. package/dist/src/types/index.js +15 -0
  196. package/dist/src/types/index.js.map +1 -0
  197. package/dist/src/types/network.d.ts +1 -1
  198. package/dist/src/types/plugins.d.ts +2 -2
  199. package/dist/src/types/solidity/build-system.d.ts +56 -10
  200. package/dist/src/types/solidity/build-system.d.ts.map +1 -1
  201. package/dist/src/types/solidity/build-system.js +26 -2
  202. package/dist/src/types/solidity/build-system.js.map +1 -1
  203. package/dist/src/types/solidity/errors.d.ts +18 -0
  204. package/dist/src/types/solidity/errors.d.ts.map +1 -1
  205. package/dist/src/types/solidity/errors.js.map +1 -1
  206. package/dist/src/types/solidity/resolved-file.d.ts +2 -2
  207. package/dist/src/types/tasks.d.ts +103 -34
  208. package/dist/src/types/tasks.d.ts.map +1 -1
  209. package/dist/src/types/tasks.js.map +1 -1
  210. package/dist/src/types/test.d.ts +11 -0
  211. package/dist/src/types/test.d.ts.map +1 -1
  212. package/dist/src/types/utils.d.ts +16 -0
  213. package/dist/src/types/utils.d.ts.map +1 -1
  214. package/dist/src/utils/result.d.ts +33 -0
  215. package/dist/src/utils/result.d.ts.map +1 -0
  216. package/dist/src/utils/result.js +43 -0
  217. package/dist/src/utils/result.js.map +1 -0
  218. package/package.json +12 -7
  219. package/src/config.ts +37 -0
  220. package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +4 -1
  221. package/src/internal/builtin-plugins/artifacts/hook-handlers/hre.ts +4 -1
  222. package/src/internal/builtin-plugins/coverage/coverage-manager.ts +57 -50
  223. package/src/internal/builtin-plugins/coverage/helpers.ts +11 -29
  224. package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +68 -0
  225. package/src/internal/builtin-plugins/coverage/index.ts +1 -0
  226. package/src/internal/builtin-plugins/flatten/task-action.ts +1 -0
  227. package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +4 -4
  228. package/src/internal/builtin-plugins/gas-analytics/helpers.ts +11 -29
  229. package/src/internal/builtin-plugins/gas-analytics/hook-handlers/test.ts +68 -0
  230. package/src/internal/builtin-plugins/gas-analytics/index.ts +1 -0
  231. package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +21 -28
  232. package/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-generation-errors.ts +5 -2
  233. package/src/internal/builtin-plugins/network-manager/edr/type-validation.ts +0 -13
  234. package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +0 -64
  235. package/src/internal/builtin-plugins/network-manager/hook-handlers/config.ts +65 -21
  236. package/src/internal/builtin-plugins/network-manager/type-validation.ts +9 -0
  237. package/src/internal/builtin-plugins/node/task-action.ts +2 -2
  238. package/src/internal/builtin-plugins/solidity/build-results.ts +3 -1
  239. package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +16 -5
  240. package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +1 -1
  241. package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +7 -6
  242. package/src/internal/builtin-plugins/solidity/build-system/dependency-graph-building.ts +23 -1
  243. package/src/internal/builtin-plugins/solidity/build-system/dependency-graph.ts +1 -1
  244. package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +17 -3
  245. package/src/internal/builtin-plugins/solidity/build-system/resolver/error-messages.ts +19 -5
  246. package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +139 -35
  247. package/src/internal/builtin-plugins/solidity/build-system/resolver/types.ts +3 -9
  248. package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +1 -1
  249. package/src/internal/builtin-plugins/solidity/build-system/solc-config-selection.ts +125 -28
  250. package/src/internal/builtin-plugins/solidity/config.ts +2 -2
  251. package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +8 -0
  252. package/src/internal/builtin-plugins/solidity/tasks/build.ts +1 -1
  253. package/src/internal/builtin-plugins/solidity/type-extensions.ts +28 -0
  254. package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
  255. package/src/internal/builtin-plugins/solidity-test/edr-artifacts.ts +2 -2
  256. package/src/internal/builtin-plugins/solidity-test/runner.ts +1 -1
  257. package/src/internal/builtin-plugins/solidity-test/task-action.ts +36 -38
  258. package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
  259. package/src/internal/builtin-plugins/telemetry/task-action.ts +4 -2
  260. package/src/internal/builtin-plugins/test/task-action.ts +71 -25
  261. package/src/internal/builtin-plugins/test/type-extensions.ts +42 -0
  262. package/src/internal/cli/banner-manager.ts +234 -0
  263. package/src/internal/cli/error-handler.ts +18 -0
  264. package/src/internal/cli/init/init.ts +8 -0
  265. package/src/internal/cli/main.ts +19 -1
  266. package/src/internal/cli/telemetry/analytics/subprocess.ts +2 -0
  267. package/src/internal/cli/telemetry/sentry/anonymize-paths.ts +1 -1
  268. package/src/internal/cli/telemetry/sentry/reporter.ts +5 -0
  269. package/src/internal/cli/telemetry/sentry/vendor/integrations/contextlines.ts +98 -50
  270. package/src/internal/core/config-validation.ts +67 -18
  271. package/src/internal/core/tasks/builders.ts +174 -30
  272. package/src/internal/core/tasks/resolved-task.ts +31 -13
  273. package/src/internal/core/tasks/task-manager.ts +23 -5
  274. package/src/internal/core/tasks/validations.ts +40 -0
  275. package/src/internal/core/user-interruptions.ts +1 -1
  276. package/src/internal/deprecated-module-imported-from-hardhat2-plugin.ts +12 -0
  277. package/src/internal/using-hardhat2-plugin-errors.ts +108 -0
  278. package/src/plugins.ts +16 -0
  279. package/src/types/artifacts.ts +40 -3
  280. package/src/types/hre.ts +1 -1
  281. package/src/types/index.ts +14 -0
  282. package/src/types/network.ts +1 -1
  283. package/src/types/plugins.ts +2 -2
  284. package/src/types/solidity/build-system.ts +75 -14
  285. package/src/types/solidity/errors.ts +22 -0
  286. package/src/types/solidity/resolved-file.ts +2 -2
  287. package/src/types/tasks.ts +143 -36
  288. package/src/types/test.ts +12 -0
  289. package/src/types/utils.ts +14 -0
  290. package/src/utils/result.ts +57 -0
  291. package/templates/hardhat-3/01-node-test-runner-viem/package.json +11 -11
  292. package/templates/hardhat-3/02-mocha-ethers/package.json +16 -16
  293. package/templates/hardhat-3/03-minimal/package.json +1 -1
  294. package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.d.ts +0 -19
  295. package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.d.ts.map +0 -1
  296. package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.js +0 -2
  297. package/dist/src/internal/builtin-plugins/network-manager/edr/types/output.js.map +0 -1
  298. package/src/internal/builtin-plugins/network-manager/edr/types/output.ts +0 -19
@@ -28,6 +28,7 @@ import {
28
28
  type OptionDefinition,
29
29
  type PositionalArgumentDefinition,
30
30
  } from "../../types/arguments.js";
31
+ import { isResult } from "../../utils/result.js";
31
32
  import { BUILTIN_GLOBAL_OPTIONS_DEFINITIONS } from "../builtin-global-options.js";
32
33
  import { builtinPlugins } from "../builtin-plugins/index.js";
33
34
  import {
@@ -217,7 +218,24 @@ export async function main(
217
218
 
218
219
  log(`Running task "${task.id.join(" ")}"`);
219
220
 
220
- await Promise.all([task.run(taskArguments), sendTaskAnalytics(task.id)]);
221
+ const [taskResult] = await Promise.all([
222
+ task.run(taskArguments),
223
+ sendTaskAnalytics(task.id),
224
+ ]);
225
+
226
+ if (isResult(taskResult) && !taskResult.success) {
227
+ process.exitCode = 1;
228
+ }
229
+
230
+ if (!isCi() && process.stdout.isTTY === true) {
231
+ try {
232
+ const { BannerManager } = await import("./banner-manager.js");
233
+ const bannerManager = await BannerManager.getInstance();
234
+ await bannerManager.showBanner(200);
235
+ } catch (bannerError) {
236
+ log("Error showing banner", bannerError);
237
+ }
238
+ }
221
239
  } catch (error) {
222
240
  ensureError(error);
223
241
  printErrorMessages(error, builtinGlobalOptions?.showStackTraces);
@@ -5,7 +5,9 @@ import { postJsonRequest } from "@nomicfoundation/hardhat-utils/request";
5
5
 
6
6
  // These keys are expected to be public
7
7
  const ANALYTICS_URL = "https://www.google-analytics.com/mp/collect";
8
+ /* cspell:disable-next-line */
8
9
  // const API_SECRET = "iXzTRik5RhahYpgiatSv1w"; // DEV
10
+ /* cspell:disable-next-line */
9
11
  // const MEASUREMENT_ID = "G-ZFZWHGZ64H"; // DEV
10
12
  const API_SECRET = "fQ5joCsDRTOp55wX8a2cVw"; // PROD
11
13
  const MEASUREMENT_ID = "G-8LQ007N2QJ"; // PROD
@@ -107,7 +107,7 @@ function anonymizeSinglePath(path: string): string {
107
107
  return normalizedPath;
108
108
  }
109
109
 
110
- // We first get the index of the first /node_modules to desambiguate some
110
+ // We first get the index of the first /node_modules to disambiguate some
111
111
  // special cases below
112
112
  const nodeModulesIndex = normalizedPath.indexOf("/node_modules");
113
113
 
@@ -8,6 +8,7 @@ import {
8
8
  ProviderError,
9
9
  UnknownError,
10
10
  } from "../../../builtin-plugins/network-manager/provider-errors.js";
11
+ import { UsingHardhat2PluginError } from "../../../using-hardhat2-plugin-errors.js";
11
12
  import { getHardhatVersion } from "../../../utils/package.js";
12
13
  import { isTelemetryAllowed } from "../telemetry-permissions.js";
13
14
 
@@ -134,6 +135,10 @@ class Reporter {
134
135
  return false;
135
136
  }
136
137
 
138
+ if (error instanceof UsingHardhat2PluginError) {
139
+ return false;
140
+ }
141
+
137
142
  if (HardhatPluginError.isHardhatPluginError(error)) {
138
143
  // Don't log errors from third-party plugins
139
144
  return false;
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable -- This file is vendored from https://github.com/getsentry/sentry-javascript/blob/9.4.0/packages/node/src/integrations/contextlines.ts */
2
2
 
3
- import { createReadStream } from 'node:fs';
4
- import { createInterface } from 'node:readline';
5
- import type { Event, IntegrationFn, StackFrame } from '@sentry/core';
6
- import { LRUMap, defineIntegration, logger, snipLine } from '@sentry/core';
7
- import { DEBUG_BUILD } from '../debug-build.js';
3
+ import { createReadStream } from "node:fs";
4
+ import { createInterface } from "node:readline";
5
+ import type { Event, IntegrationFn, StackFrame } from "@sentry/core";
6
+ import { LRUMap, defineIntegration, logger, snipLine } from "@sentry/core";
7
+ import { DEBUG_BUILD } from "../debug-build.js";
8
8
 
9
9
  const LRU_FILE_CONTENTS_CACHE = new LRUMap<string, Record<number, string>>(10);
10
10
  const LRU_FILE_CONTENTS_FS_READ_FAILED = new LRUMap<string, 1>(20);
11
11
  const DEFAULT_LINES_OF_CONTEXT = 7;
12
- const INTEGRATION_NAME = 'ContextLines';
12
+ const INTEGRATION_NAME = "ContextLines";
13
13
  // Determines the upper bound of lineno/colno that we will attempt to read. Large colno values are likely to be
14
14
  // minified code while large lineno values are likely to be bundled code.
15
15
  // Exported for testing purposes.
@@ -36,7 +36,11 @@ export function resetFileContentCache(): void {
36
36
  /**
37
37
  * Get or init map value
38
38
  */
39
- function emplace<T extends LRUMap<K, V>, K extends string, V>(map: T, key: K, contents: V): V {
39
+ function emplace<T extends LRUMap<K, V>, K extends string, V>(
40
+ map: T,
41
+ key: K,
42
+ contents: V,
43
+ ): V {
40
44
  const value = map.get(key);
41
45
 
42
46
  if (value === undefined) {
@@ -49,18 +53,18 @@ function emplace<T extends LRUMap<K, V>, K extends string, V>(map: T, key: K, co
49
53
 
50
54
  /**
51
55
  * Determines if context lines should be skipped for a file.
52
- * - .min.(mjs|cjs|js) files are and not useful since they dont point to the original source
56
+ * - .min.(mjs|cjs|js) files are and not useful since they don't point to the original source
53
57
  * - node: prefixed modules are part of the runtime and cannot be resolved to a file
54
58
  * - data: skip json, wasm and inline js https://nodejs.org/api/esm.html#data-imports
55
59
  */
56
60
  function shouldSkipContextLinesForFile(path: string): boolean {
57
61
  // Test the most common prefix and extension first. These are the ones we
58
62
  // are most likely to see in user applications and are the ones we can break out of first.
59
- if (path.startsWith('node:')) return true;
60
- if (path.endsWith('.min.js')) return true;
61
- if (path.endsWith('.min.cjs')) return true;
62
- if (path.endsWith('.min.mjs')) return true;
63
- if (path.startsWith('data:')) return true;
63
+ if (path.startsWith("node:")) return true;
64
+ if (path.endsWith(".min.js")) return true;
65
+ if (path.endsWith(".min.cjs")) return true;
66
+ if (path.endsWith(".min.mjs")) return true;
67
+ if (path.startsWith("data:")) return true;
64
68
  return false;
65
69
  }
66
70
 
@@ -68,14 +72,19 @@ function shouldSkipContextLinesForFile(path: string): boolean {
68
72
  * Determines if we should skip contextlines based off the max lineno and colno values.
69
73
  */
70
74
  function shouldSkipContextLinesForFrame(frame: StackFrame): boolean {
71
- if (frame.lineno !== undefined && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
72
- if (frame.colno !== undefined && frame.colno > MAX_CONTEXTLINES_COLNO) return true;
75
+ if (frame.lineno !== undefined && frame.lineno > MAX_CONTEXTLINES_LINENO)
76
+ return true;
77
+ if (frame.colno !== undefined && frame.colno > MAX_CONTEXTLINES_COLNO)
78
+ return true;
73
79
  return false;
74
80
  }
75
81
  /**
76
82
  * Checks if we have all the contents that we need in the cache.
77
83
  */
78
- function rangeExistsInContentCache(file: string, range: ReadlineRange): boolean {
84
+ function rangeExistsInContentCache(
85
+ file: string,
86
+ range: ReadlineRange,
87
+ ): boolean {
79
88
  const contents = LRU_FILE_CONTENTS_CACHE.get(file);
80
89
  if (contents === undefined) return false;
81
90
 
@@ -92,7 +101,10 @@ function rangeExistsInContentCache(file: string, range: ReadlineRange): boolean
92
101
  * Creates contiguous ranges of lines to read from a file. In the case where context lines overlap,
93
102
  * the ranges are merged to create a single range.
94
103
  */
95
- function makeLineReaderRanges(lines: number[], linecontext: number): ReadlineRange[] {
104
+ function makeLineReaderRanges(
105
+ lines: number[],
106
+ linecontext: number,
107
+ ): ReadlineRange[] {
96
108
  if (!lines.length) {
97
109
  return [];
98
110
  }
@@ -100,7 +112,7 @@ function makeLineReaderRanges(lines: number[], linecontext: number): ReadlineRan
100
112
  let i = 0;
101
113
  const line = lines[0];
102
114
 
103
- if (typeof line !== 'number') {
115
+ if (typeof line !== "number") {
104
116
  return [];
105
117
  }
106
118
 
@@ -115,7 +127,7 @@ function makeLineReaderRanges(lines: number[], linecontext: number): ReadlineRan
115
127
 
116
128
  // If the next line falls into the current range, extend the current range to lineno + linecontext.
117
129
  const next = lines[i + 1];
118
- if (typeof next !== 'number') {
130
+ if (typeof next !== "number") {
119
131
  break;
120
132
  }
121
133
  if (next <= current[1]) {
@@ -134,13 +146,17 @@ function makeLineReaderRanges(lines: number[], linecontext: number): ReadlineRan
134
146
  /**
135
147
  * Extracts lines from a file and stores them in a cache.
136
148
  */
137
- function getContextLinesFromFile(path: string, ranges: ReadlineRange[], output: Record<number, string>): Promise<void> {
149
+ function getContextLinesFromFile(
150
+ path: string,
151
+ ranges: ReadlineRange[],
152
+ output: Record<number, string>,
153
+ ): Promise<void> {
138
154
  return new Promise((resolve, _reject) => {
139
155
  // It is important *not* to have any async code between createInterface and the 'line' event listener
140
156
  // as it will cause the 'line' event to
141
157
  // be emitted before the listener is attached.
142
158
  const stream = createReadStream(path);
143
- const lineReaded = createInterface({
159
+ const lineRead = createInterface({
144
160
  input: stream,
145
161
  });
146
162
 
@@ -170,18 +186,18 @@ function getContextLinesFromFile(path: string, ranges: ReadlineRange[], output:
170
186
  // Mark file path as failed to read and prevent multiple read attempts.
171
187
  LRU_FILE_CONTENTS_FS_READ_FAILED.set(path, 1);
172
188
  DEBUG_BUILD && logger.error(`Failed to read file: ${path}. Error: ${e}`);
173
- lineReaded.close();
174
- lineReaded.removeAllListeners();
189
+ lineRead.close();
190
+ lineRead.removeAllListeners();
175
191
  destroyStreamAndResolve();
176
192
  }
177
193
 
178
194
  // We need to handle the error event to prevent the process from crashing in < Node 16
179
195
  // https://github.com/nodejs/node/pull/31603
180
- stream.on('error', onStreamError);
181
- lineReaded.on('error', onStreamError);
182
- lineReaded.on('close', destroyStreamAndResolve);
196
+ stream.on("error", onStreamError);
197
+ lineRead.on("error", onStreamError);
198
+ lineRead.on("close", destroyStreamAndResolve);
183
199
 
184
- lineReaded.on('line', line => {
200
+ lineRead.on("line", (line) => {
185
201
  lineNumber++;
186
202
  if (lineNumber < rangeStart) return;
187
203
 
@@ -191,16 +207,16 @@ function getContextLinesFromFile(path: string, ranges: ReadlineRange[], output:
191
207
  if (lineNumber >= rangeEnd) {
192
208
  if (currentRangeIndex === ranges.length - 1) {
193
209
  // We need to close the file stream and remove listeners, else the reader will continue to run our listener;
194
- lineReaded.close();
195
- lineReaded.removeAllListeners();
210
+ lineRead.close();
211
+ lineRead.removeAllListeners();
196
212
  return;
197
213
  }
198
214
  currentRangeIndex++;
199
215
  const range = ranges[currentRangeIndex];
200
216
  if (range === undefined) {
201
217
  // This should never happen as it means we have a bug in the context.
202
- lineReaded.close();
203
- lineReaded.removeAllListeners();
218
+ lineRead.close();
219
+ lineRead.removeAllListeners();
204
220
  return;
205
221
  }
206
222
  rangeStart = range[0];
@@ -217,7 +233,10 @@ function getContextLinesFromFile(path: string, ranges: ReadlineRange[], output:
217
233
  * failing reads from happening.
218
234
  */
219
235
 
220
- async function addSourceContext(event: Event, contextLines: number): Promise<Event> {
236
+ async function addSourceContext(
237
+ event: Event,
238
+ contextLines: number,
239
+ ): Promise<Event> {
221
240
  // keep a lookup map of which files we've already enqueued to read,
222
241
  // so we don't enqueue the same file multiple times which would cause multiple i/o reads
223
242
  const filesToLines: Record<string, number[]> = {};
@@ -236,8 +255,8 @@ async function addSourceContext(event: Event, contextLines: number): Promise<Eve
236
255
 
237
256
  if (
238
257
  !frame ||
239
- typeof filename !== 'string' ||
240
- typeof frame.lineno !== 'number' ||
258
+ typeof filename !== "string" ||
259
+ typeof frame.lineno !== "number" ||
241
260
  shouldSkipContextLinesForFile(filename) ||
242
261
  shouldSkipContextLinesForFrame(frame)
243
262
  ) {
@@ -258,7 +277,7 @@ async function addSourceContext(event: Event, contextLines: number): Promise<Eve
258
277
 
259
278
  const readlinePromises: Promise<void>[] = [];
260
279
  for (const file of files) {
261
- // If we failed to read this before, dont try reading it again.
280
+ // If we failed to read this before, don't try reading it again.
262
281
  if (LRU_FILE_CONTENTS_FS_READ_FAILED.get(file)) {
263
282
  continue;
264
283
  }
@@ -272,7 +291,7 @@ async function addSourceContext(event: Event, contextLines: number): Promise<Eve
272
291
  filesToLineRanges.sort((a, b) => a - b);
273
292
  // Check if the contents are already in the cache and if we can avoid reading the file again.
274
293
  const ranges = makeLineReaderRanges(filesToLineRanges, contextLines);
275
- if (ranges.every(r => rangeExistsInContentCache(file, r))) {
294
+ if (ranges.every((r) => rangeExistsInContentCache(file, r))) {
276
295
  continue;
277
296
  }
278
297
 
@@ -282,15 +301,25 @@ async function addSourceContext(event: Event, contextLines: number): Promise<Eve
282
301
 
283
302
  // The promise rejections are caught in order to prevent them from short circuiting Promise.all
284
303
  await Promise.all(readlinePromises).catch(() => {
285
- DEBUG_BUILD && logger.log('Failed to read one or more source files and resolve context lines');
304
+ DEBUG_BUILD &&
305
+ logger.log(
306
+ "Failed to read one or more source files and resolve context lines",
307
+ );
286
308
  });
287
309
 
288
310
  // Perform the same loop as above, but this time we can assume all files are in the cache
289
311
  // and attempt to add source context to frames.
290
312
  if (contextLines > 0 && event.exception?.values) {
291
313
  for (const exception of event.exception.values) {
292
- if (exception.stacktrace?.frames && exception.stacktrace.frames.length > 0) {
293
- addSourceContextToFrames(exception.stacktrace.frames, contextLines, LRU_FILE_CONTENTS_CACHE);
314
+ if (
315
+ exception.stacktrace?.frames &&
316
+ exception.stacktrace.frames.length > 0
317
+ ) {
318
+ addSourceContextToFrames(
319
+ exception.stacktrace.frames,
320
+ contextLines,
321
+ LRU_FILE_CONTENTS_CACHE,
322
+ );
294
323
  }
295
324
  }
296
325
  }
@@ -307,7 +336,11 @@ function addSourceContextToFrames(
307
336
  ): void {
308
337
  for (const frame of frames) {
309
338
  // Only add context if we have a filename and it hasn't already been added
310
- if (frame.filename && frame.context_line === undefined && typeof frame.lineno === 'number') {
339
+ if (
340
+ frame.filename &&
341
+ frame.context_line === undefined &&
342
+ typeof frame.lineno === "number"
343
+ ) {
311
344
  const contents = cache.get(frame.filename);
312
345
  if (contents === undefined) {
313
346
  continue;
@@ -340,29 +373,34 @@ export function addContextToFrame(
340
373
  // When there is no line number in the frame, attaching context is nonsensical and will even break grouping.
341
374
  // We already check for lineno before calling this, but since StackFrame lineno ism optional, we check it again.
342
375
  if (frame.lineno === undefined || contents === undefined) {
343
- DEBUG_BUILD && logger.error('Cannot resolve context for frame with no lineno or file contents');
376
+ DEBUG_BUILD &&
377
+ logger.error(
378
+ "Cannot resolve context for frame with no lineno or file contents",
379
+ );
344
380
  return;
345
381
  }
346
382
 
347
383
  frame.pre_context = [];
348
384
  for (let i = makeRangeStart(lineno, contextLines); i < lineno; i++) {
349
- // We always expect the start context as line numbers cannot be negative. If we dont find a line, then
385
+ // We always expect the start context as line numbers cannot be negative. If we don't find a line, then
350
386
  // something went wrong somewhere. Clear the context and return without adding any linecontext.
351
387
  const line = contents[i];
352
388
  if (line === undefined) {
353
389
  clearLineContext(frame);
354
- DEBUG_BUILD && logger.error(`Could not find line ${i} in file ${frame.filename}`);
390
+ DEBUG_BUILD &&
391
+ logger.error(`Could not find line ${i} in file ${frame.filename}`);
355
392
  return;
356
393
  }
357
394
 
358
395
  frame.pre_context.push(line);
359
396
  }
360
397
 
361
- // We should always have the context line. If we dont, something went wrong, so we clear the context and return
398
+ // We should always have the context line. If we don't, something went wrong, so we clear the context and return
362
399
  // without adding any linecontext.
363
400
  if (contents[lineno] === undefined) {
364
401
  clearLineContext(frame);
365
- DEBUG_BUILD && logger.error(`Could not find line ${lineno} in file ${frame.filename}`);
402
+ DEBUG_BUILD &&
403
+ logger.error(`Could not find line ${lineno} in file ${frame.filename}`);
366
404
  return;
367
405
  }
368
406
 
@@ -371,7 +409,7 @@ export function addContextToFrame(
371
409
  const end = makeRangeEnd(lineno, contextLines);
372
410
  frame.post_context = [];
373
411
  for (let i = lineno + 1; i <= end; i++) {
374
- // Since we dont track when the file ends, we cant clear the context if we dont find a line as it could
412
+ // Since we don't track when the file ends, we cant clear the context if we don't find a line as it could
375
413
  // just be that we reached the end of the file.
376
414
  const line = contents[i];
377
415
  if (line === undefined) {
@@ -393,13 +431,21 @@ function makeRangeEnd(line: number, linecontext: number): number {
393
431
  return line + linecontext;
394
432
  }
395
433
  // Determine start and end indices for context range (inclusive);
396
- function makeContextRange(line: number, linecontext: number): [start: number, end: number] {
434
+ function makeContextRange(
435
+ line: number,
436
+ linecontext: number,
437
+ ): [start: number, end: number] {
397
438
  return [makeRangeStart(line, linecontext), makeRangeEnd(line, linecontext)];
398
439
  }
399
440
 
400
441
  /** Exported only for tests, as a type-safe variant. */
401
- export const _contextLinesIntegration: any = ((options: ContextLinesOptions = {}) => {
402
- const contextLines = options.frameContextLines !== undefined ? options.frameContextLines : DEFAULT_LINES_OF_CONTEXT;
442
+ export const _contextLinesIntegration: any = ((
443
+ options: ContextLinesOptions = {},
444
+ ) => {
445
+ const contextLines =
446
+ options.frameContextLines !== undefined
447
+ ? options.frameContextLines
448
+ : DEFAULT_LINES_OF_CONTEXT;
403
449
 
404
450
  return {
405
451
  name: INTEGRATION_NAME,
@@ -412,4 +458,6 @@ export const _contextLinesIntegration: any = ((options: ContextLinesOptions = {}
412
458
  /**
413
459
  * Capture the lines before and after the frame's context.
414
460
  */
415
- export const contextLinesIntegration: any = defineIntegration(_contextLinesIntegration);
461
+ export const contextLinesIntegration: any = defineIntegration(
462
+ _contextLinesIntegration,
463
+ );
@@ -18,9 +18,9 @@ import {
18
18
  } from "../../types/arguments.js";
19
19
  import {
20
20
  type EmptyTaskDefinition,
21
+ TaskDefinitionType,
21
22
  type NewTaskDefinition,
22
23
  type TaskDefinition,
23
- TaskDefinitionType,
24
24
  type TaskOverrideDefinition,
25
25
  } from "../../types/tasks.js";
26
26
 
@@ -185,6 +185,7 @@ function validatePath(
185
185
  export function validateTasksConfig(
186
186
  tasks: TaskDefinition[],
187
187
  path: Array<string | number> = [],
188
+ isPlugin: boolean = false,
188
189
  ): HardhatUserConfigValidationError[] {
189
190
  const validationErrors: HardhatUserConfigValidationError[] = [];
190
191
 
@@ -207,13 +208,13 @@ export function validateTasksConfig(
207
208
  }
208
209
  case TaskDefinitionType.NEW_TASK: {
209
210
  validationErrors.push(
210
- ...validateNewTask(task, [...path, "tasks", index]),
211
+ ...validateNewTask(task, [...path, "tasks", index], isPlugin),
211
212
  );
212
213
  break;
213
214
  }
214
215
  case TaskDefinitionType.TASK_OVERRIDE: {
215
216
  validationErrors.push(
216
- ...validateTaskOverride(task, [...path, "tasks", index]),
217
+ ...validateTaskOverride(task, [...path, "tasks", index], isPlugin),
217
218
  );
218
219
  break;
219
220
  }
@@ -252,6 +253,7 @@ export function validateEmptyTask(
252
253
  export function validateNewTask(
253
254
  task: NewTaskDefinition,
254
255
  path: Array<string | number>,
256
+ isPlugin: boolean = false,
255
257
  ): HardhatUserConfigValidationError[] {
256
258
  const validationErrors: HardhatUserConfigValidationError[] = [];
257
259
 
@@ -272,13 +274,7 @@ export function validateNewTask(
272
274
  });
273
275
  }
274
276
 
275
- if (typeof task.action !== "function") {
276
- validationErrors.push({
277
- path: [...path, "action"],
278
- message:
279
- "task action must be a lazy import function returning a module with a default export",
280
- });
281
- }
277
+ validationErrors.push(...validateActionFields(task, path, isPlugin));
282
278
 
283
279
  if (isObject(task.options)) {
284
280
  validationErrors.push(
@@ -308,6 +304,7 @@ export function validateNewTask(
308
304
  export function validateTaskOverride(
309
305
  task: TaskOverrideDefinition,
310
306
  path: Array<string | number>,
307
+ isPlugin: boolean = false,
311
308
  ): HardhatUserConfigValidationError[] {
312
309
  const validationErrors: HardhatUserConfigValidationError[] = [];
313
310
 
@@ -328,13 +325,7 @@ export function validateTaskOverride(
328
325
  });
329
326
  }
330
327
 
331
- if (typeof task.action !== "function") {
332
- validationErrors.push({
333
- path: [...path, "action"],
334
- message:
335
- "task action must be a lazy import function returning a module with a default export",
336
- });
337
- }
328
+ validationErrors.push(...validateActionFields(task, path, isPlugin));
338
329
 
339
330
  if (isObject(task.options)) {
340
331
  validationErrors.push(
@@ -350,6 +341,60 @@ export function validateTaskOverride(
350
341
  return validationErrors;
351
342
  }
352
343
 
344
+ function validateActionFields(
345
+ task: { action?: unknown; inlineAction?: unknown },
346
+ path: Array<string | number>,
347
+ isPlugin: boolean = false,
348
+ ): HardhatUserConfigValidationError[] {
349
+ const validationErrors: HardhatUserConfigValidationError[] = [];
350
+
351
+ // Mutual exclusivity: cannot have both action and inlineAction
352
+ if (task.action !== undefined && task.inlineAction !== undefined) {
353
+ validationErrors.push({
354
+ path: [...path],
355
+ message: 'task cannot define both "action" and "inlineAction"',
356
+ });
357
+ }
358
+
359
+ if (isPlugin && task.inlineAction !== undefined) {
360
+ validationErrors.push({
361
+ path: [...path, "inlineAction"],
362
+ message:
363
+ "plugins cannot use inline actions. Use a lazy action import instead",
364
+ });
365
+ }
366
+
367
+ // At least one action must be defined
368
+ if (task.action === undefined && task.inlineAction === undefined) {
369
+ validationErrors.push({
370
+ path: [...path, "action"],
371
+ message: 'task must define either "action" or "inlineAction"',
372
+ });
373
+ }
374
+
375
+ if (task.action !== undefined) {
376
+ if (typeof task.action !== "function") {
377
+ validationErrors.push({
378
+ path: [...path, "action"],
379
+ message:
380
+ "task action must be a lazy import function returning a module with a default export",
381
+ });
382
+ }
383
+ }
384
+
385
+ if (task.inlineAction !== undefined) {
386
+ if (typeof task.inlineAction !== "function") {
387
+ validationErrors.push({
388
+ path: [...path, "inlineAction"],
389
+ message:
390
+ "task inlineAction must be a function implementing the task's behavior",
391
+ });
392
+ }
393
+ }
394
+
395
+ return validationErrors;
396
+ }
397
+
353
398
  export function validateOptions(
354
399
  options: Record<string, OptionDefinition>,
355
400
  path: Array<string | number>,
@@ -665,7 +710,11 @@ export function validatePluginsConfig(
665
710
  if (plugin.tasks !== undefined) {
666
711
  if (Array.isArray(plugin.tasks)) {
667
712
  validationErrors.push(
668
- ...validateTasksConfig(plugin.tasks, [...path, "plugins", index]),
713
+ ...validateTasksConfig(
714
+ plugin.tasks,
715
+ [...path, "plugins", index],
716
+ true,
717
+ ),
669
718
  );
670
719
  } else {
671
720
  validationErrors.push({