Skip to content

Commit a8ad44c

Browse files
Prepare for next Node LTS version - branch: main (#6497)
1 parent 5d828f7 commit a8ad44c

14 files changed

Lines changed: 120 additions & 80 deletions

File tree

.changeset/short-mangos-watch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"hardhat": patch
3+
---
4+
5+
Added support for Node v24.

.github/workflows/hardhat-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
matrix:
7272
package: ${{ fromJson(needs.list-packages.outputs.packages) }}
7373
os: [ubuntu-latest, macos-latest, windows-latest]
74-
node: [18, 20, 22]
74+
node: [20, 22, 24]
7575
exclude:
7676
- package: hardhat-vyper
7777
os: windows-latest

.github/workflows/hardhat-core-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ jobs:
112112
runs-on: ubuntu-latest
113113
strategy:
114114
matrix:
115-
# TODO: Currently there is no @types/node for Node 22,
115+
# TODO: Currently there is no @types/node for Node 24,
116116
# include it when it is available.
117-
node: [18, 20]
117+
node: [20, 22]
118118
steps:
119119
- uses: actions/checkout@v4
120120
- uses: ./.github/actions/setup-env

packages/hardhat-chai-matchers/test/contracts.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import {
22
BaseContract,
3-
BaseContractMethod,
3+
// eslint-disable-next-line prettier/prettier
4+
type BaseContractMethod,
45
ContractTransactionResponse,
5-
BigNumberish,
6-
AddressLike,
6+
// eslint-disable-next-line prettier/prettier
7+
type BigNumberish,
8+
// eslint-disable-next-line prettier/prettier
9+
type AddressLike,
710
} from "ethers";
811

912
export type MatchersContract = BaseContract & {
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
export const SUPPORTED_NODE_VERSIONS = ["^18.0.0", "^20.0.0", "^22.0.0"];
1+
// TODO: Remove 18 on June 30, 2025
2+
export const SUPPORTED_NODE_VERSIONS = [
3+
"^18.0.0",
4+
"^20.0.0",
5+
"^22.0.0",
6+
"^24.0.0",
7+
];

packages/hardhat-core/src/internal/core/config/config-loading.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export function importCsjOrEsModule(filePath: string): any {
3333
// because Hardhat configs can only be CJS but a .js extension will be interpreted as ESM.
3434
// The kind of error we get in these cases depends on the Node.js version.
3535
const node20Heuristic = e.code === "ERR_REQUIRE_ESM";
36+
// Also works for node v24
3637
const node22Heuristic =
3738
e.message === "module is not defined" ||
3839
e.message === "require is not defined";

packages/hardhat-core/test/internal/cli/is-node-version-to-warn-on.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ describe("isNodeVersionToWarnOn", function () {
1111

1212
assert.isFalse(isNodeVersionToWarnOn("v22.0.0"));
1313
assert.isFalse(isNodeVersionToWarnOn("v22.3.0"));
14-
});
1514

16-
it("Should not warn on even newer versions even if they are unsupported", function () {
1715
assert.isFalse(isNodeVersionToWarnOn("v24.0.0"));
1816
assert.isFalse(isNodeVersionToWarnOn("v24.3.0"));
1917
});
2018

19+
it("Should not warn on even newer versions even if they are unsupported", function () {
20+
assert.isFalse(isNodeVersionToWarnOn("v26.0.0"));
21+
assert.isFalse(isNodeVersionToWarnOn("v26.3.0"));
22+
});
23+
2124
it("Should warn on unsupported older node versions", function () {
2225
assert(isNodeVersionToWarnOn("v10.0.0"));
2326
assert(isNodeVersionToWarnOn("v10.24.1"));

packages/hardhat-ethers/test/helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { assert } from "chai";
2-
import { ContractRunner, Signer } from "ethers";
2+
// eslint-disable-next-line prettier/prettier
3+
import { type ContractRunner, type Signer } from "ethers";
34

45
export function assertWithin(
56
value: number | bigint,

packages/hardhat-ignition-core/test/execution/future-processor/utils.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,17 @@ function setupMockJsonRpcClient(
9393
}
9494

9595
class MockJsonRpcClient implements JsonRpcClient {
96-
private _blockNumber = 10;
96+
#blockNumber = 10;
97+
#transactions: { [key: string]: TransactionReceipt };
98+
#sendTransaction: (transactionParams: TransactionParams) => Promise<string>;
9799

98100
constructor(
99-
private _sendTransaction: (
100-
transactionParams: TransactionParams
101-
) => Promise<string>,
102-
private _transactions: { [key: string]: TransactionReceipt }
103-
) {}
101+
sendTransaction: (transactionParams: TransactionParams) => Promise<string>,
102+
transactions: { [key: string]: TransactionReceipt }
103+
) {
104+
this.#sendTransaction = sendTransaction;
105+
this.#transactions = transactions;
106+
}
104107

105108
public async getChainId(): Promise<number> {
106109
return 31337;
@@ -113,7 +116,7 @@ class MockJsonRpcClient implements JsonRpcClient {
113116
}
114117

115118
public async getLatestBlock(): Promise<Block> {
116-
const blockNumber = this._blockNumber++;
119+
const blockNumber = this.#blockNumber++;
117120

118121
return {
119122
hash: `0xblockhash-${blockNumber}`,
@@ -152,7 +155,7 @@ class MockJsonRpcClient implements JsonRpcClient {
152155
public async sendTransaction(
153156
transactionParams: TransactionParams
154157
): Promise<string> {
155-
return this._sendTransaction(transactionParams);
158+
return this.#sendTransaction(transactionParams);
156159
}
157160

158161
public async sendRawTransaction(_presignedTx: string): Promise<string> {
@@ -181,11 +184,11 @@ class MockJsonRpcClient implements JsonRpcClient {
181184
txHash: string
182185
): Promise<TransactionReceipt | undefined> {
183186
assertIgnitionInvariant(
184-
txHash in this._transactions,
187+
txHash in this.#transactions,
185188
`No transaction registered in test for the hash ${txHash}`
186189
);
187190

188-
return this._transactions[txHash];
191+
return this.#transactions[txHash];
189192
}
190193

191194
public async getCode(_address: string): Promise<string> {

packages/hardhat-ignition-core/test/reconciliation/helpers.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,30 @@ class MockArtifactResolver implements ArtifactResolver {
9292
}
9393

9494
export class ArtifactMapResolver extends MockArtifactResolver {
95-
constructor(
96-
private readonly _artifactMap: { [artifactId: string]: Artifact } = {}
97-
) {
95+
readonly #artifactMap: { [artifactId: string]: Artifact };
96+
97+
constructor(artifactMap: { [artifactId: string]: Artifact } = {}) {
9898
super();
99+
100+
this.#artifactMap = artifactMap;
99101
}
100102

101103
public async loadArtifact(contractName: string): Promise<Artifact> {
102-
return this._artifactMap[contractName];
104+
return this.#artifactMap[contractName];
103105
}
104106
}
105107

106108
export class ArtifactMapDeploymentLoader extends MockDeploymentLoader {
107-
constructor(
108-
private readonly _artifactMap: { [artifactId: string]: Artifact } = {}
109-
) {
109+
readonly #artifactMap: { [artifactId: string]: Artifact };
110+
111+
constructor(artifactMap: { [artifactId: string]: Artifact } = {}) {
110112
super();
113+
114+
this.#artifactMap = artifactMap;
111115
}
112116

113117
public async loadArtifact(contractName: string): Promise<Artifact> {
114-
return this._artifactMap[contractName];
118+
return this.#artifactMap[contractName];
115119
}
116120
}
117121

0 commit comments

Comments
 (0)