hardhat 3.4.4 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/dist/src/config.d.ts +0 -1
  3. package/dist/src/config.d.ts.map +1 -1
  4. package/dist/src/config.js +0 -3
  5. package/dist/src/config.js.map +1 -1
  6. package/dist/src/hre.d.ts +0 -1
  7. package/dist/src/hre.d.ts.map +1 -1
  8. package/dist/src/hre.js +0 -3
  9. package/dist/src/hre.js.map +1 -1
  10. package/dist/src/index.d.ts +0 -1
  11. package/dist/src/index.d.ts.map +1 -1
  12. package/dist/src/index.js +0 -3
  13. package/dist/src/index.js.map +1 -1
  14. package/dist/src/internal/builtin-global-options.d.ts.map +1 -1
  15. package/dist/src/internal/builtin-global-options.js +1 -1
  16. package/dist/src/internal/builtin-global-options.js.map +1 -1
  17. package/dist/src/internal/builtin-plugins/artifacts/index.d.ts +1 -1
  18. package/dist/src/internal/builtin-plugins/artifacts/index.d.ts.map +1 -1
  19. package/dist/src/internal/builtin-plugins/artifacts/index.js +0 -1
  20. package/dist/src/internal/builtin-plugins/artifacts/index.js.map +1 -1
  21. package/dist/src/internal/builtin-plugins/clean/index.d.ts +1 -1
  22. package/dist/src/internal/builtin-plugins/clean/index.d.ts.map +1 -1
  23. package/dist/src/internal/builtin-plugins/clean/index.js +0 -1
  24. package/dist/src/internal/builtin-plugins/clean/index.js.map +1 -1
  25. package/dist/src/internal/builtin-plugins/clean/type-extensions.d.ts +1 -1
  26. package/dist/src/internal/builtin-plugins/clean/type-extensions.d.ts.map +1 -1
  27. package/dist/src/internal/builtin-plugins/clean/type-extensions.js +1 -1
  28. package/dist/src/internal/builtin-plugins/clean/type-extensions.js.map +1 -1
  29. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.d.ts.map +1 -1
  30. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +7 -10
  31. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
  32. package/dist/src/internal/builtin-plugins/coverage/index.d.ts +1 -1
  33. package/dist/src/internal/builtin-plugins/coverage/index.d.ts.map +1 -1
  34. package/dist/src/internal/builtin-plugins/coverage/index.js +0 -1
  35. package/dist/src/internal/builtin-plugins/coverage/index.js.map +1 -1
  36. package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts +1 -4
  37. package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts.map +1 -1
  38. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js +2 -4
  39. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js.map +1 -1
  40. package/dist/src/internal/builtin-plugins/coverage/type-extensions.d.ts +1 -1
  41. package/dist/src/internal/builtin-plugins/coverage/type-extensions.d.ts.map +1 -1
  42. package/dist/src/internal/builtin-plugins/coverage/type-extensions.js +1 -1
  43. package/dist/src/internal/builtin-plugins/coverage/type-extensions.js.map +1 -1
  44. package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts +1 -1
  45. package/dist/src/internal/builtin-plugins/gas-analytics/index.d.ts.map +1 -1
  46. package/dist/src/internal/builtin-plugins/gas-analytics/index.js +0 -1
  47. package/dist/src/internal/builtin-plugins/gas-analytics/index.js.map +1 -1
  48. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts +21 -0
  49. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
  50. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +49 -1
  51. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
  52. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts +2 -1
  53. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
  54. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +12 -2
  55. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
  56. package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts +1 -1
  57. package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.d.ts.map +1 -1
  58. package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.js +1 -1
  59. package/dist/src/internal/builtin-plugins/gas-analytics/type-extensions.js.map +1 -1
  60. package/dist/src/internal/builtin-plugins/index.d.ts +8 -8
  61. package/dist/src/internal/builtin-plugins/index.d.ts.map +1 -1
  62. package/dist/src/internal/builtin-plugins/network-manager/config-resolution.d.ts.map +1 -1
  63. package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js +9 -2
  64. package/dist/src/internal/builtin-plugins/network-manager/config-resolution.js.map +1 -1
  65. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts +1 -0
  66. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.d.ts.map +1 -1
  67. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js +1 -0
  68. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-constants.js.map +1 -1
  69. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.d.ts.map +1 -1
  70. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +25 -5
  71. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
  72. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.d.ts.map +1 -1
  73. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.js +7 -6
  74. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.js.map +1 -1
  75. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts +16 -0
  76. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.d.ts.map +1 -1
  77. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js +28 -1
  78. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.js.map +1 -1
  79. package/dist/src/internal/builtin-plugins/network-manager/index.d.ts +4 -4
  80. package/dist/src/internal/builtin-plugins/network-manager/index.d.ts.map +1 -1
  81. package/dist/src/internal/builtin-plugins/network-manager/index.js +0 -4
  82. package/dist/src/internal/builtin-plugins/network-manager/index.js.map +1 -1
  83. package/dist/src/internal/builtin-plugins/network-manager/network-manager.d.ts.map +1 -1
  84. package/dist/src/internal/builtin-plugins/network-manager/network-manager.js +2 -6
  85. package/dist/src/internal/builtin-plugins/network-manager/network-manager.js.map +1 -1
  86. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts +5 -4
  87. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.d.ts.map +1 -1
  88. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.js +1 -1
  89. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/config.js.map +1 -1
  90. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/global-options.d.ts +1 -1
  91. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/global-options.d.ts.map +1 -1
  92. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/global-options.js +1 -1
  93. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/global-options.js.map +1 -1
  94. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.d.ts +0 -1
  95. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.d.ts.map +1 -1
  96. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.js +1 -1
  97. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hooks.js.map +1 -1
  98. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hre.d.ts +0 -1
  99. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hre.d.ts.map +1 -1
  100. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hre.js +1 -1
  101. package/dist/src/internal/builtin-plugins/network-manager/type-extensions/hre.js.map +1 -1
  102. package/dist/src/internal/builtin-plugins/network-manager/type-validation.d.ts.map +1 -1
  103. package/dist/src/internal/builtin-plugins/network-manager/type-validation.js +3 -1
  104. package/dist/src/internal/builtin-plugins/network-manager/type-validation.js.map +1 -1
  105. package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.d.ts +18 -0
  106. package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.d.ts.map +1 -0
  107. package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.js +27 -0
  108. package/dist/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.js.map +1 -0
  109. package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js +6 -5
  110. package/dist/src/internal/builtin-plugins/node/json-rpc/handler.js.map +1 -1
  111. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
  112. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +22 -9
  113. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
  114. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.d.ts.map +1 -1
  115. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js +7 -1
  116. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.js.map +1 -1
  117. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +10 -0
  118. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -1
  119. package/dist/src/internal/builtin-plugins/solidity/constants.js +10 -0
  120. package/dist/src/internal/builtin-plugins/solidity/constants.js.map +1 -1
  121. package/dist/src/internal/builtin-plugins/solidity/index.d.ts +1 -1
  122. package/dist/src/internal/builtin-plugins/solidity/index.d.ts.map +1 -1
  123. package/dist/src/internal/builtin-plugins/solidity/index.js +1 -1
  124. package/dist/src/internal/builtin-plugins/solidity/index.js.map +1 -1
  125. package/dist/src/internal/builtin-plugins/solidity/tasks/compile.d.ts +9 -0
  126. package/dist/src/internal/builtin-plugins/solidity/tasks/compile.d.ts.map +1 -0
  127. package/dist/src/internal/builtin-plugins/solidity/tasks/compile.js +10 -0
  128. package/dist/src/internal/builtin-plugins/solidity/tasks/compile.js.map +1 -0
  129. package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +0 -4
  130. package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.map +1 -1
  131. package/dist/src/internal/builtin-plugins/solidity/type-extensions.js +1 -4
  132. package/dist/src/internal/builtin-plugins/solidity/type-extensions.js.map +1 -1
  133. package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts +4 -3
  134. package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
  135. package/dist/src/internal/builtin-plugins/solidity-test/config.js +55 -8
  136. package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
  137. package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.d.ts +58 -0
  138. package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.d.ts.map +1 -0
  139. package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.js +226 -0
  140. package/dist/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.js.map +1 -0
  141. package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.d.ts +29 -0
  142. package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.d.ts.map +1 -0
  143. package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.js +244 -0
  144. package/dist/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.js.map +1 -0
  145. package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.d.ts +7 -0
  146. package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.d.ts.map +1 -0
  147. package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.js +204 -0
  148. package/dist/src/internal/builtin-plugins/solidity-test/eip712/glob.js.map +1 -0
  149. package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.d.ts +21 -0
  150. package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.d.ts.map +1 -0
  151. package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.js +77 -0
  152. package/dist/src/internal/builtin-plugins/solidity-test/eip712/index.js.map +1 -0
  153. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +4 -3
  154. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
  155. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +20 -3
  156. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
  157. package/dist/src/internal/builtin-plugins/solidity-test/index.d.ts +1 -1
  158. package/dist/src/internal/builtin-plugins/solidity-test/index.d.ts.map +1 -1
  159. package/dist/src/internal/builtin-plugins/solidity-test/index.js +0 -1
  160. package/dist/src/internal/builtin-plugins/solidity-test/index.js.map +1 -1
  161. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.d.ts +4 -2
  162. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.d.ts.map +1 -1
  163. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.js +5 -1
  164. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/constants.js.map +1 -1
  165. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.d.ts.map +1 -1
  166. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.js +15 -3
  167. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/helpers.js.map +1 -1
  168. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.d.ts +3 -2
  169. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.d.ts.map +1 -1
  170. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.js +18 -4
  171. package/dist/src/internal/builtin-plugins/solidity-test/inline-config/validation.js.map +1 -1
  172. package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
  173. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +5 -1
  174. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
  175. package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.d.ts +2 -0
  176. package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.d.ts.map +1 -0
  177. package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.js +2 -0
  178. package/dist/src/internal/builtin-plugins/solidity-test/test-profiles.js.map +1 -0
  179. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +91 -33
  180. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
  181. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.js +1 -1
  182. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.js.map +1 -1
  183. package/dist/src/internal/builtin-plugins/test/index.d.ts +1 -1
  184. package/dist/src/internal/builtin-plugins/test/index.d.ts.map +1 -1
  185. package/dist/src/internal/builtin-plugins/test/index.js +0 -1
  186. package/dist/src/internal/builtin-plugins/test/index.js.map +1 -1
  187. package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts +0 -1
  188. package/dist/src/internal/builtin-plugins/test/type-extensions.d.ts.map +1 -1
  189. package/dist/src/internal/builtin-plugins/test/type-extensions.js +1 -1
  190. package/dist/src/internal/builtin-plugins/test/type-extensions.js.map +1 -1
  191. package/dist/src/internal/cli/init/init.d.ts +31 -6
  192. package/dist/src/internal/cli/init/init.d.ts.map +1 -1
  193. package/dist/src/internal/cli/init/init.js +121 -10
  194. package/dist/src/internal/cli/init/init.js.map +1 -1
  195. package/dist/src/internal/cli/main.d.ts.map +1 -1
  196. package/dist/src/internal/cli/main.js +41 -1
  197. package/dist/src/internal/cli/main.js.map +1 -1
  198. package/dist/src/types/arguments.d.ts +1 -0
  199. package/dist/src/types/arguments.d.ts.map +1 -1
  200. package/dist/src/types/arguments.js +1 -0
  201. package/dist/src/types/arguments.js.map +1 -1
  202. package/dist/src/types/artifacts.d.ts +1 -0
  203. package/dist/src/types/artifacts.d.ts.map +1 -1
  204. package/dist/src/types/artifacts.js +1 -1
  205. package/dist/src/types/artifacts.js.map +1 -1
  206. package/dist/src/types/builtin-plugin-type-extensions.d.ts +2 -0
  207. package/dist/src/types/builtin-plugin-type-extensions.d.ts.map +1 -0
  208. package/dist/src/types/builtin-plugin-type-extensions.js +2 -0
  209. package/dist/src/types/builtin-plugin-type-extensions.js.map +1 -0
  210. package/dist/src/types/config.d.ts +1 -1
  211. package/dist/src/types/config.d.ts.map +1 -1
  212. package/dist/src/types/config.js +1 -3
  213. package/dist/src/types/config.js.map +1 -1
  214. package/dist/src/types/global-options.d.ts +1 -0
  215. package/dist/src/types/global-options.d.ts.map +1 -1
  216. package/dist/src/types/global-options.js +1 -1
  217. package/dist/src/types/global-options.js.map +1 -1
  218. package/dist/src/types/hooks.d.ts +1 -0
  219. package/dist/src/types/hooks.d.ts.map +1 -1
  220. package/dist/src/types/hooks.js +1 -1
  221. package/dist/src/types/hooks.js.map +1 -1
  222. package/dist/src/types/hre.d.ts +1 -0
  223. package/dist/src/types/hre.d.ts.map +1 -1
  224. package/dist/src/types/hre.js +1 -1
  225. package/dist/src/types/hre.js.map +1 -1
  226. package/dist/src/types/index.d.ts +1 -0
  227. package/dist/src/types/index.d.ts.map +1 -1
  228. package/dist/src/types/index.js +1 -0
  229. package/dist/src/types/index.js.map +1 -1
  230. package/dist/src/types/network.d.ts +1 -0
  231. package/dist/src/types/network.d.ts.map +1 -1
  232. package/dist/src/types/network.js +1 -1
  233. package/dist/src/types/network.js.map +1 -1
  234. package/dist/src/types/plugins.d.ts +1 -1
  235. package/dist/src/types/plugins.d.ts.map +1 -1
  236. package/dist/src/types/plugins.js +1 -3
  237. package/dist/src/types/plugins.js.map +1 -1
  238. package/dist/src/types/providers.d.ts +1 -0
  239. package/dist/src/types/providers.d.ts.map +1 -1
  240. package/dist/src/types/providers.js +1 -1
  241. package/dist/src/types/providers.js.map +1 -1
  242. package/dist/src/types/solidity.d.ts +1 -0
  243. package/dist/src/types/solidity.d.ts.map +1 -1
  244. package/dist/src/types/solidity.js +1 -0
  245. package/dist/src/types/solidity.js.map +1 -1
  246. package/dist/src/types/tasks.d.ts +1 -0
  247. package/dist/src/types/tasks.d.ts.map +1 -1
  248. package/dist/src/types/tasks.js +1 -0
  249. package/dist/src/types/tasks.js.map +1 -1
  250. package/dist/src/types/test.d.ts +1 -0
  251. package/dist/src/types/test.d.ts.map +1 -1
  252. package/dist/src/types/test.js +1 -1
  253. package/dist/src/types/test.js.map +1 -1
  254. package/dist/src/types/user-interruptions.d.ts +1 -0
  255. package/dist/src/types/user-interruptions.d.ts.map +1 -1
  256. package/dist/src/types/user-interruptions.js +1 -1
  257. package/dist/src/types/user-interruptions.js.map +1 -1
  258. package/package.json +12 -12
  259. package/src/config.ts +0 -3
  260. package/src/hre.ts +0 -4
  261. package/src/index.ts +0 -4
  262. package/src/internal/builtin-global-options.ts +2 -1
  263. package/src/internal/builtin-plugins/artifacts/index.ts +1 -1
  264. package/src/internal/builtin-plugins/clean/index.ts +1 -1
  265. package/src/internal/builtin-plugins/clean/type-extensions.ts +0 -1
  266. package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +8 -13
  267. package/src/internal/builtin-plugins/coverage/index.ts +1 -1
  268. package/src/internal/builtin-plugins/coverage/instrumentation.ts +0 -5
  269. package/src/internal/builtin-plugins/coverage/type-extensions.ts +0 -1
  270. package/src/internal/builtin-plugins/gas-analytics/index.ts +1 -1
  271. package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +90 -1
  272. package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +24 -2
  273. package/src/internal/builtin-plugins/gas-analytics/type-extensions.ts +0 -1
  274. package/src/internal/builtin-plugins/index.ts +10 -10
  275. package/src/internal/builtin-plugins/network-manager/config-resolution.ts +11 -3
  276. package/src/internal/builtin-plugins/network-manager/edr/edr-constants.ts +2 -0
  277. package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +38 -8
  278. package/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.ts +10 -11
  279. package/src/internal/builtin-plugins/network-manager/edr/utils/convert-to-edr.ts +43 -1
  280. package/src/internal/builtin-plugins/network-manager/index.ts +4 -4
  281. package/src/internal/builtin-plugins/network-manager/network-manager.ts +5 -6
  282. package/src/internal/builtin-plugins/network-manager/type-extensions/config.ts +5 -4
  283. package/src/internal/builtin-plugins/network-manager/type-extensions/global-options.ts +0 -1
  284. package/src/internal/builtin-plugins/network-manager/type-extensions/hooks.ts +0 -1
  285. package/src/internal/builtin-plugins/network-manager/type-extensions/hre.ts +0 -1
  286. package/src/internal/builtin-plugins/network-manager/type-validation.ts +7 -1
  287. package/src/internal/builtin-plugins/network-manager/utils/apply-coverage-network-overrides.ts +32 -0
  288. package/src/internal/builtin-plugins/node/json-rpc/handler.ts +7 -5
  289. package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +32 -16
  290. package/src/internal/builtin-plugins/solidity/build-system/resolver/remapped-npm-packages-graph.ts +8 -2
  291. package/src/internal/builtin-plugins/solidity/constants.ts +11 -0
  292. package/src/internal/builtin-plugins/solidity/index.ts +2 -1
  293. package/src/internal/builtin-plugins/solidity/tasks/compile.ts +12 -0
  294. package/src/internal/builtin-plugins/solidity/type-extensions.ts +0 -4
  295. package/src/internal/builtin-plugins/solidity-test/config.ts +85 -12
  296. package/src/internal/builtin-plugins/solidity-test/eip712/ast-walker.ts +324 -0
  297. package/src/internal/builtin-plugins/solidity-test/eip712/canonicalize.ts +317 -0
  298. package/src/internal/builtin-plugins/solidity-test/eip712/glob.ts +225 -0
  299. package/src/internal/builtin-plugins/solidity-test/eip712/index.ts +120 -0
  300. package/src/internal/builtin-plugins/solidity-test/helpers.ts +28 -4
  301. package/src/internal/builtin-plugins/solidity-test/index.ts +1 -1
  302. package/src/internal/builtin-plugins/solidity-test/inline-config/constants.ts +6 -2
  303. package/src/internal/builtin-plugins/solidity-test/inline-config/helpers.ts +15 -4
  304. package/src/internal/builtin-plugins/solidity-test/inline-config/validation.ts +25 -4
  305. package/src/internal/builtin-plugins/solidity-test/task-action.ts +12 -1
  306. package/src/internal/builtin-plugins/solidity-test/test-profiles.ts +1 -0
  307. package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +100 -34
  308. package/src/internal/builtin-plugins/test/index.ts +1 -1
  309. package/src/internal/builtin-plugins/test/type-extensions.ts +0 -1
  310. package/src/internal/cli/init/init.ts +198 -16
  311. package/src/internal/cli/main.ts +64 -1
  312. package/src/types/arguments.ts +2 -0
  313. package/src/types/artifacts.ts +2 -0
  314. package/src/types/builtin-plugin-type-extensions.ts +15 -0
  315. package/src/types/config.ts +1 -3
  316. package/src/types/global-options.ts +2 -0
  317. package/src/types/hooks.ts +2 -0
  318. package/src/types/hre.ts +2 -0
  319. package/src/types/index.ts +2 -0
  320. package/src/types/network.ts +2 -0
  321. package/src/types/plugins.ts +1 -3
  322. package/src/types/providers.ts +2 -0
  323. package/src/types/solidity.ts +2 -0
  324. package/src/types/tasks.ts +2 -0
  325. package/src/types/test.ts +2 -0
  326. package/src/types/user-interruptions.ts +2 -0
  327. package/templates/hardhat-3/01-node-test-runner-viem/package.json +12 -12
  328. package/templates/hardhat-3/01-node-test-runner-viem/tsconfig.json +4 -7
  329. package/templates/hardhat-3/02-mocha-ethers/package.json +15 -15
  330. package/templates/hardhat-3/02-mocha-ethers/tsconfig.json +4 -7
  331. package/templates/hardhat-3/03-minimal/package.json +2 -2
  332. package/templates/hardhat-3/03-minimal/tsconfig.json +4 -7
  333. package/coverage.sol +0 -38
@@ -0,0 +1,244 @@
1
+ import { HardhatError } from "@nomicfoundation/hardhat-errors";
2
+ /**
3
+ * Produces the flat list of canonical EIP-712 type strings expected by EDR.
4
+ *
5
+ * Each encodable struct contributes one entry, built like this:
6
+ * 1. Start with the struct's own head: `Name(type1 name1,type2 name2,...)`.
7
+ * 2. If the struct has fields that reference other structs, append those
8
+ * structs' heads after it, sorted alphabetically.
9
+ *
10
+ * Examples:
11
+ * - `Person` has only primitive fields (address, string), so its entry is
12
+ * just its own head:
13
+ * `Person(address wallet,string name)`
14
+ * - `Mail` has a `Person` field, so its entry is its head plus `Person`'s
15
+ * head appended:
16
+ * `Mail(Person from,Person to,string contents)Person(address wallet,string name)`
17
+ *
18
+ * Structs that contain members whose type cannot be EIP-712 encoded (mappings,
19
+ * function types, etc.) are dropped entirely, along with any structs that
20
+ * depend on them transitively. This matches `forge bind-json`'s behavior:
21
+ * `resolve_struct_eip712` returns `None` for any struct containing unsupported
22
+ * constructs and propagates `None` through the dep graph so dependents are
23
+ * also dropped.
24
+ *
25
+ * Only names in `selectedNames` are emitted; non-selected structs still
26
+ * participate in dep resolution so cross-file deps inline correctly.
27
+ */
28
+ export function canonicalizeStructs(structs, selectedNames) {
29
+ const byName = indexByName(structs, selectedNames);
30
+ const knownNames = new Set(byName.keys());
31
+ const encodable = computeEncodable(byName, knownNames);
32
+ const result = [];
33
+ for (const struct of byName.values()) {
34
+ if (!selectedNames.has(struct.name)) {
35
+ continue;
36
+ }
37
+ if (!encodable.has(struct.name)) {
38
+ continue;
39
+ }
40
+ const head = encodeStructHead(struct);
41
+ const deps = transitiveDeps(struct, byName)
42
+ .map((depName) => {
43
+ const def = byName.get(depName);
44
+ return def === undefined ? undefined : encodeStructHead(def);
45
+ })
46
+ .filter((s) => s !== undefined);
47
+ deps.sort();
48
+ result.push(head + deps.join(""));
49
+ }
50
+ return result;
51
+ }
52
+ /**
53
+ * Returns the set of struct names that are EIP-712 encodable. A struct is
54
+ * encodable if none of its members has a non-decodable type (`type === undefined`,
55
+ * e.g. mappings or function types) AND every one of its struct deps — direct or
56
+ * transitive — is itself encodable.
57
+ */
58
+ function computeEncodable(byName, knownNames) {
59
+ const encodable = new Set(byName.keys());
60
+ for (const [name, struct] of byName) {
61
+ if (struct.members.some((m) => m.type === undefined)) {
62
+ encodable.delete(name);
63
+ }
64
+ }
65
+ const depsByName = new Map();
66
+ for (const [name, struct] of byName) {
67
+ depsByName.set(name, directStructDeps(struct, knownNames));
68
+ }
69
+ let changed = true;
70
+ while (changed) {
71
+ changed = false;
72
+ for (const name of [...encodable]) {
73
+ const deps = depsByName.get(name) ?? [];
74
+ if (deps.some((dep) => !encodable.has(dep))) {
75
+ encodable.delete(name);
76
+ changed = true;
77
+ }
78
+ }
79
+ }
80
+ return encodable;
81
+ }
82
+ /**
83
+ * Computes the EIP-712 `encodeType` string for one struct in isolation:
84
+ * `Name(type1 name1,type2 name2,...)`.
85
+ * Members whose type is `undefined` (e.g. mappings) are dropped.
86
+ */
87
+ function encodeStructHead(struct) {
88
+ const memberSegments = [];
89
+ for (const member of struct.members) {
90
+ if (member.type === undefined) {
91
+ continue;
92
+ }
93
+ memberSegments.push(`${member.type} ${member.name}`);
94
+ }
95
+ return `${struct.name}(${memberSegments.join(",")})`;
96
+ }
97
+ /**
98
+ * Returns the names of all struct dependencies referenced by `struct`'s
99
+ * members. Considers the base type of arrays. Members whose base type does not
100
+ * resolve to a known struct (elementary types, address, etc.) are ignored.
101
+ */
102
+ function directStructDeps(struct, knownStructNames) {
103
+ const deps = new Set();
104
+ for (const member of struct.members) {
105
+ if (member.type === undefined) {
106
+ continue;
107
+ }
108
+ // Strip array suffixes: `Foo[]`, `Foo[3]`, `Foo[3][2]` → `Foo`.
109
+ const base = member.type.split("[")[0];
110
+ if (knownStructNames.has(base) && base !== struct.name) {
111
+ deps.add(base);
112
+ }
113
+ }
114
+ return [...deps];
115
+ }
116
+ /**
117
+ * Walks the dep graph from `root` and returns the set of all transitively
118
+ * referenced struct names (excluding the root itself).
119
+ */
120
+ function transitiveDeps(root, byName) {
121
+ const visited = new Set();
122
+ const knownNames = new Set(byName.keys());
123
+ const stack = directStructDeps(root, knownNames);
124
+ while (stack.length > 0) {
125
+ const next = stack.pop();
126
+ if (next === undefined || visited.has(next) || next === root.name) {
127
+ continue;
128
+ }
129
+ visited.add(next);
130
+ const def = byName.get(next);
131
+ if (def !== undefined) {
132
+ stack.push(...directStructDeps(def, knownNames));
133
+ }
134
+ }
135
+ return [...visited];
136
+ }
137
+ /**
138
+ * Builds a name → definition map from collected structs, throwing
139
+ * `EIP712_DUPLICATE_STRUCT_NAME` when two structs share a name but have
140
+ * different member lists. Definitions with identical members are silently
141
+ * deduplicated (same struct seen across multiple build infos / partial
142
+ * recompiles).
143
+ *
144
+ * The comparison uses the full member list — including members whose type
145
+ * isn't EIP-712 encodable (mappings, function types) — so that two structs
146
+ * differing only in unsupported members are detected as conflicting rather
147
+ * than collapsed into one. Comparing only the encoded head would let a
148
+ * non decodable definition silently win over an encodable one, dropping the
149
+ * struct from the canonical output.
150
+ *
151
+ * Conflicts on a name reachable from any selected struct (selected roots plus
152
+ * their transitive deps) throw, since the selected struct's inlined dep head
153
+ * would otherwise depend on which conflicting copy happened to be seen first.
154
+ * Conflicts on names truly unreachable from the selected set are silently
155
+ * deduped (first wins). Selected structs are processed first so they win over
156
+ * non-selected copies.
157
+ */
158
+ function indexByName(structs, selectedNames) {
159
+ const byName = new Map();
160
+ const fingerprintByName = new Map();
161
+ const sourceByName = new Map();
162
+ const deferredConflicts = new Map();
163
+ const ordered = [
164
+ ...structs.filter((s) => selectedNames.has(s.name)),
165
+ ...structs.filter((s) => !selectedNames.has(s.name)),
166
+ ];
167
+ for (const struct of ordered) {
168
+ const fingerprint = fingerprintStruct(struct);
169
+ const existingFingerprint = fingerprintByName.get(struct.name);
170
+ if (existingFingerprint === undefined) {
171
+ byName.set(struct.name, struct);
172
+ fingerprintByName.set(struct.name, fingerprint);
173
+ sourceByName.set(struct.name, struct.sourcePath);
174
+ continue;
175
+ }
176
+ if (existingFingerprint === fingerprint) {
177
+ continue;
178
+ }
179
+ if (!selectedNames.has(struct.name)) {
180
+ if (!deferredConflicts.has(struct.name)) {
181
+ deferredConflicts.set(struct.name, {
182
+ firstSource: sourceByName.get(struct.name) ?? "<unknown>",
183
+ secondSource: struct.sourcePath,
184
+ });
185
+ }
186
+ continue;
187
+ }
188
+ throw new HardhatError(HardhatError.ERRORS.CORE.SOLIDITY_TESTS.EIP712_DUPLICATE_STRUCT_NAME, {
189
+ name: struct.name,
190
+ firstSource: sourceByName.get(struct.name) ?? "<unknown>",
191
+ secondSource: struct.sourcePath,
192
+ });
193
+ }
194
+ if (deferredConflicts.size > 0) {
195
+ const reachable = reachableFromSelected(byName, selectedNames);
196
+ for (const [name, sources] of deferredConflicts) {
197
+ if (reachable.has(name)) {
198
+ throw new HardhatError(HardhatError.ERRORS.CORE.SOLIDITY_TESTS.EIP712_DUPLICATE_STRUCT_NAME, { name, ...sources });
199
+ }
200
+ }
201
+ }
202
+ return byName;
203
+ }
204
+ /**
205
+ * Set of struct names transitively referenced by any struct in `selectedNames`.
206
+ * The walk uses whatever first-wins definition is in `byName`; that's enough
207
+ * for conflict detection since we only need to know whether a name is
208
+ * reachable, not which conflicting copy is the "right" one.
209
+ */
210
+ function reachableFromSelected(byName, selectedNames) {
211
+ const knownNames = new Set(byName.keys());
212
+ const reachable = new Set();
213
+ const stack = [];
214
+ for (const name of selectedNames) {
215
+ const root = byName.get(name);
216
+ if (root !== undefined) {
217
+ stack.push(...directStructDeps(root, knownNames));
218
+ }
219
+ }
220
+ while (stack.length > 0) {
221
+ const next = stack.pop();
222
+ if (next === undefined || reachable.has(next)) {
223
+ continue;
224
+ }
225
+ reachable.add(next);
226
+ const def = byName.get(next);
227
+ if (def !== undefined) {
228
+ stack.push(...directStructDeps(def, knownNames));
229
+ }
230
+ }
231
+ return reachable;
232
+ }
233
+ /**
234
+ * A stable string capturing every member of `struct`, used to detect
235
+ * conflicting definitions of the same name. Unlike `encodeStructHead`, this
236
+ * preserves members whose type can't be EIP-712 encoded — they're emitted with
237
+ * an `<unsupported>` sentinel — so structs that differ only in mapping or
238
+ * function-type members aren't collapsed together.
239
+ */
240
+ function fingerprintStruct(struct) {
241
+ const segments = struct.members.map((m) => `${m.type ?? "<unsupported>"} ${m.name}`);
242
+ return `${struct.name}(${segments.join(",")})`;
243
+ }
244
+ //# sourceMappingURL=canonicalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canonicalize.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/solidity-test/eip712/canonicalize.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAA0B,EAC1B,aAA0B;IAE1B,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1C,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACvD,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;QACrC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACpC,SAAS;QACX,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,SAAS;QACX,CAAC;QAED,MAAM,IAAI,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC;aACxC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;YACf,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAChC,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAC/D,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,C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AC;QAED,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEpB,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,KAAK,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,MAAuB;IAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CACjC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,eAAe,IAAI,CAAC,CAAC,IAAI,EAAE,CAChD,CAAC;IAEF,OAAO,GAAG,MAAM,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACjD,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns true when `path` should be included given user-supplied include and
3
+ * exclude glob lists. `include` is the gate: an empty `include` matches
4
+ * nothing. `exclude` then narrows the included set.
5
+ */
6
+ export declare function isPathSelected(path: string, include: string[], exclude: string[]): boolean;
7
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/solidity-test/eip712/glob.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE,MAAM,EAAE,GAChB,OAAO,CAcT"}
@@ -0,0 +1,204 @@
1
+ // The same patterns are reused for every source file, so compile each one once.
2
+ const compiledGlobCache = new Map();
3
+ /**
4
+ * Returns true when `path` should be included given user-supplied include and
5
+ * exclude glob lists. `include` is the gate: an empty `include` matches
6
+ * nothing. `exclude` then narrows the included set.
7
+ */
8
+ export function isPathSelected(path, include, exclude) {
9
+ if (include.length === 0) {
10
+ return false;
11
+ }
12
+ if (!matchesAny(path, include)) {
13
+ return false;
14
+ }
15
+ if (exclude.length > 0 && matchesAny(path, exclude)) {
16
+ return false;
17
+ }
18
+ return true;
19
+ }
20
+ /**
21
+ * Returns true if `value` matches at least one of the given glob patterns.
22
+ */
23
+ function matchesAny(value, patterns) {
24
+ for (const pattern of patterns) {
25
+ if (getCompiledGlob(pattern).test(value)) {
26
+ return true;
27
+ }
28
+ }
29
+ return false;
30
+ }
31
+ /**
32
+ * Compiles a glob pattern into a regular expression. Supports `*`, `**`,
33
+ * `?`, `[abc]` (including `[a-z]` ranges and `[!abc]` / `[^abc]` negation),
34
+ * and `{a,b,c}` alternation.
35
+ */
36
+ function globToRegExp(pattern) {
37
+ return new RegExp(`^${translateGlob(pattern)}$`);
38
+ }
39
+ function translateGlob(pattern) {
40
+ let regex = "";
41
+ let i = 0;
42
+ while (i < pattern.length) {
43
+ const c = pattern[i];
44
+ if (c === "*") {
45
+ if (pattern[i + 1] === "*") {
46
+ // `**` as a full path segment matches zero or more directories,
47
+ // e.g. `**/x.sol` matches both `x.sol` and `a/b/x.sol`.
48
+ const afterSlash = i === 0 || pattern[i - 1] === "/";
49
+ const beforeSlash = pattern[i + 2] === "/";
50
+ if (afterSlash && beforeSlash) {
51
+ regex += "(?:.*/)?";
52
+ i += 3;
53
+ }
54
+ else {
55
+ regex += ".*";
56
+ i += 2;
57
+ }
58
+ }
59
+ else {
60
+ regex += "[^/]*";
61
+ i += 1;
62
+ }
63
+ }
64
+ else if (c === "?") {
65
+ regex += "[^/]";
66
+ i += 1;
67
+ }
68
+ else if (c === "[") {
69
+ const end = findCharClassEnd(pattern, i);
70
+ if (end !== -1) {
71
+ regex += translateCharClass(pattern.slice(i + 1, end));
72
+ i = end + 1;
73
+ continue;
74
+ }
75
+ regex += "\\[";
76
+ i += 1;
77
+ }
78
+ else if (c === "{") {
79
+ const end = findBraceEnd(pattern, i);
80
+ if (end !== -1) {
81
+ const alternatives = splitBraceAlternatives(pattern.slice(i + 1, end)).map(translateGlob);
82
+ regex += `(?:${alternatives.join("|")})`;
83
+ i = end + 1;
84
+ continue;
85
+ }
86
+ regex += "\\{";
87
+ i += 1;
88
+ }
89
+ else if (/[.+^$()|\\\]}]/.test(c)) {
90
+ regex += `\\${c}`;
91
+ i += 1;
92
+ }
93
+ else {
94
+ regex += c;
95
+ i += 1;
96
+ }
97
+ }
98
+ return regex;
99
+ }
100
+ /**
101
+ * Returns the index of the `]` that closes the character class opened at
102
+ * `start`, or -1 if none is found. E.g. for `a[bc]d` starting at 1, returns 4.
103
+ */
104
+ function findCharClassEnd(pattern, start) {
105
+ for (let i = start + 1; i < pattern.length; i++) {
106
+ if (pattern[i] === "]") {
107
+ return i;
108
+ }
109
+ }
110
+ return -1;
111
+ }
112
+ /**
113
+ * Returns the index of the `}` that closes the brace group opened at `start`,
114
+ * handling nested groups and skipping character classes, or -1 if unterminated.
115
+ * E.g. `{a,{b,c}}` returns the outer `}`; `{a[}]b}` skips the bracketed `}`.
116
+ */
117
+ function findBraceEnd(pattern, start) {
118
+ let depth = 1;
119
+ let i = start + 1;
120
+ while (i < pattern.length) {
121
+ const c = pattern[i];
122
+ if (c === "{") {
123
+ depth += 1;
124
+ }
125
+ else if (c === "}") {
126
+ depth -= 1;
127
+ if (depth === 0) {
128
+ return i;
129
+ }
130
+ }
131
+ else if (c === "[") {
132
+ const end = findCharClassEnd(pattern, i);
133
+ if (end !== -1) {
134
+ i = end;
135
+ }
136
+ }
137
+ i += 1;
138
+ }
139
+ return -1;
140
+ }
141
+ /**
142
+ * Splits a brace group's body on top-level commas, leaving commas inside
143
+ * nested braces or character classes untouched. E.g. `a,{b,c},[d,e]` →
144
+ * `["a", "{b,c}", "[d,e]"]`.
145
+ */
146
+ function splitBraceAlternatives(inside) {
147
+ const result = [];
148
+ let depth = 0;
149
+ let start = 0;
150
+ let i = 0;
151
+ while (i < inside.length) {
152
+ const c = inside[i];
153
+ if (c === "{") {
154
+ depth += 1;
155
+ }
156
+ else if (c === "}") {
157
+ depth -= 1;
158
+ }
159
+ else if (c === "[") {
160
+ const end = findCharClassEnd(inside, i);
161
+ if (end !== -1) {
162
+ i = end;
163
+ }
164
+ }
165
+ else if (c === "," && depth === 0) {
166
+ result.push(inside.slice(start, i));
167
+ start = i + 1;
168
+ }
169
+ i += 1;
170
+ }
171
+ result.push(inside.slice(start));
172
+ return result;
173
+ }
174
+ /**
175
+ * Translates a glob character class body into a regex character class.
176
+ * E.g. `Mm` → `[Mm]`, `!ab` → `[^ab]`, `a-z` → `[a-z]`.
177
+ */
178
+ function translateCharClass(content) {
179
+ let negated = false;
180
+ let body = content;
181
+ if (body.startsWith("!") || body.startsWith("^")) {
182
+ negated = true;
183
+ body = body.slice(1);
184
+ }
185
+ let escaped = "";
186
+ for (const ch of body) {
187
+ if (ch === "\\" || ch === "]") {
188
+ escaped += `\\${ch}`;
189
+ }
190
+ else {
191
+ escaped += ch;
192
+ }
193
+ }
194
+ return `(?!/)[${negated ? "^" : ""}${escaped}]`;
195
+ }
196
+ function getCompiledGlob(pattern) {
197
+ let compiled = compiledGlobCache.get(pattern);
198
+ if (compiled === undefined) {
199
+ compiled = globToRegExp(pattern);
200
+ compiledGlobCache.set(pattern, compiled);
201
+ }
202
+ return compiled;
203
+ }
204
+ //# sourceMappingURL=glob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/solidity-test/eip712/glob.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,OAAiB,EACjB,OAAiB;IAEjB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KA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OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAS,kBAAkB,CAAC,OAAe;IACzC,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,IAAI,GAAG,OAAO,CAAC;IACnB,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACjD,OAAO,GAAG,IAAI,CAAC;QACf,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;QACtB,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YAC9B,OAAO,IAAI,KAAK,EAAE,EAAE,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,GAAG,CAAC;AAClD,CAAC;AAED,SAAS,eAAe,CAAC,OAAe;IACtC,IAAI,QAAQ,GAAG,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAE9C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QACjC,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { BuildInfoAndOutput } from "../edr-artifacts.js";
2
+ export interface Eip712TypesConfig {
3
+ include: string[];
4
+ exclude: string[];
5
+ }
6
+ /**
7
+ * Walks every compiled source's AST, extracts every struct definition, and
8
+ * returns the flat list of canonical EIP-712 type strings expected by EDR's
9
+ * `eip712CanonicalTypes` config field. Only structs from sources matching
10
+ * `include`/`exclude` are emitted; non-selected sources still feed the dep
11
+ * graph so cross-file deps inline correctly.
12
+ *
13
+ * `inputToUserSource` maps solc input source names to user source names; it's
14
+ * built by the caller from the artifact set so we don't pay to parse every
15
+ * build info just to recover that mapping.
16
+ *
17
+ * When `include` is empty/unset the feature is off: collection short-circuits
18
+ * and returns an empty list without parsing any build info.
19
+ */
20
+ export declare function collectEip712CanonicalTypes(buildInfosAndOutputs: BuildInfoAndOutput[], inputToUserSource: ReadonlyMap<string, string>, config: Eip712TypesConfig): string[];
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/solidity-test/eip712/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAgB9D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAOD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACzC,oBAAoB,EAAE,kBAAkB,EAAE,EAC1C,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9C,MAAM,EAAE,iBAAiB,GACxB,MAAM,EAAE,CAyEV"}
@@ -0,0 +1,77 @@
1
+ import { bytesIncludesUtf8String, bytesToUtf8String, } from "@nomicfoundation/hardhat-utils/bytes";
2
+ import { HARDHAT_PROJECT_INPUT_SOURCE_NAME_ROOT } from "../../solidity/constants.js";
3
+ import { buildUserDefinedValueTypeIndex, extractStructsFromAst, } from "./ast-walker.js";
4
+ import { canonicalizeStructs } from "./canonicalize.js";
5
+ import { isPathSelected } from "./glob.js";
6
+ // When a transitive project file doesn't produce an artifact — and so is
7
+ // missing from `inputToUserSource` — stripping this prefix recovers the
8
+ // user-facing path that the user's include/exclude globs are written against.
9
+ const PROJECT_INPUT_SOURCE_NAME_PREFIX = `${HARDHAT_PROJECT_INPUT_SOURCE_NAME_ROOT}/`;
10
+ /**
11
+ * Walks every compiled source's AST, extracts every struct definition, and
12
+ * returns the flat list of canonical EIP-712 type strings expected by EDR's
13
+ * `eip712CanonicalTypes` config field. Only structs from sources matching
14
+ * `include`/`exclude` are emitted; non-selected sources still feed the dep
15
+ * graph so cross-file deps inline correctly.
16
+ *
17
+ * `inputToUserSource` maps solc input source names to user source names; it's
18
+ * built by the caller from the artifact set so we don't pay to parse every
19
+ * build info just to recover that mapping.
20
+ *
21
+ * When `include` is empty/unset the feature is off: collection short-circuits
22
+ * and returns an empty list without parsing any build info.
23
+ */
24
+ export function collectEip712CanonicalTypes(buildInfosAndOutputs, inputToUserSource, config) {
25
+ const { include, exclude } = config;
26
+ if (include.length === 0) {
27
+ return [];
28
+ }
29
+ const collected = [];
30
+ const selectedNames = new Set();
31
+ for (const { buildInfo, output } of buildInfosAndOutputs) {
32
+ // Byte-level fast path: a build info whose source bytes don't contain
33
+ // `struct ` can't define any EIP-712 type, so skip JSON-parsing its output.
34
+ if (!bytesIncludesUtf8String(buildInfo, "struct ")) {
35
+ continue;
36
+ }
37
+ const parsedOutput = JSON.parse(bytesToUtf8String(output));
38
+ const sources = parsedOutput.output.sources;
39
+ if (sources === undefined) {
40
+ continue;
41
+ }
42
+ // Two constraints determine the index's scope:
43
+ //
44
+ // 1. Per build info, not pooled across them. solc assigns node ids
45
+ // fresh in each compilation, so the same numeric id can mean
46
+ // different user-defined value types in different builds. Pooling
47
+ // would let one compilation's definition silently overwrite
48
+ // another's at the same key, mis-resolving `referencedDeclaration`.
49
+ // See the test "scopes user-defined value type resolution per build
50
+ // info when node ids collide" for a repro.
51
+ //
52
+ // 2. Whole build info, not narrowed to a subset of sources. A struct
53
+ // member's `referencedDeclaration` can point at a user-defined
54
+ // value type defined in any source within the same compilation, so
55
+ // the index must cover every source in the build.
56
+ const userDefinedValueTypeI = buildUserDefinedValueTypeIndex(Object.values(sources).map((s) => s.ast));
57
+ for (const [inputSourceName, source] of Object.entries(sources)) {
58
+ let userSourceName = inputToUserSource.get(inputSourceName);
59
+ if (userSourceName === undefined) {
60
+ userSourceName = inputSourceName.startsWith(PROJECT_INPUT_SOURCE_NAME_PREFIX)
61
+ ? inputSourceName.slice(PROJECT_INPUT_SOURCE_NAME_PREFIX.length)
62
+ : inputSourceName;
63
+ }
64
+ // Collect every source so non-selected files can serve as dep targets;
65
+ // selection is enforced at emit time via `selectedNames`.
66
+ const structs = extractStructsFromAst(source.ast, userSourceName, userDefinedValueTypeI);
67
+ collected.push(...structs);
68
+ if (isPathSelected(userSourceName, include, exclude)) {
69
+ for (const s of structs) {
70
+ selectedNames.add(s.name);
71
+ }
72
+ }
73
+ }
74
+ }
75
+ return canonicalizeStructs(collected, selectedNames);
76
+ }
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/solidity-test/eip712/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,sCAAsC,EAAE,MAAM,6BAA6B,CAAC;AAErF,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAO3C,yEAAyE;AACzE,wEAAwE;AACxE,8EAA8E;AAC9E,MAAM,gCAAgC,GAAG,GAAG,sCAAsC,GAAG,CAAC;AAEtF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,2BAA2B,CACzC,oBAA0C,EAC1C,iBAA8C,EAC9C,MAAyB;IAEzB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAEpC,IAA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CAAC,KAAK,CAAC,gCAAgC,CAAC,MAAM,CAAC;oBAChE,CAAC,CAAC,eAAe,CAAC;YACtB,CAAC;YAED,uEAAuE;YACvE,0DAA0D;YAC1D,MAAM,OAAO,GAAG,qBAAqB,CACnC,MAAM,CAAC,GAAG,EACV,cAAc,EACd,qBAAqB,CACtB,CAAC;YACF,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;YAE3B,IAAI,cAAc,CAAC,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;gBACrD,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;oBACxB,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACvD,CAAC"}
@@ -1,18 +1,19 @@
1
1
  import type { ChainType } from "../../../types/network.js";
2
- import type { SolidityTestConfig } from "../../../types/test.js";
2
+ import type { SolidityTestProfileConfig } from "../../../types/test.js";
3
3
  import type { SolidityTestRunnerConfigArgs, Artifact, ObservabilityConfig, TestFunctionOverride } from "@nomicfoundation/edr";
4
4
  interface SolidityTestConfigParams {
5
5
  chainType: ChainType;
6
6
  projectRoot: string;
7
7
  hardfork?: string;
8
- config: SolidityTestConfig;
8
+ config: Omit<SolidityTestProfileConfig, "eip712Types">;
9
9
  verbosity: number;
10
10
  observability?: ObservabilityConfig;
11
11
  testPattern?: string;
12
12
  generateGasReport: boolean;
13
13
  testFunctionOverrides?: TestFunctionOverride[];
14
+ eip712CanonicalTypes?: string[];
14
15
  }
15
- export declare function solidityTestConfigToSolidityTestRunnerConfigArgs({ chainType, projectRoot, hardfork, config, verbosity, observability, testPattern, generateGasReport, testFunctionOverrides, }: SolidityTestConfigParams): Promise<SolidityTestRunnerConfigArgs>;
16
+ export declare function solidityTestConfigToSolidityTestRunnerConfigArgs({ chainType, projectRoot, hardfork, config, verbosity, observability, testPattern, generateGasReport, testFunctionOverrides, eip712CanonicalTypes, }: SolidityTestConfigParams): Promise<SolidityTestRunnerConfigArgs>;
16
17
  export declare function isTestSuiteArtifact(artifact: Artifact): boolean;
17
18
  export declare function warnDeprecatedTestFail(artifact: Artifact, sourceNameToUserSourceName: Map<string, string>): void;
18
19
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/solidity-test/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EACV,4BAA4B,EAE5B,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAqB9B,UAAU,wBAAwB;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,CAAC,EAAE,oBAAoB,EAAE,CAAC;CAChD;AAED,wBAAsB,gDAAgD,CAAC,EACrE,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,qBAAqB,GACtB,EAAE,wBAAwB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAgGlE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAQ/D;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,QAAQ,EAClB,0BAA0B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9C,IAAI,CAkBN"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/internal/builtin-plugins/solidity-test/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,KAAK,EACV,4BAA4B,EAE5B,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAsB9B,UAAU,wBAAwB;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAC/C,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED,wBAAsB,gDAAgD,CAAC,EACrE,SAAS,EACT,WAAW,EACX,QAAQ,EACR,MAAM,EACN,SAAS,EACT,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,GACrB,EAAE,wBAAwB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CA6GlE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAgB/D;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,QAAQ,EAClB,0BAA0B,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9C,IAAI,CAkBN"}