hardhat 3.4.1 → 3.4.3

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 (292) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/src/cli.js +5 -5
  3. package/dist/src/cli.js.map +1 -1
  4. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts.map +1 -1
  5. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js +10 -3
  6. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
  7. package/dist/src/internal/builtin-plugins/console/task-action.js +4 -4
  8. package/dist/src/internal/builtin-plugins/console/task-action.js.map +1 -1
  9. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +7 -7
  10. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
  11. package/dist/src/internal/builtin-plugins/coverage/exports.d.ts +1 -1
  12. package/dist/src/internal/builtin-plugins/coverage/exports.d.ts.map +1 -1
  13. package/dist/src/internal/builtin-plugins/coverage/exports.js +1 -1
  14. package/dist/src/internal/builtin-plugins/coverage/exports.js.map +1 -1
  15. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.d.ts +7 -0
  16. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.d.ts.map +1 -0
  17. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js +24 -0
  18. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js.map +1 -0
  19. package/dist/src/internal/builtin-plugins/coverage/helpers/compat.d.ts +4 -0
  20. package/dist/src/internal/builtin-plugins/coverage/helpers/compat.d.ts.map +1 -0
  21. package/dist/src/internal/builtin-plugins/coverage/helpers/compat.js +27 -0
  22. package/dist/src/internal/builtin-plugins/coverage/helpers/compat.js.map +1 -0
  23. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/clean.js +1 -1
  24. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/clean.js.map +1 -1
  25. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.d.ts.map +1 -1
  26. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js +18 -15
  27. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/hre.js.map +1 -1
  28. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +3 -3
  29. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
  30. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js +1 -1
  31. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/test.js.map +1 -1
  32. package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts.map +1 -1
  33. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js +7 -2
  34. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js.map +1 -1
  35. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js +6 -6
  36. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js.map +1 -1
  37. package/dist/src/internal/builtin-plugins/flatten/task-action.d.ts.map +1 -1
  38. package/dist/src/internal/builtin-plugins/flatten/task-action.js +4 -4
  39. package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
  40. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts.map +1 -1
  41. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +10 -10
  42. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
  43. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -1
  44. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +12 -9
  45. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
  46. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.d.ts.map +1 -1
  47. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js +10 -4
  48. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js.map +1 -1
  49. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js +2 -2
  50. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js.map +1 -1
  51. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.d.ts.map +1 -1
  52. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js +18 -14
  53. package/dist/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.js.map +1 -1
  54. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
  55. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +11 -16
  56. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
  57. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
  58. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +5 -5
  59. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
  60. package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js +1 -1
  61. package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js.map +1 -1
  62. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts +14 -0
  63. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts.map +1 -0
  64. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js +40 -0
  65. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js.map +1 -0
  66. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts +1 -12
  67. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
  68. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +2 -41
  69. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
  70. package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.d.ts.map +1 -1
  71. package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js +2 -5
  72. package/dist/src/internal/builtin-plugins/network-manager/edr/types/hardfork.js.map +1 -1
  73. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +1 -1
  74. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
  75. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts +2 -2
  76. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts.map +1 -1
  77. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js +21 -24
  78. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js.map +1 -1
  79. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts.map +1 -1
  80. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js +13 -11
  81. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js.map +1 -1
  82. package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js +2 -2
  83. package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js.map +1 -1
  84. package/dist/src/internal/builtin-plugins/node/helpers.d.ts +2 -1
  85. package/dist/src/internal/builtin-plugins/node/helpers.d.ts.map +1 -1
  86. package/dist/src/internal/builtin-plugins/node/helpers.js +4 -4
  87. package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
  88. package/dist/src/internal/builtin-plugins/node/json-rpc/server.js +2 -2
  89. package/dist/src/internal/builtin-plugins/node/json-rpc/server.js.map +1 -1
  90. package/dist/src/internal/builtin-plugins/node/task-action.d.ts.map +1 -1
  91. package/dist/src/internal/builtin-plugins/node/task-action.js +4 -4
  92. package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
  93. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
  94. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +68 -29
  95. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
  96. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts +8 -0
  97. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts.map +1 -0
  98. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js +46 -0
  99. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js.map +1 -0
  100. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.d.ts.map +1 -1
  101. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +9 -3
  102. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js.map +1 -1
  103. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
  104. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +2 -2
  105. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
  106. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +2 -2
  107. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
  108. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.d.ts.map +1 -1
  109. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js +7 -19
  110. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js.map +1 -1
  111. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts.map +1 -1
  112. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +4 -3
  113. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
  114. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts +2 -1
  115. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts.map +1 -1
  116. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js +12 -8
  117. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js.map +1 -1
  118. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +3 -2
  119. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
  120. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +15 -6
  121. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
  122. package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
  123. package/dist/src/internal/builtin-plugins/solidity/config.js +2 -2
  124. package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
  125. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +1 -0
  126. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -1
  127. package/dist/src/internal/builtin-plugins/solidity/constants.js +2 -0
  128. package/dist/src/internal/builtin-plugins/solidity/constants.js.map +1 -1
  129. package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.d.ts.map +1 -1
  130. package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js +6 -1
  131. package/dist/src/internal/builtin-plugins/solidity/hook-handlers/hre.js.map +1 -1
  132. package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
  133. package/dist/src/internal/builtin-plugins/solidity-test/config.js +1 -0
  134. package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
  135. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +1 -2
  136. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
  137. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +3 -3
  138. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
  139. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts +2 -2
  140. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
  141. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +19 -17
  142. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
  143. package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
  144. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +6 -3
  145. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
  146. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +1 -0
  147. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
  148. package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
  149. package/dist/src/internal/builtin-plugins/test/task-action.js +9 -7
  150. package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
  151. package/dist/src/internal/cli/banner-manager.js +2 -2
  152. package/dist/src/internal/cli/banner-manager.js.map +1 -1
  153. package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
  154. package/dist/src/internal/cli/error-handler.js +6 -6
  155. package/dist/src/internal/cli/error-handler.js.map +1 -1
  156. package/dist/src/internal/cli/help/get-help-string.js +2 -2
  157. package/dist/src/internal/cli/help/get-help-string.js.map +1 -1
  158. package/dist/src/internal/cli/init/init.d.ts.map +1 -1
  159. package/dist/src/internal/cli/init/init.js +57 -36
  160. package/dist/src/internal/cli/init/init.js.map +1 -1
  161. package/dist/src/internal/cli/init/package-manager.d.ts.map +1 -1
  162. package/dist/src/internal/cli/init/package-manager.js +5 -5
  163. package/dist/src/internal/cli/init/package-manager.js.map +1 -1
  164. package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
  165. package/dist/src/internal/cli/init/prompt.js +3 -3
  166. package/dist/src/internal/cli/init/prompt.js.map +1 -1
  167. package/dist/src/internal/cli/init/template.d.ts.map +1 -1
  168. package/dist/src/internal/cli/init/template.js +5 -14
  169. package/dist/src/internal/cli/init/template.js.map +1 -1
  170. package/dist/src/internal/cli/main.d.ts.map +1 -1
  171. package/dist/src/internal/cli/main.js +2 -2
  172. package/dist/src/internal/cli/main.js.map +1 -1
  173. package/dist/src/internal/cli/node-version.d.ts +1 -1
  174. package/dist/src/internal/cli/node-version.d.ts.map +1 -1
  175. package/dist/src/internal/cli/node-version.js +17 -10
  176. package/dist/src/internal/cli/node-version.js.map +1 -1
  177. package/dist/src/internal/cli/telemetry/analytics/analytics.js +2 -2
  178. package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
  179. package/dist/src/internal/cli/telemetry/analytics/utils.js +2 -2
  180. package/dist/src/internal/cli/telemetry/analytics/utils.js.map +1 -1
  181. package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js +2 -2
  182. package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -1
  183. package/dist/src/internal/cli/telemetry/sentry/reporter.js +2 -2
  184. package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
  185. package/dist/src/internal/cli/telemetry/sentry/subprocess.js +2 -2
  186. package/dist/src/internal/cli/telemetry/sentry/subprocess.js.map +1 -1
  187. package/dist/src/internal/cli/telemetry/sentry/transport.js +2 -2
  188. package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
  189. package/dist/src/internal/cli/telemetry/telemetry-permissions.js +2 -2
  190. package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
  191. package/dist/src/internal/config-loading.js +2 -2
  192. package/dist/src/internal/config-loading.js.map +1 -1
  193. package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
  194. package/dist/src/internal/core/hook-manager.js +202 -58
  195. package/dist/src/internal/core/hook-manager.js.map +1 -1
  196. package/dist/src/internal/core/hre.js +2 -2
  197. package/dist/src/internal/core/hre.js.map +1 -1
  198. package/dist/src/internal/core/lazy-user-interruptions.d.ts +11 -0
  199. package/dist/src/internal/core/lazy-user-interruptions.d.ts.map +1 -0
  200. package/dist/src/internal/core/lazy-user-interruptions.js +39 -0
  201. package/dist/src/internal/core/lazy-user-interruptions.js.map +1 -0
  202. package/dist/src/internal/core/user-interruptions.js +4 -4
  203. package/dist/src/internal/core/user-interruptions.js.map +1 -1
  204. package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -1
  205. package/dist/src/internal/using-hardhat2-plugin-errors.js +2 -2
  206. package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -1
  207. package/package.json +6 -9
  208. package/src/cli.ts +5 -5
  209. package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +12 -5
  210. package/src/internal/builtin-plugins/console/task-action.ts +4 -4
  211. package/src/internal/builtin-plugins/coverage/coverage-manager.ts +7 -7
  212. package/src/internal/builtin-plugins/coverage/exports.ts +1 -1
  213. package/src/internal/builtin-plugins/coverage/helpers/accessors.ts +44 -0
  214. package/src/internal/builtin-plugins/coverage/helpers/compat.ts +37 -0
  215. package/src/internal/builtin-plugins/coverage/hook-handlers/clean.ts +1 -1
  216. package/src/internal/builtin-plugins/coverage/hook-handlers/hre.ts +26 -16
  217. package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +3 -3
  218. package/src/internal/builtin-plugins/coverage/hook-handlers/test.ts +1 -1
  219. package/src/internal/builtin-plugins/coverage/instrumentation.ts +21 -2
  220. package/src/internal/builtin-plugins/coverage/process-coverage.ts +6 -6
  221. package/src/internal/builtin-plugins/flatten/task-action.ts +8 -4
  222. package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +11 -10
  223. package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +13 -9
  224. package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +12 -5
  225. package/src/internal/builtin-plugins/gas-analytics/helpers/utils.ts +2 -2
  226. package/src/internal/builtin-plugins/gas-analytics/hook-handlers/hre.ts +29 -17
  227. package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +12 -15
  228. package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +11 -5
  229. package/src/internal/builtin-plugins/network-manager/config-resolution.ts +1 -1
  230. package/src/internal/builtin-plugins/network-manager/edr/edr-constants.ts +61 -0
  231. package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +2 -61
  232. package/src/internal/builtin-plugins/network-manager/edr/types/hardfork.ts +3 -9
  233. package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +1 -1
  234. package/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.ts +23 -23
  235. package/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.ts +14 -11
  236. package/src/internal/builtin-plugins/node/artifacts/build-info-watcher.ts +2 -2
  237. package/src/internal/builtin-plugins/node/helpers.ts +8 -5
  238. package/src/internal/builtin-plugins/node/json-rpc/server.ts +2 -2
  239. package/src/internal/builtin-plugins/node/task-action.ts +5 -4
  240. package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +92 -52
  241. package/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.ts +61 -0
  242. package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +17 -3
  243. package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +4 -2
  244. package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +2 -2
  245. package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts +19 -22
  246. package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +9 -1
  247. package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +16 -7
  248. package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +27 -6
  249. package/src/internal/builtin-plugins/solidity/config.ts +5 -2
  250. package/src/internal/builtin-plugins/solidity/constants.ts +3 -0
  251. package/src/internal/builtin-plugins/solidity/hook-handlers/hre.ts +13 -4
  252. package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
  253. package/src/internal/builtin-plugins/solidity-test/helpers.ts +3 -4
  254. package/src/internal/builtin-plugins/solidity-test/reporter.ts +19 -18
  255. package/src/internal/builtin-plugins/solidity-test/task-action.ts +6 -3
  256. package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
  257. package/src/internal/builtin-plugins/test/task-action.ts +13 -7
  258. package/src/internal/cli/banner-manager.ts +2 -2
  259. package/src/internal/cli/error-handler.ts +10 -6
  260. package/src/internal/cli/help/get-help-string.ts +2 -2
  261. package/src/internal/cli/init/init.ts +86 -43
  262. package/src/internal/cli/init/package-manager.ts +8 -6
  263. package/src/internal/cli/init/prompt.ts +4 -3
  264. package/src/internal/cli/init/template.ts +22 -27
  265. package/src/internal/cli/main.ts +4 -3
  266. package/src/internal/cli/node-version.ts +20 -12
  267. package/src/internal/cli/telemetry/analytics/analytics.ts +2 -2
  268. package/src/internal/cli/telemetry/analytics/utils.ts +2 -2
  269. package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +2 -2
  270. package/src/internal/cli/telemetry/sentry/reporter.ts +2 -2
  271. package/src/internal/cli/telemetry/sentry/subprocess.ts +2 -2
  272. package/src/internal/cli/telemetry/sentry/transport.ts +2 -2
  273. package/src/internal/cli/telemetry/telemetry-permissions.ts +2 -2
  274. package/src/internal/config-loading.ts +2 -2
  275. package/src/internal/core/hook-manager.ts +283 -101
  276. package/src/internal/core/hre.ts +2 -2
  277. package/src/internal/core/lazy-user-interruptions.ts +75 -0
  278. package/src/internal/core/user-interruptions.ts +4 -4
  279. package/src/internal/using-hardhat2-plugin-errors.ts +2 -2
  280. package/templates/hardhat-3/01-node-test-runner-viem/package.json +7 -7
  281. package/templates/hardhat-3/02-mocha-ethers/package.json +13 -13
  282. package/templates/hardhat-3/03-minimal/package.json +1 -1
  283. package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts +0 -15
  284. package/dist/src/internal/builtin-plugins/coverage/helpers.d.ts.map +0 -1
  285. package/dist/src/internal/builtin-plugins/coverage/helpers.js +0 -35
  286. package/dist/src/internal/builtin-plugins/coverage/helpers.js.map +0 -1
  287. package/dist/src/internal/utils/colorizer.d.ts +0 -10
  288. package/dist/src/internal/utils/colorizer.d.ts.map +0 -1
  289. package/dist/src/internal/utils/colorizer.js +0 -2
  290. package/dist/src/internal/utils/colorizer.js.map +0 -1
  291. package/src/internal/builtin-plugins/coverage/helpers.ts +0 -63
  292. package/src/internal/utils/colorizer.ts +0 -9
@@ -4,7 +4,7 @@ import type {
4
4
  Statement,
5
5
  } from "./types.js";
6
6
 
7
- import chalk from "chalk";
7
+ import { styleText } from "node:util";
8
8
 
9
9
  // Use constants for the Uint8Array to improve memory usage (1 byte vs 8 bytes per item)
10
10
  const STATUS_NOT_EXECUTED = 0; // equivalent to false
@@ -399,7 +399,7 @@ function printStatementsForDebugging(
399
399
  console.debug(counter++ + " ---");
400
400
 
401
401
  for (let i = statement.startUtf16; i < statement.endUtf16; i++) {
402
- process.stdout.write(chalk.gray(fileContent[i]));
402
+ process.stdout.write(styleText("gray", fileContent[i]));
403
403
  }
404
404
 
405
405
  console.debug();
@@ -413,7 +413,7 @@ function printStatementsForDebugging(
413
413
  console.debug(counter++ + " ---");
414
414
 
415
415
  for (let i = statement.startUtf16; i < statement.endUtf16; i++) {
416
- process.stdout.write(chalk.gray(fileContent[i]));
416
+ process.stdout.write(styleText("gray", fileContent[i]));
417
417
  }
418
418
 
419
419
  console.debug();
@@ -432,11 +432,11 @@ function printCharacterCoverageForDebugging(
432
432
  ): void {
433
433
  for (let i = 0; i < characterCoverage.length; i++) {
434
434
  if (characterCoverage[i] === STATUS_IGNORED) {
435
- process.stdout.write(chalk.gray(fileContent[i]));
435
+ process.stdout.write(styleText("gray", fileContent[i]));
436
436
  } else if (characterCoverage[i] === STATUS_EXECUTED) {
437
- process.stdout.write(chalk.green(fileContent[i]));
437
+ process.stdout.write(styleText("green", fileContent[i]));
438
438
  } else {
439
- process.stdout.write(chalk.red(fileContent[i]));
439
+ process.stdout.write(styleText("red", fileContent[i]));
440
440
  }
441
441
  }
442
442
  }
@@ -1,7 +1,8 @@
1
1
  import type { NewTaskActionFunction } from "../../../types/tasks.js";
2
2
 
3
+ import { styleText } from "node:util";
4
+
3
5
  import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
4
- import chalk from "chalk";
5
6
 
6
7
  import {
7
8
  ResolvedFileType,
@@ -108,7 +109,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
108
109
 
109
110
  if (filesWithoutLicenses.length > 0) {
110
111
  warn(
111
- chalk.yellow(
112
+ styleText(
113
+ "yellow",
112
114
  `\nThe following file(s) do NOT specify SPDX licenses: ${filesWithoutLicenses.join(
113
115
  ", ",
114
116
  )}`,
@@ -118,7 +120,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
118
120
 
119
121
  if (pragmaDirective !== "" && filesWithoutPragmaDirectives.length > 0) {
120
122
  warn(
121
- chalk.yellow(
123
+ styleText(
124
+ "yellow",
122
125
  `\nPragma abicoder directives are defined in some files, but they are not defined in the following ones: ${filesWithoutPragmaDirectives.join(
123
126
  ", ",
124
127
  )}`,
@@ -128,7 +131,8 @@ const flattenAction: NewTaskActionFunction<FlattenActionArguments> = async (
128
131
 
129
132
  if (filesWithDifferentPragmaDirectives.length > 0) {
130
133
  warn(
131
- chalk.yellow(
134
+ styleText(
135
+ "yellow",
132
136
  `\nThe flattened file is using the pragma abicoder directive '${pragmaDirective}' but these files have a different pragma abicoder directive: ${filesWithDifferentPragmaDirectives.join(
133
137
  ", ",
134
138
  )}`,
@@ -1,6 +1,7 @@
1
1
  import type { SuiteResult } from "@nomicfoundation/edr";
2
2
 
3
3
  import path from "node:path";
4
+ import { styleText } from "node:util";
4
5
 
5
6
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
6
7
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
@@ -10,7 +11,6 @@ import {
10
11
  writeUtf8File,
11
12
  } from "@nomicfoundation/hardhat-utils/fs";
12
13
  import { findDuplicates } from "@nomicfoundation/hardhat-utils/lang";
13
- import chalk from "chalk";
14
14
 
15
15
  import {
16
16
  getFullyQualifiedName,
@@ -388,7 +388,8 @@ export function logFunctionGasSnapshotsSection(
388
388
  if (isFirstTimeWrite) {
389
389
  logger();
390
390
  logger(
391
- chalk.green(
391
+ styleText(
392
+ "green",
392
393
  " No existing snapshots found. Function gas snapshots written successfully",
393
394
  ),
394
395
  );
@@ -408,7 +409,7 @@ export function logFunctionGasSnapshotsSection(
408
409
  "\n",
409
410
  );
410
411
  for (const line of addedLines) {
411
- logger(chalk.green(` + ${line}`));
412
+ logger(styleText("green", ` + ${line}`));
412
413
  }
413
414
  }
414
415
 
@@ -419,7 +420,7 @@ export function logFunctionGasSnapshotsSection(
419
420
  comparison.removed,
420
421
  ).split("\n");
421
422
  for (const line of removedLines) {
422
- logger(chalk.red(` - ${line}`));
423
+ logger(styleText("red", ` - ${line}`));
423
424
  }
424
425
  }
425
426
 
@@ -435,10 +436,10 @@ export function printFunctionGasSnapshotChanges(
435
436
  const isLast = i === changes.length - 1;
436
437
 
437
438
  logger(` ${change.contractNameOrFqn}#${change.functionSig}`);
438
- logger(chalk.grey(` (in ${change.source})`));
439
+ logger(styleText("grey", ` (in ${change.source})`));
439
440
 
440
441
  if (change.kind === "fuzz") {
441
- logger(chalk.grey(` Runs: ${change.runs}`));
442
+ logger(styleText("grey", ` Runs: ${change.runs}`));
442
443
  }
443
444
 
444
445
  const diff = change.actual - change.expected;
@@ -454,15 +455,15 @@ export function printFunctionGasSnapshotChanges(
454
455
 
455
456
  // Color: green for decrease (improvement), red for increase (regression)
456
457
  const formattedGasChange =
457
- diff < 0 ? chalk.green(gasChange) : chalk.red(gasChange);
458
+ diff < 0 ? styleText("green", gasChange) : styleText("red", gasChange);
458
459
 
459
460
  const label = change.kind === "fuzz" ? "~" : "gas";
460
461
 
461
- logger(chalk.grey(` Expected (${label}): ${change.expected}`));
462
+ logger(styleText("grey", ` Expected (${label}): ${change.expected}`));
462
463
  logger(
463
- chalk.grey(` Actual (${label}): ${change.actual} (`) +
464
+ styleText("grey", ` Actual (${label}): ${change.actual} (`) +
464
465
  formattedGasChange +
465
- chalk.grey(")"),
466
+ styleText("grey", ")"),
466
467
  );
467
468
 
468
469
  if (!isLast) {
@@ -10,11 +10,13 @@ import type { TableItem } from "@nomicfoundation/hardhat-utils/format";
10
10
 
11
11
  import crypto from "node:crypto";
12
12
  import path from "node:path";
13
+ import { styleText } from "node:util";
13
14
 
14
15
  import {
15
16
  HardhatError,
16
17
  assertHardhatInvariant,
17
18
  } from "@nomicfoundation/hardhat-errors";
19
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
18
20
  import { formatTable } from "@nomicfoundation/hardhat-utils/format";
19
21
  import {
20
22
  ensureDir,
@@ -26,8 +28,6 @@ import {
26
28
  writeJsonFile,
27
29
  } from "@nomicfoundation/hardhat-utils/fs";
28
30
  import { findDuplicates } from "@nomicfoundation/hardhat-utils/lang";
29
- import chalk from "chalk";
30
- import debug from "debug";
31
31
 
32
32
  import { parseFullyQualifiedName } from "../../../utils/contract-names.js";
33
33
 
@@ -41,7 +41,7 @@ import {
41
41
  median,
42
42
  } from "./helpers/utils.js";
43
43
 
44
- const gasStatsLog = debug(
44
+ const gasStatsLog = createDebug(
45
45
  "hardhat:core:gas-analytics:gas-analytics-manager:gas-stats",
46
46
  );
47
47
 
@@ -311,7 +311,10 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
311
311
  const rows: TableItem[] = [];
312
312
 
313
313
  if (gasStatsByContract.size > 0) {
314
- rows.push({ type: "title", text: chalk.bold("Gas Usage Statistics") });
314
+ rows.push({
315
+ type: "title",
316
+ text: styleText("bold", "Gas Usage Statistics"),
317
+ });
315
318
  }
316
319
 
317
320
  const sortedContracts = getSortedContractEntries(gasStatsByContract);
@@ -322,8 +325,9 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
322
325
  } of sortedContracts) {
323
326
  rows.push({
324
327
  type: "section-header",
325
- text: chalk.cyan.bold(userFqn),
326
- subtitle: proxyLabel !== undefined ? chalk.cyan(proxyLabel) : undefined,
328
+ text: styleText(["cyan", "bold"], userFqn),
329
+ subtitle:
330
+ proxyLabel !== undefined ? styleText("cyan", proxyLabel) : undefined,
327
331
  });
328
332
 
329
333
  if (contractGasStats.functions.size > 0) {
@@ -336,7 +340,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
336
340
  "Median",
337
341
  "Max",
338
342
  "#calls",
339
- ].map((s) => chalk.yellow(s)),
343
+ ].map((s) => styleText("yellow", s)),
340
344
  });
341
345
  }
342
346
 
@@ -372,7 +376,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
372
376
  "Median",
373
377
  "Max",
374
378
  "#deployments",
375
- ].map((s) => chalk.yellow(s)),
379
+ ].map((s) => styleText("yellow", s)),
376
380
  });
377
381
  rows.push({
378
382
  type: "row",
@@ -388,7 +392,7 @@ export class GasAnalyticsManagerImplementation implements GasAnalyticsManager {
388
392
  rows.push({
389
393
  type: "header",
390
394
  cells: [
391
- chalk.yellow("Bytecode size"),
395
+ styleText("yellow", "Bytecode size"),
392
396
  `${contractGasStats.deployment.runtimeSize}`,
393
397
  ],
394
398
  });
@@ -1,3 +1,12 @@
1
+ // NOTE: This file is imported from hot paths — the plugin's `created` hook
2
+ // handler and task-actions that may run on every `hardhat test` invocation
3
+ // regardless of whether the feature is enabled. It must stay lightweight:
4
+ // do not add top-level imports that pull in the gas-analytics-manager module
5
+ // graph (debug, node:crypto, file-system traversal, etc.), or the
6
+ // `--gas-stats` lazy-load is silently defeated for every caller.
7
+ // If a new helper needs a heavy dependency, put it in a sibling file
8
+ // (e.g. `helpers/utils.ts`) so the accessors file's import cost stays flat.
9
+
1
10
  import type { HookContext } from "../../../../types/hooks.js";
2
11
  import type { HardhatRuntimeEnvironment } from "../../../../types/hre.js";
3
12
  import type { GasAnalyticsManager } from "../types.js";
@@ -5,16 +14,14 @@ import type { GasAnalyticsManager } from "../types.js";
5
14
  import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
6
15
 
7
16
  import { HardhatRuntimeEnvironmentImplementation } from "../../../core/hre.js";
8
- import { GasAnalyticsManagerImplementation } from "../gas-analytics-manager.js";
9
17
 
10
18
  export function getGasAnalyticsManager(
11
19
  hookContextOrHre: HookContext | HardhatRuntimeEnvironment,
12
20
  ): GasAnalyticsManager {
13
21
  assertHardhatInvariant(
14
- "_gasAnalytics" in hookContextOrHre &&
15
- hookContextOrHre._gasAnalytics instanceof
16
- GasAnalyticsManagerImplementation,
17
- "Expected _gasAnalytics to be an instance of GasAnalyticsManagerImplementation",
22
+ hookContextOrHre instanceof HardhatRuntimeEnvironmentImplementation &&
23
+ hookContextOrHre._gasAnalytics !== undefined,
24
+ "Expected _gasAnalytics to be installed on the HRE",
18
25
  );
19
26
  return hookContextOrHre._gasAnalytics;
20
27
  }
@@ -1,4 +1,4 @@
1
- import chalk from "chalk";
1
+ import { styleText } from "node:util";
2
2
 
3
3
  /**
4
4
  * Converts an internal FQN (e.g. `"project/contracts/Foo.sol:Foo"` or
@@ -108,5 +108,5 @@ export function formatSectionHeader(
108
108
  parts.push(`${removedLength} removed`);
109
109
  }
110
110
 
111
- return `${sectionName}: ${chalk.gray(parts.join(", "))}`;
111
+ return `${sectionName}: ${styleText("gray", parts.join(", "))}`;
112
112
  }
@@ -1,29 +1,41 @@
1
1
  import type { HardhatRuntimeEnvironmentHooks } from "../../../../types/hooks.js";
2
+ import type { GasAnalyticsManagerImplementation as GasAnalyticsManagerImplementationT } from "../gas-analytics-manager.js";
2
3
 
3
- import { GasAnalyticsManagerImplementation } from "../gas-analytics-manager.js";
4
4
  import { setGasAnalyticsManager } from "../helpers/accessors.js";
5
5
 
6
+ let GasAnalyticsManagerImplementation:
7
+ | typeof GasAnalyticsManagerImplementationT
8
+ | undefined;
9
+
6
10
  export default async (): Promise<Partial<HardhatRuntimeEnvironmentHooks>> => ({
7
11
  created: async (context, hre) => {
8
12
  if (
9
- context.globalOptions.gasStats ||
10
- context.globalOptions.gasStatsJson !== undefined
13
+ !context.globalOptions.gasStats &&
14
+ context.globalOptions.gasStatsJson === undefined
11
15
  ) {
12
- const gasAnalyticsManager = new GasAnalyticsManagerImplementation(
13
- hre.config.paths.cache,
14
- );
15
-
16
- setGasAnalyticsManager(hre, gasAnalyticsManager);
16
+ return;
17
+ }
17
18
 
18
- // NOTE: We register this hook dynamically to avoid a circular dependency
19
- // between gas-analytics and network-manager plugins. The network-manager
20
- // checks for the existence of onGasReported handlers to determine if gas
21
- // analytics is enabled, rather than directly checking the global option.
22
- hre.hooks.registerHandlers("network", {
23
- onGasMeasurement: (_context, gasMeasurement) => {
24
- gasAnalyticsManager.addGasMeasurement(gasMeasurement);
25
- },
26
- });
19
+ if (GasAnalyticsManagerImplementation === undefined) {
20
+ ({ GasAnalyticsManagerImplementation } = await import(
21
+ "../gas-analytics-manager.js"
22
+ ));
27
23
  }
24
+
25
+ const gasAnalyticsManager = new GasAnalyticsManagerImplementation(
26
+ hre.config.paths.cache,
27
+ );
28
+
29
+ setGasAnalyticsManager(hre, gasAnalyticsManager);
30
+
31
+ // NOTE: We register this hook dynamically to avoid a circular dependency
32
+ // between gas-analytics and network-manager plugins. The network-manager
33
+ // checks for the existence of onGasReported handlers to determine if gas
34
+ // analytics is enabled, rather than directly checking the global option.
35
+ hre.hooks.registerHandlers("network", {
36
+ onGasMeasurement: (_context, gasMeasurement) => {
37
+ gasAnalyticsManager.addGasMeasurement(gasMeasurement);
38
+ },
39
+ });
28
40
  },
29
41
  });
@@ -1,17 +1,18 @@
1
1
  import type { SuiteResult } from "@nomicfoundation/edr";
2
2
 
3
3
  import path from "node:path";
4
+ import { styleText } from "node:util";
4
5
 
5
6
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
6
7
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
7
8
  import {
8
9
  FileNotFoundError,
9
10
  readdir,
11
+ readdirOrEmpty,
10
12
  readJsonFile,
11
13
  remove,
12
14
  writeJsonFile,
13
15
  } from "@nomicfoundation/hardhat-utils/fs";
14
- import chalk from "chalk";
15
16
 
16
17
  import {
17
18
  getFullyQualifiedName,
@@ -116,9 +117,8 @@ async function deleteOrphanedSnapshotFiles(
116
117
  snapshotsDir: string,
117
118
  currentGroups: Set<string>,
118
119
  ): Promise<void> {
119
- let dirEntries: string[];
120
120
  try {
121
- dirEntries = await readdir(snapshotsDir);
121
+ const dirEntries = await readdirOrEmpty(snapshotsDir);
122
122
 
123
123
  for (const entry of dirEntries) {
124
124
  if (entry.endsWith(".json")) {
@@ -131,10 +131,6 @@ async function deleteOrphanedSnapshotFiles(
131
131
  }
132
132
  } catch (error) {
133
133
  ensureError(error);
134
- // Directory doesn't exist yet, nothing to clean up
135
- if (error instanceof FileNotFoundError) {
136
- return;
137
- }
138
134
  throw new HardhatError(
139
135
  HardhatError.ERRORS.CORE.SOLIDITY_TESTS.SNAPSHOT_WRITE_ERROR,
140
136
  { snapshotsPath: snapshotsDir, error: error.message },
@@ -375,7 +371,8 @@ export function logSnapshotCheatcodesSection(
375
371
  if (isFirstTimeWrite) {
376
372
  logger();
377
373
  logger(
378
- chalk.green(
374
+ styleText(
375
+ "green",
379
376
  " No existing snapshots found. Snapshot cheatcodes written successfully",
380
377
  ),
381
378
  );
@@ -395,7 +392,7 @@ export function logSnapshotCheatcodesSection(
395
392
  "\n",
396
393
  );
397
394
  for (const line of addedLines) {
398
- logger(chalk.green(` + ${line}`));
395
+ logger(styleText("green", ` + ${line}`));
399
396
  }
400
397
  }
401
398
 
@@ -406,7 +403,7 @@ export function logSnapshotCheatcodesSection(
406
403
  "\n",
407
404
  );
408
405
  for (const line of removedLines) {
409
- logger(chalk.red(` - ${line}`));
406
+ logger(styleText("red", ` - ${line}`));
410
407
  }
411
408
  }
412
409
 
@@ -422,7 +419,7 @@ export function printSnapshotCheatcodeChanges(
422
419
  const isLast = i === changes.length - 1;
423
420
 
424
421
  logger(` ${change.group}#${change.name}`);
425
- logger(chalk.grey(` (in ${change.source})`));
422
+ logger(styleText("grey", ` (in ${change.source})`));
426
423
 
427
424
  const diff = change.actual - change.expected;
428
425
  const formattedDiff = diff > 0 ? `Δ+${diff}` : `Δ${diff}`;
@@ -437,13 +434,13 @@ export function printSnapshotCheatcodeChanges(
437
434
 
438
435
  // Color: green for decrease (improvement), red for increase (regression)
439
436
  const formattedGasChange =
440
- diff < 0 ? chalk.green(gasChange) : chalk.red(gasChange);
437
+ diff < 0 ? styleText("green", gasChange) : styleText("red", gasChange);
441
438
 
442
- logger(chalk.grey(` Expected: ${change.expected}`));
439
+ logger(styleText("grey", ` Expected: ${change.expected}`));
443
440
  logger(
444
- chalk.grey(` Actual: ${change.actual} (`) +
441
+ styleText("grey", ` Actual: ${change.actual} (`) +
445
442
  formattedGasChange +
446
- chalk.grey(")"),
443
+ styleText("grey", ")"),
447
444
  );
448
445
 
449
446
  if (!isLast) {
@@ -5,8 +5,9 @@ import type { FunctionGasSnapshotCheckResult } from "../../function-gas-snapshot
5
5
  import type { SnapshotCheatcodesCheckResult } from "../../snapshot-cheatcodes.js";
6
6
  import type { SuiteResult } from "@nomicfoundation/edr";
7
7
 
8
+ import { styleText } from "node:util";
9
+
8
10
  import { HardhatError } from "@nomicfoundation/hardhat-errors";
9
- import chalk from "chalk";
10
11
 
11
12
  import { errorResult } from "../../../../../utils/result.js";
12
13
  import {
@@ -103,7 +104,7 @@ export function logSnapshotResult(
103
104
  logger: typeof console.log = console.log,
104
105
  ): void {
105
106
  if (result.functionGasSnapshotsWritten) {
106
- logger(chalk.green("Function gas snapshots written successfully"));
107
+ logger(styleText("green", "Function gas snapshots written successfully"));
107
108
  logger();
108
109
  }
109
110
  }
@@ -133,8 +134,8 @@ export function logSnapshotCheckResult(
133
134
  ): void {
134
135
  logger(
135
136
  functionGasSnapshotsCheck.passed && snapshotCheatcodesCheck.passed
136
- ? chalk.green("Snapshot check passed")
137
- : chalk.red("Snapshot check failed"),
137
+ ? styleText("green", "Snapshot check passed")
138
+ : styleText("red", "Snapshot check failed"),
138
139
  );
139
140
 
140
141
  const functionGasHasOutput =
@@ -164,7 +165,12 @@ export function logSnapshotCheckResult(
164
165
  logSnapshotCheatcodesSection(snapshotCheatcodesCheck, logger);
165
166
 
166
167
  if (!functionGasSnapshotsCheck.passed || !snapshotCheatcodesCheck.passed) {
167
- logger(chalk.yellow("To update snapshots, run your tests with --snapshot"));
168
+ logger(
169
+ styleText(
170
+ "yellow",
171
+ "To update snapshots, run your tests with --snapshot",
172
+ ),
173
+ );
168
174
  logger();
169
175
  }
170
176
  }
@@ -36,7 +36,7 @@ import { DEFAULT_CHAIN_DESCRIPTORS } from "./chain-descriptors.js";
36
36
  import {
37
37
  DEFAULT_EDR_NETWORK_HD_ACCOUNTS_CONFIG_PARAMS,
38
38
  EDR_NETWORK_DEFAULT_COINBASE,
39
- } from "./edr/edr-provider.js";
39
+ } from "./edr/edr-constants.js";
40
40
  import { getCurrentHardfork } from "./edr/types/hardfork.js";
41
41
  import { isHttpNetworkHdAccountsUserConfig } from "./type-validation.js";
42
42
 
@@ -0,0 +1,61 @@
1
+ import type { EdrNetworkHDAccountsConfig } from "../../../../types/config.js";
2
+ import type { DefaultHDAccountsConfigParams } from "../accounts/constants.js";
3
+
4
+ import { deepEqual } from "@nomicfoundation/hardhat-utils/lang";
5
+
6
+ import { DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS } from "../accounts/constants.js";
7
+
8
+ export const EDR_NETWORK_DEFAULT_COINBASE =
9
+ "0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e";
10
+
11
+ interface EdrNetworkDefaultHDAccountsConfigParams
12
+ extends DefaultHDAccountsConfigParams {
13
+ mnemonic: string;
14
+ accountsBalance: bigint;
15
+ }
16
+
17
+ export const EDR_NETWORK_MNEMONIC =
18
+ "test test test test test test test test test test test junk";
19
+ export const DEFAULT_EDR_NETWORK_BALANCE = 10000000000000000000000n;
20
+ export const DEFAULT_EDR_NETWORK_HD_ACCOUNTS_CONFIG_PARAMS: EdrNetworkDefaultHDAccountsConfigParams =
21
+ {
22
+ ...DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS,
23
+ mnemonic: EDR_NETWORK_MNEMONIC,
24
+ accountsBalance: DEFAULT_EDR_NETWORK_BALANCE,
25
+ };
26
+
27
+ export async function isDefaultEdrNetworkHDAccountsConfig(
28
+ accounts: EdrNetworkHDAccountsConfig,
29
+ ): Promise<boolean> {
30
+ return await deepEqual(
31
+ {
32
+ ...accounts,
33
+ mnemonic: await accounts.mnemonic.get(),
34
+ passphrase: await accounts.passphrase.get(),
35
+ },
36
+ DEFAULT_EDR_NETWORK_HD_ACCOUNTS_CONFIG_PARAMS,
37
+ );
38
+ }
39
+
40
+ export const EDR_NETWORK_DEFAULT_PRIVATE_KEYS: string[] = [
41
+ "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
42
+ "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
43
+ "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a",
44
+ "0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6",
45
+ "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
46
+ "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
47
+ "0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e",
48
+ "0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356",
49
+ "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97",
50
+ "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6",
51
+ "0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897",
52
+ "0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82",
53
+ "0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1",
54
+ "0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd",
55
+ "0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa",
56
+ "0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61",
57
+ "0xea6c44ac03bff858b476bba40716402b03e41b8e97e276d1baec7c37d42484a0",
58
+ "0x689af8efa8c651a91ad287602527f3af2fe9f6501a7ac4b061667b5a93e037fd",
59
+ "0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0",
60
+ "0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e",
61
+ ];
@@ -3,7 +3,6 @@ import type { LoggerConfig } from "./types/logger.js";
3
3
  import type {
4
4
  ChainDescriptorsConfig,
5
5
  EdrNetworkConfig,
6
- EdrNetworkHDAccountsConfig,
7
6
  } from "../../../../types/config.js";
8
7
  import type {
9
8
  EthSubscription,
@@ -13,7 +12,6 @@ import type {
13
12
  SuccessfulJsonRpcResponse,
14
13
  } from "../../../../types/providers.js";
15
14
  import type { RequireField } from "../../../../types/utils.js";
16
- import type { DefaultHDAccountsConfigParams } from "../accounts/constants.js";
17
15
  import type { JsonRpcRequestWrapperFunction } from "../network-manager.js";
18
16
  import type { TraceOutputManager } from "./utils/trace-output.js";
19
17
  import type {
@@ -31,16 +29,14 @@ import {
31
29
  HardhatError,
32
30
  } from "@nomicfoundation/hardhat-errors";
33
31
  import { toSeconds } from "@nomicfoundation/hardhat-utils/date";
32
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
34
33
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
35
34
  import { numberToHexString } from "@nomicfoundation/hardhat-utils/hex";
36
- import { deepEqual } from "@nomicfoundation/hardhat-utils/lang";
37
- import debug from "debug";
38
35
 
39
36
  import { sendErrorTelemetry } from "../../../cli/telemetry/error-reporter/reporter.js";
40
37
  import { EDR_NETWORK_REVERT_SNAPSHOT_EVENT } from "../../../constants.js";
41
38
  import { hardhatChainTypeToEdrChainType } from "../../../edr/chain-type.js";
42
39
  import { getGlobalEdrContext } from "../../../edr/context.js";
43
- import { DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS } from "../accounts/constants.js";
44
40
  import { BaseProvider } from "../base-provider.js";
45
41
  import { getJsonRpcRequest, isFailedJsonRpcResponse } from "../json-rpc.js";
46
42
  import {
@@ -63,62 +59,7 @@ import {
63
59
  } from "./utils/convert-to-edr.js";
64
60
  import { printLine, replaceLastLine } from "./utils/logger.js";
65
61
 
66
- const log = debug("hardhat:core:hardhat-network:provider");
67
-
68
- export const EDR_NETWORK_DEFAULT_COINBASE =
69
- "0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e";
70
-
71
- interface EdrNetworkDefaultHDAccountsConfigParams
72
- extends DefaultHDAccountsConfigParams {
73
- mnemonic: string;
74
- accountsBalance: bigint;
75
- }
76
-
77
- export const EDR_NETWORK_MNEMONIC =
78
- "test test test test test test test test test test test junk";
79
- export const DEFAULT_EDR_NETWORK_BALANCE = 10000000000000000000000n;
80
- export const DEFAULT_EDR_NETWORK_HD_ACCOUNTS_CONFIG_PARAMS: EdrNetworkDefaultHDAccountsConfigParams =
81
- {
82
- ...DEFAULT_HD_ACCOUNTS_CONFIG_PARAMS,
83
- mnemonic: EDR_NETWORK_MNEMONIC,
84
- accountsBalance: DEFAULT_EDR_NETWORK_BALANCE,
85
- };
86
-
87
- export async function isDefaultEdrNetworkHDAccountsConfig(
88
- accounts: EdrNetworkHDAccountsConfig,
89
- ): Promise<boolean> {
90
- return await deepEqual(
91
- {
92
- ...accounts,
93
- mnemonic: await accounts.mnemonic.get(),
94
- passphrase: await accounts.passphrase.get(),
95
- },
96
- DEFAULT_EDR_NETWORK_HD_ACCOUNTS_CONFIG_PARAMS,
97
- );
98
- }
99
-
100
- export const EDR_NETWORK_DEFAULT_PRIVATE_KEYS: string[] = [
101
- "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
102
- "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
103
- "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a",
104
- "0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6",
105
- "0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
106
- "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba",
107
- "0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e",
108
- "0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356",
109
- "0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97",
110
- "0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6",
111
- "0xf214f2b2cd398c806f84e317254e0f0b801d0643303237d97a22a48e01628897",
112
- "0x701b615bbdfb9de65240bc28bd21bbc0d996645a3dd57e7b12bc2bdf6f192c82",
113
- "0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1",
114
- "0x47c99abed3324a2707c28affff1267e45918ec8c3f20b8aa892e8b065d2942dd",
115
- "0xc526ee95bf44d8fc405a158bb884d9d1238d99f0612e9f33d006bb0789009aaa",
116
- "0x8166f546bab6da521a8369cab06c5d2b9e46670292d85c875ee9ec20e84ffb61",
117
- "0xea6c44ac03bff858b476bba40716402b03e41b8e97e276d1baec7c37d42484a0",
118
- "0x689af8efa8c651a91ad287602527f3af2fe9f6501a7ac4b061667b5a93e037fd",
119
- "0xde9be858da4a475276426320d5e9262ecfc3ba460bfac56360bfa6c4c28b4ee0",
120
- "0xdf57089febbacf7ba0bc227dafbffa9fc08a93fdc68e1e42411a14efcf23656e",
121
- ];
62
+ const log = createDebug("hardhat:core:network-manager:edr:provider");
122
63
 
123
64
  interface EdrProviderConfig {
124
65
  chainDescriptors: ChainDescriptorsConfig;