Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "error:0308010C:digital envelope routines::unsupported" #388

Merged

Conversation

nazariyv
Copy link
Contributor

When I have cloned the repo, I proceeded to use node versions 18 and 17 to run tests. Which both failed due to the SSL breaking change in 17 & 18.

Solution is to use node version 16.

@Vectorized
Copy link
Collaborator

Vectorized commented Jul 25, 2022

I prefer adding this chunk of code to hardhat.config.js instead of enforcing the version to 16 in the package.json.

This is so that we can keep compatibility across node 14, 16, 17, 18.

Adapted from https://stackoverflow.com/a/72219174/3686594.

// The "ripemd160" algorithm is not available anymore in NodeJS 17+ (because of lib SSL 3).
// The following code replaces it with "sha256" instead.

const crypto = require('crypto');

try {
  crypto.createHash('ripemd160');
} catch (e) {
  const origCreateHash = crypto.createHash;
  crypto.createHash = (alg, opts) => {
    return origCreateHash(alg === 'ripemd160' ? 'sha256' : alg, opts);
  };
}

@Vectorized Vectorized requested a review from cygaar July 25, 2022 22:03
@Vectorized Vectorized changed the title Add node version in package.json Fix "error:0308010C:digital envelope routines::unsupported" Jul 25, 2022
@cygaar
Copy link
Collaborator

cygaar commented Jul 26, 2022

Can you add node 17 or 18 to the github action: https://github.com/chiru-labs/ERC721A/blob/main/.github/workflows/run_tests.yml#L21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants