Coder Social home page Coder Social logo

Comments (7)

clacladev avatar clacladev commented on June 14, 2024 2

So no, that does not return anything.

Then I remembered that in the last macOS they enabled IPv6 by default (or something similar) so pointing to "localhost" does not work anymore for node. Pointing to "127.0.0.1" does. So `curl 127.0.0.1:5000/is_alive" works.

Therefore changing the hardhat.config.ts file to

devnet: {
  url: "http://127.0.0.1:5000/"
}

Solves the problem! If I run the tests now it finds the devnet correctly.

Maybe it's work update the example settings to help other fellow macOS devs.

Thanks for the assistance!

from starknet-hardhat-plugin.

FabijanC avatar FabijanC commented on June 14, 2024
  1. How are you running starknet-devnet?
  2. What's your node version? Have you tried using using different Node versions?

from starknet-hardhat-plugin.

clacladev avatar clacladev commented on June 14, 2024

I start the Devnet with the following command:

> starknet-devnet 
 * Running on http://localhost:5000/ (Press CTRL+C to quit)

I tried on node v17.3.1, v17.5.0 and v16.14.0.

Then on a second terminal:

❯ yarn hardhat test
yarn run v1.22.17
$ /Users/claudio/Dev/web3/starknet-hardhat-example-alt/node_modules/.bin/hardhat test
Starknet plugin using the active environment.


  Starknet
Started deployment
    1) should work for a fresh deployment


  0 passing (744ms)
  1 failing

  1) Starknet
       should work for a fresh deployment:
     HardhatPluginError: Could not deploy contract. Check the network url in config. Is it responsive?
      at StarknetContractFactory.<anonymous> (node_modules/@shardlabs/starknet-hardhat-plugin/src/types.ts:259:19)
      at Generator.next (<anonymous>)
      at fulfilled (node_modules/@shardlabs/starknet-hardhat-plugin/dist/types.js:24:58)



An unexpected error occurred:

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:135:10)
    at hash160 (/Users/claudio/Dev/web3/starknet-hardhat-example-alt/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js:249:21)
    at HDKey.set (/Users/claudio/Dev/web3/starknet-hardhat-example-alt/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js:50:24)
    at Function.HDKey.fromMasterSeed (/Users/claudio/Dev/web3/starknet-hardhat-example-alt/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js:194:20)
    at deriveKeyFromMnemonicAndPath (/Users/claudio/Dev/web3/starknet-hardhat-example-alt/node_modules/hardhat/src/internal/util/keys-derivation.ts:21:27)
    at derivePrivateKeys (/Users/claudio/Dev/web3/starknet-hardhat-example-alt/node_modules/hardhat/src/internal/core/providers/util.ts:29:52)
    at normalizeHardhatNetworkAccountsConfig (/Users/claudio/Dev/web3/starknet-hardhat-example-alt/node_modules/hardhat/src/internal/core/providers/util.ts:56:10)
    at createProvider (/Users/claudio/Dev/web3/starknet-hardhat-example-alt/node_modules/hardhat/src/internal/core/providers/construction.ts:78:59)
    at /Users/claudio/Dev/web3/starknet-hardhat-example-alt/node_modules/hardhat/src/internal/core/runtime-environment.ts:80:28 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

If I set the version of the devnet AND the second terminal to LTS (16.4.0) I get "less errors":

> yarn hardhat test
yarn run v1.22.17
$ /Users/claudio/Dev/web3/starknet-hardhat-example-alt/node_modules/.bin/hardhat test
Starknet plugin using the active environment.


  Starknet
Started deployment
    1) should work for a fresh deployment


  0 passing (730ms)
  1 failing

  1) Starknet
       should work for a fresh deployment:
     HardhatPluginError: Could not deploy contract. Check the network url in config. Is it responsive?
      at StarknetContractFactory.<anonymous> (node_modules/@shardlabs/starknet-hardhat-plugin/src/types.ts:259:19)
      at Generator.next (<anonymous>)
      at fulfilled (node_modules/@shardlabs/starknet-hardhat-plugin/dist/types.js:24:58)

If I stop the devnet in the first terminal and I run yarn hardhat test in the second terminal, I get the same output error.

from starknet-hardhat-plugin.

FabijanC avatar FabijanC commented on June 14, 2024

Have you tried combining older Node versions with running this in your terminal:

export NODE_OPTIONS=--openssl-legacy-provider

Or perhaps something else from these SO posts: post1, post2?

from starknet-hardhat-plugin.

clacladev avatar clacladev commented on June 14, 2024

If I only use the export you wrote on the terminal where then I launch the devnet, nothing changes when I run the tests.
If I also use it in the second terminal where I launch the tests I get the following error:

❯ yarn hardhat test                            
node: --openssl-legacy-provider is not allowed in NODE_OPTIONS

Checking the post you sent me, they are about solving the issue Error: error:0308010C:digital envelope routines::unsupported, which I was able to solve (described in my previous post) by setting the terminal to use Node 16, instead of 17.

But that does not solve the fact that the test command is not able to deploy the contracts, because it does not find the devnet.

I don't think this has anything to do with the issue, but I have an M1 MacBook Pro, not an Intel based.

from starknet-hardhat-plugin.

FabijanC avatar FabijanC commented on June 14, 2024

Can you make sure that devnet is reachable? With something like:

curl localhost:5000/is_alive

You should get a response saying Alive!!! if it is.

from starknet-hardhat-plugin.

FabijanC avatar FabijanC commented on June 14, 2024

Thanks for the feedback, will update the example settings.

from starknet-hardhat-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.