hardhat 3.1.7 → 3.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js +7 -8
- package/dist/src/internal/builtin-plugins/coverage/hook-handlers/solidity.js.map +1 -1
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts +27 -0
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.d.ts.map +1 -0
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.js +27 -0
- package/dist/src/internal/builtin-plugins/coverage/instrumentation.js.map +1 -0
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts +0 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js +2 -6
- package/dist/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts +4 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +19 -2
- package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js +6 -6
- package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts +10 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js +17 -0
- package/dist/src/internal/builtin-plugins/solidity/build-system/solc-info.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.d.ts +0 -1
- package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/config.js +17 -8
- package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +2 -0
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity/type-extensions.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +2 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +8 -4
- package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +10 -0
- package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
- package/dist/src/internal/cli/telemetry/sentry/transport.js +1 -0
- package/dist/src/internal/cli/telemetry/sentry/transport.js.map +1 -1
- package/package.json +2 -2
- package/src/internal/builtin-plugins/coverage/hook-handlers/solidity.ts +6 -17
- package/src/internal/builtin-plugins/coverage/instrumentation.ts +52 -0
- package/src/internal/builtin-plugins/gas-analytics/gas-analytics-manager.ts +2 -7
- package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +31 -2
- package/src/internal/builtin-plugins/solidity/build-system/compiler/downloader.ts +8 -6
- package/src/internal/builtin-plugins/solidity/build-system/solc-info.ts +22 -0
- package/src/internal/builtin-plugins/solidity/config.ts +21 -10
- package/src/internal/builtin-plugins/solidity/type-extensions.ts +2 -0
- package/src/internal/builtin-plugins/solidity-test/helpers.ts +14 -4
- package/src/internal/builtin-plugins/solidity-test/task-action.ts +11 -0
- package/src/internal/cli/telemetry/sentry/transport.ts +1 -0
- package/templates/hardhat-3/01-node-test-runner-viem/package.json +2 -2
- package/templates/hardhat-3/02-mocha-ethers/package.json +3 -3
- package/templates/hardhat-3/03-minimal/package.json +1 -1
|
@@ -11,8 +11,6 @@ import type {
|
|
|
11
11
|
} from "../../../types/config.js";
|
|
12
12
|
import type { HardhatUserConfigValidationError } from "../../../types/hooks.js";
|
|
13
13
|
|
|
14
|
-
import os from "node:os";
|
|
15
|
-
|
|
16
14
|
import { deepMerge, isObject } from "@nomicfoundation/hardhat-utils/lang";
|
|
17
15
|
import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
|
|
18
16
|
import {
|
|
@@ -23,6 +21,10 @@ import {
|
|
|
23
21
|
import { z } from "zod";
|
|
24
22
|
|
|
25
23
|
import { DEFAULT_BUILD_PROFILES } from "./build-profiles.js";
|
|
24
|
+
import {
|
|
25
|
+
hasOfficialArm64Build,
|
|
26
|
+
missesSomeOfficialNativeBuilds,
|
|
27
|
+
} from "./build-system/solc-info.js";
|
|
26
28
|
|
|
27
29
|
const sourcePathsType = conditionalUnionType(
|
|
28
30
|
[
|
|
@@ -39,6 +41,8 @@ const commonSolcUserConfigType = z.object({
|
|
|
39
41
|
const solcUserConfigType = z.object({
|
|
40
42
|
version: z.string(),
|
|
41
43
|
settings: z.any().optional(),
|
|
44
|
+
path: z.string().optional(),
|
|
45
|
+
preferWasm: z.boolean().optional(),
|
|
42
46
|
compilers: incompatibleFieldType("This field is incompatible with `version`"),
|
|
43
47
|
overrides: incompatibleFieldType("This field is incompatible with `version`"),
|
|
44
48
|
profiles: incompatibleFieldType("This field is incompatible with `version`"),
|
|
@@ -290,7 +294,7 @@ function resolveBuildProfileConfig(
|
|
|
290
294
|
compilers: [resolveSolcConfig(solidityConfig, production)],
|
|
291
295
|
overrides: {},
|
|
292
296
|
isolated: solidityConfig.isolated ?? production,
|
|
293
|
-
preferWasm: solidityConfig.preferWasm ??
|
|
297
|
+
preferWasm: solidityConfig.preferWasm ?? false,
|
|
294
298
|
};
|
|
295
299
|
}
|
|
296
300
|
|
|
@@ -307,7 +311,7 @@ function resolveBuildProfileConfig(
|
|
|
307
311
|
),
|
|
308
312
|
),
|
|
309
313
|
isolated: solidityConfig.isolated ?? production,
|
|
310
|
-
preferWasm: solidityConfig.preferWasm ??
|
|
314
|
+
preferWasm: solidityConfig.preferWasm ?? false,
|
|
311
315
|
};
|
|
312
316
|
}
|
|
313
317
|
|
|
@@ -337,10 +341,23 @@ function resolveSolcConfig(
|
|
|
337
341
|
};
|
|
338
342
|
}
|
|
339
343
|
|
|
344
|
+
// Resolve per-compiler preferWasm:
|
|
345
|
+
// If explicitly set, use that value.
|
|
346
|
+
// Otherwise, for ARM64 Linux in production, default to true only for
|
|
347
|
+
// versions without official ARM64 builds.
|
|
348
|
+
let resolvedPreferWasm: boolean | undefined = solcConfig.preferWasm;
|
|
349
|
+
if (resolvedPreferWasm === undefined && missesSomeOfficialNativeBuilds()) {
|
|
350
|
+
resolvedPreferWasm =
|
|
351
|
+
production && !hasOfficialArm64Build(solcConfig.version)
|
|
352
|
+
? true
|
|
353
|
+
: undefined;
|
|
354
|
+
}
|
|
355
|
+
|
|
340
356
|
return {
|
|
341
357
|
version: solcConfig.version,
|
|
342
358
|
settings: deepMerge(defaultSolcConfigSettings, solcConfig.settings ?? {}),
|
|
343
359
|
path: solcConfig.path,
|
|
360
|
+
preferWasm: resolvedPreferWasm,
|
|
344
361
|
};
|
|
345
362
|
}
|
|
346
363
|
|
|
@@ -369,9 +386,3 @@ function copyFromDefault(
|
|
|
369
386
|
),
|
|
370
387
|
};
|
|
371
388
|
}
|
|
372
|
-
|
|
373
|
-
// We use wasm builds in production to avoid using unofficial builds for deployments
|
|
374
|
-
// This should change once https://github.com/ethereum/solidity/issues/11351 gets resolved
|
|
375
|
-
export function shouldUseWasm(): boolean {
|
|
376
|
-
return os.platform() === "linux" && os.arch() === "arm64";
|
|
377
|
-
}
|
|
@@ -24,6 +24,7 @@ declare module "../../../types/config.js" {
|
|
|
24
24
|
version: string;
|
|
25
25
|
settings?: any;
|
|
26
26
|
path?: string;
|
|
27
|
+
preferWasm?: boolean;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export interface SingleVersionSolcUserConfig extends SolcUserConfig {
|
|
@@ -66,6 +67,7 @@ declare module "../../../types/config.js" {
|
|
|
66
67
|
version: string;
|
|
67
68
|
settings: any;
|
|
68
69
|
path?: string;
|
|
70
|
+
preferWasm?: boolean;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
export interface SolidityBuildProfileConfig {
|
|
@@ -11,23 +11,26 @@ import type {
|
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
opGenesisState,
|
|
14
|
-
opLatestHardfork,
|
|
15
14
|
l1GenesisState,
|
|
16
|
-
l1HardforkLatest,
|
|
17
15
|
IncludeTraces,
|
|
18
16
|
FsAccessPermission,
|
|
19
17
|
CollectStackTraces,
|
|
18
|
+
opHardforkFromString,
|
|
19
|
+
l1HardforkFromString,
|
|
20
20
|
} from "@nomicfoundation/edr";
|
|
21
21
|
import { hexStringToBytes } from "@nomicfoundation/hardhat-utils/hex";
|
|
22
22
|
import chalk from "chalk";
|
|
23
23
|
|
|
24
24
|
import { DEFAULT_VERBOSITY, OPTIMISM_CHAIN_TYPE } from "../../constants.js";
|
|
25
|
+
import { resolveHardfork } from "../network-manager/config-resolution.js";
|
|
26
|
+
import { hardhatHardforkToEdrSpecId } from "../network-manager/edr/utils/convert-to-edr.js";
|
|
25
27
|
|
|
26
28
|
import { type Colorizer, formatArtifactId } from "./formatters.js";
|
|
27
29
|
|
|
28
30
|
interface SolidityTestConfigParams {
|
|
29
31
|
chainType: ChainType;
|
|
30
32
|
projectRoot: string;
|
|
33
|
+
hardfork?: string;
|
|
31
34
|
config: SolidityTestConfig;
|
|
32
35
|
verbosity: number;
|
|
33
36
|
observability?: ObservabilityConfig;
|
|
@@ -48,6 +51,7 @@ export function solidityTestConfigToRunOptions(
|
|
|
48
51
|
export async function solidityTestConfigToSolidityTestRunnerConfigArgs({
|
|
49
52
|
chainType,
|
|
50
53
|
projectRoot,
|
|
54
|
+
hardfork,
|
|
51
55
|
config,
|
|
52
56
|
verbosity,
|
|
53
57
|
observability,
|
|
@@ -92,10 +96,15 @@ export async function solidityTestConfigToSolidityTestRunnerConfigArgs({
|
|
|
92
96
|
? undefined
|
|
93
97
|
: hexStringToBuffer(config.coinbase);
|
|
94
98
|
|
|
99
|
+
const resolvedHardfork = hardhatHardforkToEdrSpecId(
|
|
100
|
+
resolveHardfork(hardfork, chainType),
|
|
101
|
+
chainType,
|
|
102
|
+
);
|
|
103
|
+
|
|
95
104
|
const localPredeploys =
|
|
96
105
|
chainType === OPTIMISM_CHAIN_TYPE
|
|
97
|
-
? opGenesisState(
|
|
98
|
-
: l1GenesisState(
|
|
106
|
+
? opGenesisState(opHardforkFromString(resolvedHardfork))
|
|
107
|
+
: l1GenesisState(l1HardforkFromString(resolvedHardfork));
|
|
99
108
|
|
|
100
109
|
let includeTraces: IncludeTraces = IncludeTraces.None;
|
|
101
110
|
if (verbosity >= 5) {
|
|
@@ -131,6 +140,7 @@ export async function solidityTestConfigToSolidityTestRunnerConfigArgs({
|
|
|
131
140
|
|
|
132
141
|
return {
|
|
133
142
|
projectRoot,
|
|
143
|
+
hardfork: resolvedHardfork,
|
|
134
144
|
...config,
|
|
135
145
|
fsPermissions,
|
|
136
146
|
localPredeploys,
|
|
@@ -158,10 +158,21 @@ const runSolidityTests: NewTaskActionFunction<TestActionArguments> = async (
|
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
// Extract hardfork from the selected network configuration
|
|
162
|
+
let hardfork: string | undefined;
|
|
163
|
+
if (hre.globalOptions.network !== undefined) {
|
|
164
|
+
const networkName = hre.globalOptions.network;
|
|
165
|
+
const networkConfig = hre.config.networks[networkName];
|
|
166
|
+
if (networkConfig !== undefined && networkConfig.type === "edr-simulated") {
|
|
167
|
+
hardfork = networkConfig.hardfork;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
161
171
|
const config: SolidityTestRunnerConfigArgs =
|
|
162
172
|
await solidityTestConfigToSolidityTestRunnerConfigArgs({
|
|
163
173
|
chainType,
|
|
164
174
|
projectRoot: hre.config.paths.root,
|
|
175
|
+
hardfork,
|
|
165
176
|
config: solidityTestConfig,
|
|
166
177
|
verbosity,
|
|
167
178
|
observability: observabilityConfig,
|
|
@@ -177,6 +177,7 @@ async function sendSerializedEnvelopeToSentryBackend(
|
|
|
177
177
|
.filter(Boolean)
|
|
178
178
|
.join(", ");
|
|
179
179
|
|
|
180
|
+
// eslint-disable-next-line no-restricted-globals -- TODO: determine whether this should be using undici
|
|
180
181
|
const res = await fetch(ingestUrl, {
|
|
181
182
|
method: "POST",
|
|
182
183
|
headers: {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "A TypeScript Hardhat project using Node Test Runner and Viem",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"hardhat": "workspace:^3.1.
|
|
8
|
+
"hardhat": "workspace:^3.1.9",
|
|
9
9
|
"@nomicfoundation/hardhat-toolbox-viem": "workspace:^5.0.2",
|
|
10
10
|
"@nomicfoundation/hardhat-ignition": "workspace:^3.0.7",
|
|
11
11
|
"@types/node": "^22.8.5",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@nomicfoundation/hardhat-node-test-runner": "workspace:^3.0.8",
|
|
21
21
|
"@nomicfoundation/hardhat-viem": "workspace:^3.0.2",
|
|
22
22
|
"@nomicfoundation/hardhat-viem-assertions": "workspace:^3.0.5",
|
|
23
|
-
"@nomicfoundation/hardhat-verify": "workspace:^3.0.
|
|
23
|
+
"@nomicfoundation/hardhat-verify": "workspace:^3.0.10",
|
|
24
24
|
"@nomicfoundation/ignition-core": "workspace:^3.0.7"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "A TypeScript Hardhat project using Mocha and Ethers.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"hardhat": "workspace:^3.1.
|
|
8
|
+
"hardhat": "workspace:^3.1.9",
|
|
9
9
|
"@nomicfoundation/hardhat-toolbox-mocha-ethers": "workspace:^3.0.2",
|
|
10
10
|
"@nomicfoundation/hardhat-ethers": "workspace:^4.0.4",
|
|
11
11
|
"@nomicfoundation/hardhat-ignition": "workspace:^3.0.7",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"@nomicfoundation/hardhat-ignition": "workspace:^3.0.7",
|
|
26
26
|
"@nomicfoundation/hardhat-ignition-ethers": "workspace:^3.0.7",
|
|
27
27
|
"@nomicfoundation/hardhat-keystore": "workspace:^3.0.4",
|
|
28
|
-
"@nomicfoundation/hardhat-mocha": "workspace:^3.0.
|
|
28
|
+
"@nomicfoundation/hardhat-mocha": "workspace:^3.0.10",
|
|
29
29
|
"@nomicfoundation/hardhat-network-helpers": "workspace:^3.0.3",
|
|
30
30
|
"@nomicfoundation/hardhat-typechain": "workspace:^3.0.2",
|
|
31
|
-
"@nomicfoundation/hardhat-verify": "workspace:^3.0.
|
|
31
|
+
"@nomicfoundation/hardhat-verify": "workspace:^3.0.10",
|
|
32
32
|
"@nomicfoundation/ignition-core": "workspace:^3.0.7"
|
|
33
33
|
}
|
|
34
34
|
}
|