hardhat 3.4.2 → 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 (217) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/src/internal/builtin-plugins/console/task-action.js +4 -4
  3. package/dist/src/internal/builtin-plugins/console/task-action.js.map +1 -1
  4. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +7 -7
  5. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
  6. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js +1 -1
  7. package/dist/src/internal/builtin-plugins/coverage/helpers/accessors.js.map +1 -1
  8. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +2 -2
  9. package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
  10. package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts.map +1 -1
  11. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js +7 -2
  12. package/dist/src/internal/builtin-plugins/coverage/instrumentation.js.map +1 -1
  13. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js +6 -6
  14. package/dist/src/internal/builtin-plugins/coverage/process-coverage.js.map +1 -1
  15. package/dist/src/internal/builtin-plugins/flatten/task-action.d.ts.map +1 -1
  16. package/dist/src/internal/builtin-plugins/flatten/task-action.js +4 -4
  17. package/dist/src/internal/builtin-plugins/flatten/task-action.js.map +1 -1
  18. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.d.ts.map +1 -1
  19. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js +10 -10
  20. package/dist/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.js.map +1 -1
  21. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -1
  22. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +12 -9
  23. package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
  24. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js +1 -1
  25. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/accessors.js.map +1 -1
  26. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js +2 -2
  27. package/dist/src/internal/builtin-plugins/gas-analytics/helpers/utils.js.map +1 -1
  28. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.d.ts.map +1 -1
  29. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js +9 -9
  30. package/dist/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.js.map +1 -1
  31. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.d.ts.map +1 -1
  32. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js +5 -5
  33. package/dist/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.js.map +1 -1
  34. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js +2 -2
  35. package/dist/src/internal/builtin-plugins/network-manager/edr/edr-provider.js.map +1 -1
  36. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts +2 -2
  37. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.d.ts.map +1 -1
  38. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js +21 -24
  39. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.js.map +1 -1
  40. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.d.ts.map +1 -1
  41. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js +13 -11
  42. package/dist/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.js.map +1 -1
  43. package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js +2 -2
  44. package/dist/src/internal/builtin-plugins/node/artifacts/build-info-watcher.js.map +1 -1
  45. package/dist/src/internal/builtin-plugins/node/helpers.d.ts +2 -1
  46. package/dist/src/internal/builtin-plugins/node/helpers.d.ts.map +1 -1
  47. package/dist/src/internal/builtin-plugins/node/helpers.js +3 -3
  48. package/dist/src/internal/builtin-plugins/node/helpers.js.map +1 -1
  49. package/dist/src/internal/builtin-plugins/node/json-rpc/server.js +2 -2
  50. package/dist/src/internal/builtin-plugins/node/json-rpc/server.js.map +1 -1
  51. package/dist/src/internal/builtin-plugins/node/task-action.d.ts.map +1 -1
  52. package/dist/src/internal/builtin-plugins/node/task-action.js +4 -4
  53. package/dist/src/internal/builtin-plugins/node/task-action.js.map +1 -1
  54. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
  55. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +18 -9
  56. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
  57. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts +8 -0
  58. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.d.ts.map +1 -0
  59. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js +46 -0
  60. package/dist/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.js.map +1 -0
  61. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.d.ts.map +1 -1
  62. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js +9 -3
  63. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.js.map +1 -1
  64. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
  65. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +2 -2
  66. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
  67. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +2 -2
  68. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
  69. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.d.ts.map +1 -1
  70. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js +7 -19
  71. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js.map +1 -1
  72. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.d.ts.map +1 -1
  73. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +4 -3
  74. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
  75. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts +2 -1
  76. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.d.ts.map +1 -1
  77. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js +12 -8
  78. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/utils.js.map +1 -1
  79. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +3 -2
  80. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
  81. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +15 -6
  82. package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
  83. package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
  84. package/dist/src/internal/builtin-plugins/solidity/config.js +2 -2
  85. package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
  86. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts +1 -0
  87. package/dist/src/internal/builtin-plugins/solidity/constants.d.ts.map +1 -1
  88. package/dist/src/internal/builtin-plugins/solidity/constants.js +2 -0
  89. package/dist/src/internal/builtin-plugins/solidity/constants.js.map +1 -1
  90. package/dist/src/internal/builtin-plugins/solidity-test/config.d.ts.map +1 -1
  91. package/dist/src/internal/builtin-plugins/solidity-test/config.js +1 -0
  92. package/dist/src/internal/builtin-plugins/solidity-test/config.js.map +1 -1
  93. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +1 -2
  94. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
  95. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +3 -3
  96. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
  97. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts +2 -2
  98. package/dist/src/internal/builtin-plugins/solidity-test/reporter.d.ts.map +1 -1
  99. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js +19 -17
  100. package/dist/src/internal/builtin-plugins/solidity-test/reporter.js.map +1 -1
  101. package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
  102. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +5 -2
  103. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
  104. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts +1 -0
  105. package/dist/src/internal/builtin-plugins/solidity-test/type-extensions.d.ts.map +1 -1
  106. package/dist/src/internal/builtin-plugins/test/task-action.d.ts.map +1 -1
  107. package/dist/src/internal/builtin-plugins/test/task-action.js +8 -6
  108. package/dist/src/internal/builtin-plugins/test/task-action.js.map +1 -1
  109. package/dist/src/internal/cli/banner-manager.js +2 -2
  110. package/dist/src/internal/cli/banner-manager.js.map +1 -1
  111. package/dist/src/internal/cli/error-handler.d.ts.map +1 -1
  112. package/dist/src/internal/cli/error-handler.js +6 -6
  113. package/dist/src/internal/cli/error-handler.js.map +1 -1
  114. package/dist/src/internal/cli/help/get-help-string.js +2 -2
  115. package/dist/src/internal/cli/help/get-help-string.js.map +1 -1
  116. package/dist/src/internal/cli/init/init.d.ts.map +1 -1
  117. package/dist/src/internal/cli/init/init.js +40 -28
  118. package/dist/src/internal/cli/init/init.js.map +1 -1
  119. package/dist/src/internal/cli/init/package-manager.d.ts.map +1 -1
  120. package/dist/src/internal/cli/init/package-manager.js +5 -5
  121. package/dist/src/internal/cli/init/package-manager.js.map +1 -1
  122. package/dist/src/internal/cli/init/prompt.d.ts.map +1 -1
  123. package/dist/src/internal/cli/init/prompt.js +3 -3
  124. package/dist/src/internal/cli/init/prompt.js.map +1 -1
  125. package/dist/src/internal/cli/main.d.ts.map +1 -1
  126. package/dist/src/internal/cli/main.js +2 -2
  127. package/dist/src/internal/cli/main.js.map +1 -1
  128. package/dist/src/internal/cli/node-version.js +1 -1
  129. package/dist/src/internal/cli/telemetry/analytics/analytics.js +2 -2
  130. package/dist/src/internal/cli/telemetry/analytics/analytics.js.map +1 -1
  131. package/dist/src/internal/cli/telemetry/analytics/utils.js +2 -2
  132. package/dist/src/internal/cli/telemetry/analytics/utils.js.map +1 -1
  133. package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js +2 -2
  134. package/dist/src/internal/cli/telemetry/error-reporter/global-error-handlers.js.map +1 -1
  135. package/dist/src/internal/cli/telemetry/sentry/reporter.js +2 -2
  136. package/dist/src/internal/cli/telemetry/sentry/reporter.js.map +1 -1
  137. package/dist/src/internal/cli/telemetry/sentry/subprocess.js +2 -2
  138. package/dist/src/internal/cli/telemetry/sentry/subprocess.js.map +1 -1
  139. package/dist/src/internal/cli/telemetry/sentry/transport.js +2 -2
  140. package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
  141. package/dist/src/internal/cli/telemetry/telemetry-permissions.js +2 -2
  142. package/dist/src/internal/cli/telemetry/telemetry-permissions.js.map +1 -1
  143. package/dist/src/internal/config-loading.js +2 -2
  144. package/dist/src/internal/config-loading.js.map +1 -1
  145. package/dist/src/internal/core/hook-manager.d.ts.map +1 -1
  146. package/dist/src/internal/core/hook-manager.js +10 -3
  147. package/dist/src/internal/core/hook-manager.js.map +1 -1
  148. package/dist/src/internal/core/user-interruptions.js +4 -4
  149. package/dist/src/internal/core/user-interruptions.js.map +1 -1
  150. package/dist/src/internal/using-hardhat2-plugin-errors.d.ts.map +1 -1
  151. package/dist/src/internal/using-hardhat2-plugin-errors.js +2 -2
  152. package/dist/src/internal/using-hardhat2-plugin-errors.js.map +1 -1
  153. package/package.json +6 -9
  154. package/src/internal/builtin-plugins/console/task-action.ts +4 -4
  155. package/src/internal/builtin-plugins/coverage/coverage-manager.ts +7 -7
  156. package/src/internal/builtin-plugins/coverage/helpers/accessors.ts +1 -1
  157. package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +2 -2
  158. package/src/internal/builtin-plugins/coverage/instrumentation.ts +21 -2
  159. package/src/internal/builtin-plugins/coverage/process-coverage.ts +6 -6
  160. package/src/internal/builtin-plugins/flatten/task-action.ts +8 -4
  161. package/src/internal/builtin-plugins/gas-analytics/function-gas-snapshots.ts +11 -10
  162. package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +13 -9
  163. package/src/internal/builtin-plugins/gas-analytics/helpers/accessors.ts +1 -1
  164. package/src/internal/builtin-plugins/gas-analytics/helpers/utils.ts +2 -2
  165. package/src/internal/builtin-plugins/gas-analytics/snapshot-cheatcodes.ts +10 -9
  166. package/src/internal/builtin-plugins/gas-analytics/tasks/solidity-test/task-action.ts +11 -5
  167. package/src/internal/builtin-plugins/network-manager/edr/edr-provider.ts +2 -2
  168. package/src/internal/builtin-plugins/network-manager/edr/utils/trace-formatters.ts +23 -23
  169. package/src/internal/builtin-plugins/network-manager/edr/utils/trace-output.ts +14 -11
  170. package/src/internal/builtin-plugins/node/artifacts/build-info-watcher.ts +2 -2
  171. package/src/internal/builtin-plugins/node/helpers.ts +7 -4
  172. package/src/internal/builtin-plugins/node/json-rpc/server.ts +2 -2
  173. package/src/internal/builtin-plugins/node/task-action.ts +5 -4
  174. package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +23 -9
  175. package/src/internal/builtin-plugins/solidity/build-system/compilation-job-cost.ts +61 -0
  176. package/src/internal/builtin-plugins/solidity/build-system/compiler/compiler.ts +17 -3
  177. package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +4 -2
  178. package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +2 -2
  179. package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts +19 -22
  180. package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +9 -1
  181. package/src/internal/builtin-plugins/solidity/build-system/resolver/utils.ts +16 -7
  182. package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +27 -6
  183. package/src/internal/builtin-plugins/solidity/config.ts +5 -2
  184. package/src/internal/builtin-plugins/solidity/constants.ts +3 -0
  185. package/src/internal/builtin-plugins/solidity-test/config.ts +1 -0
  186. package/src/internal/builtin-plugins/solidity-test/helpers.ts +3 -4
  187. package/src/internal/builtin-plugins/solidity-test/reporter.ts +19 -18
  188. package/src/internal/builtin-plugins/solidity-test/task-action.ts +5 -2
  189. package/src/internal/builtin-plugins/solidity-test/type-extensions.ts +1 -0
  190. package/src/internal/builtin-plugins/test/task-action.ts +12 -6
  191. package/src/internal/cli/banner-manager.ts +2 -2
  192. package/src/internal/cli/error-handler.ts +10 -6
  193. package/src/internal/cli/help/get-help-string.ts +2 -2
  194. package/src/internal/cli/init/init.ts +53 -28
  195. package/src/internal/cli/init/package-manager.ts +8 -6
  196. package/src/internal/cli/init/prompt.ts +4 -3
  197. package/src/internal/cli/main.ts +4 -3
  198. package/src/internal/cli/node-version.ts +1 -1
  199. package/src/internal/cli/telemetry/analytics/analytics.ts +2 -2
  200. package/src/internal/cli/telemetry/analytics/utils.ts +2 -2
  201. package/src/internal/cli/telemetry/error-reporter/global-error-handlers.ts +2 -2
  202. package/src/internal/cli/telemetry/sentry/reporter.ts +2 -2
  203. package/src/internal/cli/telemetry/sentry/subprocess.ts +2 -2
  204. package/src/internal/cli/telemetry/sentry/transport.ts +2 -2
  205. package/src/internal/cli/telemetry/telemetry-permissions.ts +2 -2
  206. package/src/internal/config-loading.ts +2 -2
  207. package/src/internal/core/hook-manager.ts +21 -3
  208. package/src/internal/core/user-interruptions.ts +4 -4
  209. package/src/internal/using-hardhat2-plugin-errors.ts +2 -2
  210. package/templates/hardhat-3/01-node-test-runner-viem/package.json +6 -6
  211. package/templates/hardhat-3/02-mocha-ethers/package.json +12 -12
  212. package/templates/hardhat-3/03-minimal/package.json +1 -1
  213. package/dist/src/internal/utils/colorizer.d.ts +0 -10
  214. package/dist/src/internal/utils/colorizer.d.ts.map +0 -1
  215. package/dist/src/internal/utils/colorizer.js +0 -2
  216. package/dist/src/internal/utils/colorizer.js.map +0 -1
  217. package/src/internal/utils/colorizer.ts +0 -9
@@ -1,20 +1,21 @@
1
1
  import type { Response } from "@nomicfoundation/edr";
2
2
 
3
- import chalk from "chalk";
4
- import debug from "debug";
3
+ import { styleText } from "node:util";
4
+
5
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
5
6
 
6
7
  import { formatTraces } from "./trace-formatters.js";
7
8
 
8
- const log = debug("hardhat:core:hardhat-network:provider");
9
+ const log = createDebug("hardhat:core:network-manager:edr:trace-output");
9
10
 
10
11
  // Rotating palette for per-connection coloring of trace headers.
11
12
  const LABEL_COLORS: Array<(text: string) => string> = [
12
- chalk.cyan,
13
- chalk.magenta,
14
- chalk.blueBright,
15
- chalk.yellowBright,
16
- chalk.cyanBright,
17
- chalk.magentaBright,
13
+ (text: string) => styleText("cyan", text),
14
+ (text: string) => styleText("magenta", text),
15
+ (text: string) => styleText("blueBright", text),
16
+ (text: string) => styleText("yellowBright", text),
17
+ (text: string) => styleText("cyanBright", text),
18
+ (text: string) => styleText("magentaBright", text),
18
19
  ];
19
20
 
20
21
  // Keyed by `network name` (not connection label) so the map stays bounded
@@ -107,10 +108,12 @@ export class TraceOutputManager {
107
108
  const coloredLabel = this.#labelColor(this.#connectionLabel);
108
109
  const prefix = callTraces.length > 1 ? "Traces from" : "Trace from";
109
110
  const coloredPrefix = this.#labelColor(prefix);
110
- const styledMethod = failed ? chalk.red(method) : chalk.dim(method);
111
+ const styledMethod = failed
112
+ ? styleText("red", method)
113
+ : styleText("dim", method);
111
114
  const header = `${coloredPrefix} ${coloredLabel}: ${styledMethod}`;
112
115
 
113
- this.#printLineFn(`${header}\n${formatTraces(callTraces, " ", chalk)}`);
116
+ this.#printLineFn(`${header}\n${formatTraces(callTraces, " ")}`);
114
117
  } catch (e) {
115
118
  log("Failed to get call traces: %O", e);
116
119
  }
@@ -2,13 +2,13 @@ import type { FSWatcher } from "chokidar";
2
2
 
3
3
  import path from "node:path";
4
4
 
5
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
5
6
  import { watch } from "chokidar";
6
- import debug from "debug";
7
7
 
8
8
  export type BuildInfoWatcher = FSWatcher;
9
9
  export type BuildInfoHandler = (buildId: string) => Promise<void>;
10
10
 
11
- const log = debug("hardhat:core:tasks:node:artifacts");
11
+ const log = createDebug("hardhat:core:tasks:node:artifacts");
12
12
 
13
13
  const STABILITY_THRESHOLD = 250;
14
14
  const POLL_INTERVAL = 50;
@@ -2,16 +2,17 @@ import type { BuildInfo } from "../../../types/artifacts.js";
2
2
  import type { EdrNetworkAccountsConfig } from "../../../types/config.js";
3
3
  import type { SolidityBuildInfoOutput } from "../../../types/solidity.js";
4
4
  import type { EdrProvider } from "../network-manager/edr/edr-provider.js";
5
+ import type { DebugLogger } from "@nomicfoundation/hardhat-utils/debug";
5
6
  import type * as MicroEthSignerT from "micro-eth-signer";
6
7
 
7
8
  import path from "node:path";
9
+ import { styleText } from "node:util";
8
10
 
9
11
  import {
10
12
  readJsonFile,
11
13
  readJsonFileAsStream,
12
14
  } from "@nomicfoundation/hardhat-utils/fs";
13
15
  import { hexStringToBytes } from "@nomicfoundation/hardhat-utils/hex";
14
- import chalk from "chalk";
15
16
 
16
17
  // micro-eth-signer is known to be slow to load, so we lazy load it
17
18
  let microEthSigner: typeof MicroEthSignerT | undefined;
@@ -94,7 +95,7 @@ export async function formatEdrNetworkConfigAccounts(
94
95
  export function createBuildInfoUploadHandlerFrom(
95
96
  buildInfoDirPath: string,
96
97
  provider: EdrProvider,
97
- log: debug.Debugger,
98
+ log: DebugLogger,
98
99
  ): (buildId: string) => Promise<void> {
99
100
  const buildInfoHandler = async (buildId: string) => {
100
101
  try {
@@ -116,7 +117,8 @@ export function createBuildInfoUploadHandlerFrom(
116
117
  log(`Added compiler result for ${buildId}`);
117
118
  } catch (error) {
118
119
  console.warn(
119
- chalk.yellow(
120
+ styleText(
121
+ "yellow",
120
122
  `There was a problem adding the new compiler result for build ${buildId}.`,
121
123
  ),
122
124
  );
@@ -137,7 +139,8 @@ export function createBuildInfoUploadHandlerFrom(
137
139
 
138
140
  // NOTE: This function is exported for testing purposes only
139
141
  export function getPublicPrivateKeysWarning(): string {
140
- return chalk.bold(
142
+ return styleText(
143
+ "bold",
141
144
  "WARNING: Funds sent on live network to accounts with publicly known private keys WILL BE LOST.",
142
145
  );
143
146
  }
@@ -5,12 +5,12 @@ import type { AddressInfo } from "node:net";
5
5
 
6
6
  import http from "node:http";
7
7
 
8
- import debug from "debug";
8
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
9
9
  import { WebSocketServer } from "ws";
10
10
 
11
11
  import { JsonRpcHandler } from "./handler.js";
12
12
 
13
- const log = debug("hardhat:core:tasks:node:json-rpc:server");
13
+ const log = createDebug("hardhat:core:tasks:node:json-rpc:server");
14
14
 
15
15
  export interface JsonRpcServerConfig {
16
16
  hostname: string;
@@ -3,14 +3,14 @@ import type { ChainType } from "../../../types/network.js";
3
3
  import type { NewTaskActionFunction } from "../../../types/tasks.js";
4
4
 
5
5
  import path from "node:path";
6
+ import { styleText } from "node:util";
6
7
 
7
8
  import {
8
9
  assertHardhatInvariant,
9
10
  HardhatError,
10
11
  } from "@nomicfoundation/hardhat-errors";
12
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
11
13
  import { ensureDir, exists } from "@nomicfoundation/hardhat-utils/fs";
12
- import chalk from "chalk";
13
- import debug from "debug";
14
14
 
15
15
  import { isSupportedChainType } from "../../edr/chain-type.js";
16
16
  import { BUILD_INFO_DIR_NAME } from "../artifacts/artifact-manager.js";
@@ -23,7 +23,7 @@ import {
23
23
  } from "./helpers.js";
24
24
  import { JsonRpcServerImplementation } from "./json-rpc/server.js";
25
25
 
26
- const log = debug("hardhat:core:tasks:node");
26
+ const log = createDebug("hardhat:core:tasks:node");
27
27
 
28
28
  interface NodeActionArguments {
29
29
  hostname?: string;
@@ -143,7 +143,8 @@ const nodeAction: NewTaskActionFunction<NodeActionArguments> = async (
143
143
  const { port: actualPort, address: actualHostname } = await server.listen();
144
144
 
145
145
  console.log(
146
- chalk.green(
146
+ styleText(
147
+ "green",
147
148
  `Started HTTP and WebSocket JSON-RPC server at http://${actualHostname}:${actualPort}/`,
148
149
  ),
149
150
  );
@@ -33,11 +33,13 @@ import type {
33
33
 
34
34
  import os from "node:os";
35
35
  import path from "node:path";
36
+ import { styleText } from "node:util";
36
37
 
37
38
  import {
38
39
  assertHardhatInvariant,
39
40
  HardhatError,
40
41
  } from "@nomicfoundation/hardhat-errors";
42
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
41
43
  import {
42
44
  exists,
43
45
  ensureDir,
@@ -54,8 +56,6 @@ import {
54
56
  import { shortenPath } from "@nomicfoundation/hardhat-utils/path";
55
57
  import { createSpinner } from "@nomicfoundation/hardhat-utils/spinner";
56
58
  import { pluralize } from "@nomicfoundation/hardhat-utils/string";
57
- import chalk from "chalk";
58
- import debug from "debug";
59
59
  import pMap from "p-map";
60
60
 
61
61
  import { FileBuildResultType } from "../../../../types/solidity/build-system.js";
@@ -71,6 +71,7 @@ import {
71
71
  getDuplicatedContractNamesDeclarationFile,
72
72
  } from "./artifacts.js";
73
73
  import { loadCache, saveCache } from "./cache.js";
74
+ import { sortCompilationJobsByDescendingCost } from "./compilation-job-cost.js";
74
75
  import { CompilationJobImplementation } from "./compilation-job.js";
75
76
  import { downloadSolcCompilers, getCompiler } from "./compiler/index.js";
76
77
  import { buildDependencyGraph } from "./dependency-graph-building.js";
@@ -84,7 +85,7 @@ import {
84
85
  import { SolcConfigSelector } from "./solc-config-selection.js";
85
86
  import { shouldSuppressWarning } from "./warning-suppression.js";
86
87
 
87
- const log = debug("hardhat:core:solidity:build-system");
88
+ const log = createDebug("hardhat:core:solidity:build-system");
88
89
 
89
90
  /**
90
91
  * Returns true if the given compiler config is a SolcSolidityCompilerConfig.
@@ -339,8 +340,18 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
339
340
  ),
340
341
  );
341
342
 
342
- const results: CompilationResult[] = await pMap(
343
+ // We sort the compilation jobs in descending order of estimated
344
+ // compilation cost. This way we can use this algorithm:
345
+ // https://en.wikipedia.org/wiki/Longest-processing-time-first_scheduling
346
+ //
347
+ // Note that it works because pMap schedules the jobs in the order they
348
+ // are in the array.
349
+ const sortedCompilationJobs = sortCompilationJobsByDescendingCost(
343
350
  runnableCompilationJobs,
351
+ );
352
+
353
+ const results: CompilationResult[] = await pMap(
354
+ sortedCompilationJobs,
344
355
  async (runnableCompilationJob) => {
345
356
  const { output, compiler } = await this.runCompilationJob(
346
357
  runnableCompilationJob,
@@ -1356,13 +1367,14 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
1356
1367
  error.message;
1357
1368
 
1358
1369
  console.error(
1359
- errorMessage.replace(/^\w+:/, (t) => chalk.red.bold(t)).trimEnd() +
1360
- "\n",
1370
+ errorMessage
1371
+ .replace(/^\w+:/, (t) => styleText(["red", "bold"], t))
1372
+ .trimEnd() + "\n",
1361
1373
  );
1362
1374
  } else {
1363
1375
  console.warn(
1364
1376
  (error.formattedMessage ?? error.message)
1365
- .replace(/^\w+:/, (t) => chalk.yellow.bold(t))
1377
+ .replace(/^\w+:/, (t) => styleText(["yellow", "bold"], t))
1366
1378
  .trimEnd() + "\n",
1367
1379
  );
1368
1380
  }
@@ -1374,7 +1386,8 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
1374
1386
 
1375
1387
  if (hasConsoleErrors) {
1376
1388
  console.error(
1377
- chalk.red(
1389
+ styleText(
1390
+ "red",
1378
1391
  `The console.log call you made isn't supported. See https://hardhat.org/console-log for the list of supported methods.`,
1379
1392
  ),
1380
1393
  );
@@ -1467,7 +1480,8 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
1467
1480
  }
1468
1481
 
1469
1482
  console.log(
1470
- chalk.bold(
1483
+ styleText(
1484
+ "bold",
1471
1485
  `Compiled ${rootFiles} Solidity ${pluralize(
1472
1486
  options.scope === "contracts" ? "file" : "test file",
1473
1487
  rootFiles,
@@ -0,0 +1,61 @@
1
+ import type { CompilationJob } from "../../../../types/solidity.js";
2
+
3
+ import { SOLC_DEFAULT_OPTIMIZER_RUNS } from "../constants.js";
4
+
5
+ // This doesn't need to be exact, it's used to account for the per-file
6
+ // overhead, so that many small files don't look free
7
+ const APPROXIMATE_AVERAGE_SIZE_OF_SOLIDITY_FILES = 10_000;
8
+
9
+ export function estimateCompilationJobCost(job: CompilationJob): number {
10
+ let totalChars = 0;
11
+ let fileCount = 0;
12
+
13
+ for (const file of job.dependencyGraph.getAllFiles()) {
14
+ totalChars += file.content.text.length;
15
+ fileCount += 1;
16
+ }
17
+
18
+ const settings = job.solcConfig.settings ?? {};
19
+ const viaIR = settings.viaIR === true;
20
+ const optimizerEnabled = settings.optimizer?.enabled === true;
21
+ const optimizerRuns: number =
22
+ settings.optimizer?.runs ?? SOLC_DEFAULT_OPTIMIZER_RUNS;
23
+
24
+ const viaIRMultiplier = viaIR === true ? 6.0 : 1.0;
25
+ const optimizerMultiplier = optimizerEnabled ? 1.4 : 1.0;
26
+
27
+ // The optimizer `runs` is not the number of times that the optimizer is run.
28
+ // It represents how many times the contract will be run.
29
+ // While it has an effect in the compilation time, it's not linear nor
30
+ // dominant.
31
+ //
32
+ // We use Math.log10 and Math.min to represent that:
33
+ // - increasing runs probably has diminishing impact in cost
34
+ // - going from 1 -> 200 matters more than 200 -> 20_000
35
+ // - runs should contribute weakly compared with viaIR
36
+ const runsMultiplier = optimizerEnabled
37
+ ? 1 + Math.min(0.12, Math.log10(Math.max(1, optimizerRuns)) * 0.04)
38
+ : 1.0;
39
+
40
+ const fileOverhead = APPROXIMATE_AVERAGE_SIZE_OF_SOLIDITY_FILES * fileCount;
41
+
42
+ return (
43
+ (totalChars + fileOverhead) *
44
+ viaIRMultiplier *
45
+ optimizerMultiplier *
46
+ runsMultiplier
47
+ );
48
+ }
49
+
50
+ /**
51
+ * Returns a new array containing the given compilation jobs sorted by their
52
+ * estimated cost in descending order. The input array is not mutated.
53
+ */
54
+ export function sortCompilationJobsByDescendingCost(
55
+ compilationJobs: CompilationJob[],
56
+ ): CompilationJob[] {
57
+ return compilationJobs
58
+ .map((job) => ({ job, cost: estimateCompilationJobCost(job) }))
59
+ .sort((a, b) => b.cost - a.cost)
60
+ .map(({ job }) => job);
61
+ }
@@ -3,6 +3,7 @@ import type {
3
3
  CompilerOutput,
4
4
  } from "../../../../../types/solidity/compiler-io.js";
5
5
  import type { Compiler } from "../../../../../types/solidity/compiler.js";
6
+ import type { SemverVersion } from "@nomicfoundation/hardhat-utils/fast-semver";
6
7
 
7
8
  import { spawn } from "node:child_process";
8
9
  import fsPromises from "node:fs/promises";
@@ -16,13 +17,19 @@ import {
16
17
  assertHardhatInvariant,
17
18
  } from "@nomicfoundation/hardhat-errors";
18
19
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
20
+ import {
21
+ greaterThanOrEqual,
22
+ parseVersion,
23
+ } from "@nomicfoundation/hardhat-utils/fast-semver";
19
24
  import {
20
25
  mkdtemp,
21
26
  readJsonFileAsStream,
22
27
  remove,
23
28
  } from "@nomicfoundation/hardhat-utils/fs";
24
29
  import { createNonClosingWriter } from "@nomicfoundation/hardhat-utils/stream";
25
- import * as semver from "semver";
30
+
31
+ const NO_IMPORT_CALLBACK_MIN_VERSION: SemverVersion = [0, 8, 22];
32
+ const BASE_PATH_MIN_VERSION: SemverVersion = [0, 6, 9];
26
33
 
27
34
  /**
28
35
  * Spawns a compilation process and returns its output.
@@ -163,10 +170,17 @@ export class NativeCompiler implements Compiler {
163
170
  // Logic to make sure that solc default import callback is not being used.
164
171
  // If solcVersion is not defined or <= 0.6.8, do not add extra args.
165
172
  if (this.version !== undefined) {
166
- if (semver.gte(this.version, "0.8.22")) {
173
+ const parsed = parseVersion(this.version);
174
+ if (parsed === undefined) {
175
+ throw new HardhatError(
176
+ HardhatError.ERRORS.CORE.SOLIDITY.INVALID_SOLC_VERSION,
177
+ { version: this.version },
178
+ );
179
+ }
180
+ if (greaterThanOrEqual(parsed, NO_IMPORT_CALLBACK_MIN_VERSION)) {
167
181
  // version >= 0.8.22
168
182
  args.push("--no-import-callback");
169
- } else if (semver.gte(this.version, "0.6.9")) {
183
+ } else if (greaterThanOrEqual(parsed, BASE_PATH_MIN_VERSION)) {
170
184
  // version >= 0.6.9
171
185
  const tmpFolder = await mkdtemp("hardhat-solc-");
172
186
  args.push(`--base-path`);
@@ -11,6 +11,7 @@ import {
11
11
  } from "@nomicfoundation/hardhat-errors";
12
12
  import { bytesToHexString } from "@nomicfoundation/hardhat-utils/bytes";
13
13
  import { sha256 } from "@nomicfoundation/hardhat-utils/crypto";
14
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
14
15
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
15
16
  import {
16
17
  chmod,
@@ -26,11 +27,12 @@ import { getPrefixedHexString } from "@nomicfoundation/hardhat-utils/hex";
26
27
  import { download } from "@nomicfoundation/hardhat-utils/request";
27
28
  import { MultiProcessMutex } from "@nomicfoundation/hardhat-utils/synchronization";
28
29
  import AdmZip from "adm-zip";
29
- import debug from "debug";
30
30
 
31
31
  import { NativeCompiler, SolcJsCompiler } from "./compiler.js";
32
32
 
33
- const log = debug("hardhat:solidity:downloader");
33
+ const log = createDebug(
34
+ "hardhat:core:solidity:build-system:compiler:downloader",
35
+ );
34
36
 
35
37
  const COMPILER_REPOSITORY_URL = "https://binaries.soliditylang.org";
36
38
  const DEFAULT_COMPILER_DOWNLOAD_RETRY_COUNT = 3;
@@ -9,9 +9,9 @@ import {
9
9
  assertHardhatInvariant,
10
10
  HardhatError,
11
11
  } from "@nomicfoundation/hardhat-errors";
12
+ import { createDebug } from "@nomicfoundation/hardhat-utils/debug";
12
13
  import { exists, isBinaryFile } from "@nomicfoundation/hardhat-utils/fs";
13
14
  import { getCacheDir } from "@nomicfoundation/hardhat-utils/global-dir";
14
- import debug from "debug";
15
15
 
16
16
  import { hasArm64MirrorBuild, hasOfficialArm64Build } from "../solc-info.js";
17
17
 
@@ -28,7 +28,7 @@ async function getGlobalCompilersCacheDir(): Promise<string> {
28
28
  return path.join(globalCompilersCacheDir, "compilers-v3");
29
29
  }
30
30
 
31
- const log = debug("hardhat:core:solidity:build-system:compiler");
31
+ const log = createDebug("hardhat:core:solidity:build-system:compiler");
32
32
 
33
33
  /**
34
34
  * Returns true if a platform-specific build exists for the given version
@@ -1,8 +1,18 @@
1
1
  // This wrapper was created by extracting the parts of the solc-js package
2
2
  // (https://github.com/ethereum/solc-js) that we need to perform compilation.
3
3
 
4
- import { HardhatError } from "@nomicfoundation/hardhat-errors";
5
- import * as semver from "semver";
4
+ import type { SemverVersion } from "@nomicfoundation/hardhat-utils/fast-semver";
5
+
6
+ import {
7
+ HardhatError,
8
+ assertHardhatInvariant,
9
+ } from "@nomicfoundation/hardhat-errors";
10
+ import {
11
+ greaterThanOrEqual,
12
+ parseVersion,
13
+ } from "@nomicfoundation/hardhat-utils/fast-semver";
14
+
15
+ const VERSION_6: SemverVersion = [0, 6, 0];
6
16
 
7
17
  interface Solc {
8
18
  cwrap<T>(ident: string, returnType: string | null, argTypes: string[]): T;
@@ -36,8 +46,13 @@ export type CompileWrapper = (input: string) => string;
36
46
 
37
47
  export default function wrapper(solc: Solc): SolcWrapper {
38
48
  const version = bindVersion(solc);
39
- const semverVersion = versionToSemver(version());
40
- const isVersion6OrNewer = semver.gte(semverVersion, "0.6.0");
49
+ const rawVersion = version();
50
+ const parsedVersion = parseVersion(rawVersion);
51
+ assertHardhatInvariant(
52
+ parsedVersion !== undefined,
53
+ `Invalid solc version: ${rawVersion}`,
54
+ );
55
+ const isVersion6OrNewer = greaterThanOrEqual(parsedVersion, VERSION_6);
41
56
  const reset = bindReset(solc);
42
57
  const compile = bindCompile(solc, isVersion6OrNewer);
43
58
 
@@ -124,21 +139,3 @@ function bindCompile(
124
139
 
125
140
  return undefined;
126
141
  }
127
-
128
- function versionToSemver(version: string): string {
129
- // FIXME: parse more detail, but this is a good start
130
- const parsed = version.match(
131
- /^([0-9]+\.[0-9]+\.[0-9]+)-([0-9a-f]{8})[/*].*$/,
132
- );
133
- if (parsed !== null) {
134
- return parsed[1] + "+commit." + parsed[2];
135
- }
136
- if (version.indexOf("0.1.3-0") !== -1) {
137
- return "0.1.3";
138
- }
139
- if (version.indexOf("0.3.5-0") !== -1) {
140
- return "0.3.5";
141
- }
142
- // assume it is already semver compatible
143
- return version;
144
- }
@@ -24,7 +24,10 @@ import type { Result } from "../../../../../types/utils.js";
24
24
  import path from "node:path";
25
25
 
26
26
  import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
27
- import { exists } from "@nomicfoundation/hardhat-utils/fs";
27
+ import {
28
+ exists,
29
+ TrueCasePathResolver,
30
+ } from "@nomicfoundation/hardhat-utils/fs";
28
31
  import { AsyncMutex } from "@nomicfoundation/hardhat-utils/synchronization";
29
32
  import { analyze } from "@nomicfoundation/solidity-analyzer";
30
33
 
@@ -82,6 +85,9 @@ export class ResolverImplementation implements Resolver {
82
85
  */
83
86
  readonly #fakeRootFile: ProjectResolvedFile;
84
87
 
88
+ readonly #trueCasePathResolver: TrueCasePathResolver =
89
+ new TrueCasePathResolver();
90
+
85
91
  /**
86
92
  * Creates a new resolver.
87
93
  *
@@ -221,6 +227,7 @@ export class ResolverImplementation implements Resolver {
221
227
  }
222
228
 
223
229
  const pathValidation = await validateFsPath(
230
+ this.#trueCasePathResolver,
224
231
  this.#projectRoot,
225
232
  relativeFilePath,
226
233
  );
@@ -839,6 +846,7 @@ export class ResolverImplementation implements Resolver {
839
846
  >
840
847
  > {
841
848
  const pathValidation = await validateFsPath(
849
+ this.#trueCasePathResolver,
842
850
  npmPackage.rootFsPath,
843
851
  relativeFsPathWithinPackage,
844
852
  );
@@ -1,11 +1,12 @@
1
1
  import type { ResolvedNpmPackage } from "../../../../../types/solidity.js";
2
2
  import type { Result } from "../../../../../types/utils.js";
3
+ import type { TrueCasePathResolver } from "@nomicfoundation/hardhat-utils/fs";
3
4
 
4
5
  import { assertHardhatInvariant } from "@nomicfoundation/hardhat-errors";
5
6
  import { ensureError } from "@nomicfoundation/hardhat-utils/error";
6
7
  import {
7
8
  FileNotFoundError,
8
- getFileTrueCase,
9
+ NotADirectoryError,
9
10
  } from "@nomicfoundation/hardhat-utils/fs";
10
11
  import { exports } from "resolve.exports";
11
12
 
@@ -15,6 +16,7 @@ export enum PathValidationErrorType {
15
16
  }
16
17
 
17
18
  export async function validateFsPath(
19
+ resolver: TrueCasePathResolver,
18
20
  from: string,
19
21
  relative: string,
20
22
  ): Promise<
@@ -26,14 +28,21 @@ export async function validateFsPath(
26
28
  > {
27
29
  let trueCaseFsPath: string;
28
30
  try {
29
- trueCaseFsPath = await getFileTrueCase(from, relative);
31
+ trueCaseFsPath = await resolver.getFileTrueCase(from, relative);
30
32
  } catch (error) {
31
- ensureError(error, FileNotFoundError);
33
+ ensureError(error);
32
34
 
33
- return {
34
- success: false,
35
- error: { type: PathValidationErrorType.DOES_NOT_EXIST },
36
- };
35
+ if (
36
+ error instanceof FileNotFoundError ||
37
+ error instanceof NotADirectoryError
38
+ ) {
39
+ return {
40
+ success: false,
41
+ error: { type: PathValidationErrorType.DOES_NOT_EXIST },
42
+ };
43
+ }
44
+
45
+ throw error;
37
46
  }
38
47
 
39
48
  if (relative !== trueCaseFsPath) {
@@ -1,19 +1,33 @@
1
+ import type { SemverVersion } from "@nomicfoundation/hardhat-utils/fast-semver";
2
+
1
3
  import os from "node:os";
2
4
 
3
- import semver from "semver";
5
+ import { HardhatError } from "@nomicfoundation/hardhat-errors";
6
+ import {
7
+ greaterThanOrEqual,
8
+ lowerThan,
9
+ parseVersion,
10
+ } from "@nomicfoundation/hardhat-utils/fast-semver";
4
11
 
5
12
  // The first solc version with official ARM64 Linux builds
6
- export const FIRST_OFFICIAL_ARM64_SOLC_VERSION = "0.8.31";
13
+ export const FIRST_OFFICIAL_ARM64_SOLC_VERSION: SemverVersion = [0, 8, 31];
7
14
 
8
15
  // The lowest solc version available in the frozen ARM64 mirror repo
9
16
  // (https://github.com/NomicFoundation/solc-linux-arm64-mirror/tree/main/public/linux/aarch64)
10
- export const FIRST_ARM64_MIRROR_SOLC_VERSION = "0.5.0";
17
+ export const FIRST_ARM64_MIRROR_SOLC_VERSION: SemverVersion = [0, 5, 0];
11
18
 
12
19
  /**
13
20
  * Determines if a solc version has an official ARM64 Linux build.
14
21
  */
15
22
  export function hasOfficialArm64Build(version: string): boolean {
16
- return semver.gte(version, FIRST_OFFICIAL_ARM64_SOLC_VERSION);
23
+ const parsed = parseVersion(version);
24
+ if (parsed === undefined) {
25
+ throw new HardhatError(
26
+ HardhatError.ERRORS.CORE.SOLIDITY.INVALID_SOLC_VERSION,
27
+ { version },
28
+ );
29
+ }
30
+ return greaterThanOrEqual(parsed, FIRST_OFFICIAL_ARM64_SOLC_VERSION);
17
31
  }
18
32
 
19
33
  /**
@@ -21,9 +35,16 @@ export function hasOfficialArm64Build(version: string): boolean {
21
35
  * in the community mirror (versions 0.5.0–0.8.30).
22
36
  */
23
37
  export function hasArm64MirrorBuild(version: string): boolean {
38
+ const parsed = parseVersion(version);
39
+ if (parsed === undefined) {
40
+ throw new HardhatError(
41
+ HardhatError.ERRORS.CORE.SOLIDITY.INVALID_SOLC_VERSION,
42
+ { version },
43
+ );
44
+ }
24
45
  return (
25
- semver.gte(version, FIRST_ARM64_MIRROR_SOLC_VERSION) === true &&
26
- semver.lt(version, FIRST_OFFICIAL_ARM64_SOLC_VERSION) === true
46
+ greaterThanOrEqual(parsed, FIRST_ARM64_MIRROR_SOLC_VERSION) &&
47
+ lowerThan(parsed, FIRST_OFFICIAL_ARM64_SOLC_VERSION)
27
48
  );
28
49
  }
29
50
 
@@ -32,7 +32,10 @@ import {
32
32
  hasOfficialArm64Build,
33
33
  missesSomeOfficialNativeBuilds,
34
34
  } from "./build-system/solc-info.js";
35
- import { DEFAULT_OUTPUT_SELECTION } from "./constants.js";
35
+ import {
36
+ DEFAULT_OUTPUT_SELECTION,
37
+ SOLC_DEFAULT_OPTIMIZER_RUNS,
38
+ } from "./constants.js";
36
39
 
37
40
  /**
38
41
  * The top-level type SolidityUserConfig is a union type too complex for
@@ -542,7 +545,7 @@ function resolveSolidityCompilerConfig(
542
545
  if (production && isSolcSolidityCompilerUserConfig(compilerConfig)) {
543
546
  defaultSettings.optimizer = {
544
547
  enabled: true,
545
- runs: 200,
548
+ runs: SOLC_DEFAULT_OPTIMIZER_RUNS,
546
549
  };
547
550
  }
548
551
 
@@ -19,3 +19,6 @@ export const DEFAULT_OUTPUT_SELECTION: CompilerInput["settings"]["outputSelectio
19
19
  ],
20
20
  },
21
21
  };
22
+
23
+ // This is the default that solc uses, which we also use during resolution
24
+ export const SOLC_DEFAULT_OPTIMIZER_RUNS = 200;
@@ -61,6 +61,7 @@ const solidityTestUserConfigType = z.object({
61
61
  dictionaryWeight: z.number().optional(),
62
62
  includeStorage: z.boolean().optional(),
63
63
  includePushBytes: z.boolean().optional(),
64
+ showLogs: z.boolean().optional(),
64
65
  })
65
66
  .optional(),
66
67
  forking: z