Skip to content

Commit 4535625

Browse files
committed
Add fix for node js SSL 3
1 parent 3eefe84 commit 4535625

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/run-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
strategy:
2020
matrix:
21-
node-version: [14.x]
21+
node-version: [14.x,16.x,17.x,18.x]
2222

2323
steps:
2424
- uses: actions/checkout@v2

hardhat.config.js

+14
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,17 @@ module.exports = {
3838
},
3939
plugins: ['solidity-coverage'],
4040
};
41+
42+
// The "ripemd160" algorithm is not available anymore in NodeJS 17+ (because of lib SSL 3).
43+
// The following code replaces it with "sha256" instead.
44+
45+
const crypto = require('crypto');
46+
47+
try {
48+
crypto.createHash('ripemd160');
49+
} catch (e) {
50+
const origCreateHash = crypto.createHash;
51+
crypto.createHash = (alg, opts) => {
52+
return origCreateHash(alg === 'ripemd160' ? 'sha256' : alg, opts);
53+
};
54+
}

0 commit comments

Comments
 (0)