Coder Social home page Coder Social logo

Change default port about starknet-devnet HOT 16 CLOSED

janek26 avatar janek26 commented on August 15, 2024
Change default port

from starknet-devnet.

Comments (16)

JorikSchellekens avatar JorikSchellekens commented on August 15, 2024 2

I've opened some prs for it which could wait until another breaking change comes along.
More importantly perhaps starknet-devnet should check the port is free and fail early, I can look into that later.

from starknet-devnet.

FabijanC avatar FabijanC commented on August 15, 2024

Can you use the --port option (as documented here)?
E.g.

starknet-devnet --port 5001

or

starknet-devnet -p 5001

Or is it just a matter of convenience?

from starknet-devnet.

janek26 avatar janek26 commented on August 15, 2024

I do use it personally.
But while integrating with ArgentX we also needed to set some default port for localhost we want the network to be on, and I just feel like 5000 is too often used (many devs use macOS). In that case the developer would need to spin up the local dev testate with the -p port option AND also change the port inside ArgentX. I think choosing a less frequently used port could resolve this

from starknet-devnet.

FabijanC avatar FabijanC commented on August 15, 2024

@janek26 I don't understand. Does your program run starknet-devnet in the background?

from starknet-devnet.

JorikSchellekens avatar JorikSchellekens commented on August 15, 2024

@FabijanC Macos has a system service called ControlCe that uses port 5000 but the devnet doesn't error out properly when it uses that port. I don't know how this works - it looks like it's running fine but only handles a subset of the requests. It would be nice if the default port wasn't one used by Macos and that it would fail gracefully in this condition. For now just moving the port would save a lot of frustration, it took me a while to realise what was going on.

from starknet-devnet.

FabijanC avatar FabijanC commented on August 15, 2024

@JorikSchellekens
I agree that this should be done. The fact is, this is the only breaking change in the project backlog, and I don't want to release v0.2.0 just to change the default port. So, it should either be argued why the port change is sufficient for a new major version, or suggest another breaking change 😃 .

from starknet-devnet.

JorikSchellekens avatar JorikSchellekens commented on August 15, 2024

@FabijanC
Considering that starknet-devnet doesn't work on a major os without any clear error messages as to why I'd say 0.1.0 is already broken.

from starknet-devnet.

FabijanC avatar FabijanC commented on August 15, 2024

@ccarnino You said you'd like to be pinged on MacOS issues, did you also experience this issue with an occupied port? I'm asking because I'm not sure if all mac users are experiencing this. E.g. the CI/CD pipeline starknet-hardhat-plugin includes some integration tests that run Devnet on a mac virtual machine, and it works fine with the default settings.

from starknet-devnet.

clacladev avatar clacladev commented on August 15, 2024

I personally have not experienced this problem, unless I was trying to run another devnet in another terminal by mistake.

@JorikSchellekens @janek26 what kind of issues or how do you realise that devnet is failing behind the scenes because of this issue?

from starknet-devnet.

JorikSchellekens avatar JorikSchellekens commented on August 15, 2024

@ccarnino this is a monterey specific issue
https://developer.apple.com/forums/thread/682332

from starknet-devnet.

JorikSchellekens avatar JorikSchellekens commented on August 15, 2024

None of the tests on https://github.com/Shard-Labs/starknet-hardhat-example would run. The following is the result of running the tests:

 yarn test                                                                                                                             [7d3h10m] ✖ ✹ ✭
yarn run v1.22.17
$ npx hardhat --network localhost test
Starknet plugin using dockerized environment (shardlabs/cairo-cli:0.7.1)
Using network devnet at http://localhost:5000


  Starknet
Started deployment
HardhatPluginError: Got ClientConnectorError
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 962, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 949, in create_connection
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 473, in sock_connect
    return await fut
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 503, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 5000)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/services/external_api/base_client.py", line 112, in _send_request
    method=send_method, url=url, data=data
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1138, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 536, in _request
    req, traces=traces, timeout=real_timeout
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1187, in _create_direct_connection
    client_error=client_error,
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:5000 ssl:default [Connect call failed ('127.0.0.1', 5000)]
Error: ClientConnectorError: Cannot connect to host localhost:5000 ssl:default [Connect call failed ('127.0.0.1', 5000)]

    at /Users/jorik/dev/nethermind/starknet-hardhat-example/node_modules/@shardlabs/starknet-hardhat-plugin/src/types.ts:110:15
    at Generator.next (<anonymous>)
    at fulfilled (/Users/jorik/dev/nethermind/starknet-hardhat-example/node_modules/@shardlabs/starknet-hardhat-plugin/dist/types.js:24:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Retrying transaction status check...
HardhatPluginError: Got ClientConnectorError
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 962, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.7/asyncio/base_events.py", line 949, in create_connection
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 473, in sock_connect
    return await fut
  File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 503, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 5000)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/services/external_api/base_client.py", line 112, in _send_request
    method=send_method, url=url, data=data
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 1138, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.7/site-packages/aiohttp/client.py", line 536, in _request
    req, traces=traces, timeout=real_timeout
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 1187, in _create_direct_connection
    client_error=client_error,
  File "/usr/local/lib/python3.7/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:5000 ssl:default [Connect call failed ('127.0.0.1', 5000)]
Error: ClientConnectorError: Cannot connect to host localhost:5000 ssl:default [Connect call failed ('127.0.0.1', 5000)]

    at /Users/jorik/dev/nethermind/starknet-hardhat-example/node_modules/@shardlabs/starknet-hardhat-plugin/src/types.ts:110:15
    at Generator.next (<anonymous>)
    at fulfilled (/Users/jorik/dev/nethermind/starknet-hardhat-example/node_modules/@shardlabs/starknet-hardhat-plugin/dist/types.js:24:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Retrying transaction status check...

Meanwhile the server reports a single successful post:

starknet-devnet                                                                                                                                [2h32m]
 * Running on http://localhost:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [10/Mar/2022 16:07:51] "POST /gateway/add_transaction HTTP/1.1" 200 -

from starknet-devnet.

clacladev avatar clacladev commented on August 15, 2024

I am on Monterey too. And I have the Airplay Receiver option On. I am running starknet-devnet from console, not from docker.

And no my test don't throw that error.

from starknet-devnet.

clacladev avatar clacladev commented on August 15, 2024

Try to use python 3.9. I had problems with 3.7

from starknet-devnet.

clacladev avatar clacladev commented on August 15, 2024

This is the guide I use to startup my dev environment https://github.com/ccarnino/starknet-hardhat-typescript-example

from starknet-devnet.

janek26 avatar janek26 commented on August 15, 2024

me and my colleagues at argent had this issue aswell.
thanks for pushing on it @JorikSchellekens

from starknet-devnet.

FabijanC avatar FabijanC commented on August 15, 2024

More importantly perhaps starknet-devnet should check the port is free and fail early, I can look into that later.

@JorikSchellekens Update us when you can, from what I've seen this should be fairly simple in Python with resources being a part of the standard library.

from starknet-devnet.

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.