diff --git a/Dockerfile b/Dockerfile index 8008c6ec6..abed781a4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,4 +25,4 @@ RUN pip3 install --no-cache /wheels/* RUN rm -rf /wheels -ENTRYPOINT [ "starknet-devnet", "--host", "0.0.0.0", "--port", "5000" ] +ENTRYPOINT [ "starknet-devnet", "--host", "0.0.0.0", "--port", "5050" ] diff --git a/README.md b/README.md index c9b96618a..c7792eb95 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,8 @@ Run a local instance of Starknet Devnet optional arguments: -h, --help show this help message and exit -v, --version Print the version - --host HOST Specify the address to listen at; defaults to localhost (use the address the program outputs on start) - --port PORT, -p PORT Specify the port to listen at; defaults to 5000 + --host HOST Specify the address to listen at; defaults to 127.0.0.1 (use the address the program outputs on start) + --port PORT, -p PORT Specify the port to listen at; defaults to 5050 --load-path LOAD_PATH Specify the path from which the state is loaded on startup @@ -73,7 +73,7 @@ You can run `starknet-devnet` in a separate shell, or you can run it in backgrou Check that it's alive by running the following (address and port my vary if you specified a different one with `--host` or `--port`): ``` -curl http://localhost:5000/is_alive +curl http://127.0.0.1:5050/is_alive ``` ### Run with Docker @@ -91,19 +91,19 @@ Image tags correspond to Devnet versions as on PyPI and GitHub, with the `latest docker pull shardlabs/starknet-devnet ``` -The server inside the container listens to the port 5000, which you need to publish to a desired `` on your host machine: +The server inside the container listens to the port 5050, which you need to publish to a desired `` on your host machine: ```text -docker run -p [HOST:]:5000 shardlabs/starknet-devnet +docker run -p [HOST:]:5050 shardlabs/starknet-devnet ``` -E.g. if you want to use your host machine's `127.0.0.1:5000`, you need to run: +E.g. if you want to use your host machine's `127.0.0.1:5050`, you need to run: ```text -docker run -p 127.0.0.1:5000:5000 shardlabs/starknet-devnet +docker run -p 127.0.0.1:5050:5050 shardlabs/starknet-devnet ``` -You may ignore any address-related output logged on container startup (e.g. `Running on all addresses` or `Running on http://172.17.0.2:5000`). What you will use is what you specified with the `-p` argument. +You may ignore any address-related output logged on container startup (e.g. `Running on all addresses` or `Running on http://172.17.0.2:5050`). What you will use is what you specified with the `-p` argument. If you don't specify the `HOST` part, the server will indeed be available on all of your host machine's addresses (localhost, local network IP, etc.), which may present a security issue if you don't want anyone from the local network to access your Devnet instance. @@ -140,7 +140,7 @@ Postman is a Starknet utility that allows testing L1 <> L2 interactions. To util - Load a `StarknetMockMessaging` contract. The `address` parameter is optional; if provided, the `StarknetMockMessaging` contract will be fetched from that address, otherwise a new one will be deployed: - `POST /postman/load_l1_messaging_contract` - - body: `{ "networkUrl": "http://localhost:5005", "address": "0x83D76591560d9CD02CE16c060c92118d19F996b3" }` + - body: `{ "networkUrl": "http://localhost:8545", "address": "0x83D76591560d9CD02CE16c060c92118d19F996b3" }` - `networkUrl` - the URL of the L1 network you've run locally or that already exists; possibilities include, and are not limited to: - [Goerli testnet](https://goerli.net/) - [Ganache node](https://www.npmjs.com/package/ganache) @@ -204,13 +204,13 @@ This example: - Relies on [Docker bind mount](https://docs.docker.com/storage/bind-mounts/); try [Docker volume](https://docs.docker.com/storage/volumes/) instead. - Assumes that `/actual/dumpdir` exists. If unsure, use absolute paths. -- Assumes you are listening on `127.0.0.1:5000`. +- Assumes you are listening on `127.0.0.1:5050`. If there is `dump.pkl` inside `/actual/dumpdir`, you can load it with: ``` docker run \ - -p 127.0.0.1:5000:5000 \ + -p 127.0.0.1:5050:5050 \ --mount type=bind,source=/actual/dumpdir,target=/dumpdir \ shardlabs/starknet-devnet \ --load-path /dumpdir/dump.pkl @@ -220,7 +220,7 @@ To dump to `/actual/dumpdir/dump.pkl` on Devnet shutdown, run: ``` docker run \ - -p 127.0.0.1:5000:5000 \ + -p 127.0.0.1:5050:5050 \ --mount type=bind,source=/actual/dumpdir,target=/dumpdir \ shardlabs/starknet-devnet \ --dump-on exit --dump-path /dumpdir/dump.pkl @@ -253,7 +253,7 @@ starknet-devnet 2> /dev/null To enable printing with a dockerized version of Devnet set `PYTHONUNBUFFERED=1`: ``` -docker run -p 127.0.0.1:5000:5000 -e PYTHONUNBUFFERED=1 shardlabs/starknet-devnet +docker run -p 127.0.0.1:5050:5050 -e PYTHONUNBUFFERED=1 shardlabs/starknet-devnet ``` ## Development diff --git a/scripts/image_build_and_push.sh b/scripts/image_build_and_push.sh index 66e6e5e67..52144540c 100755 --- a/scripts/image_build_and_push.sh +++ b/scripts/image_build_and_push.sh @@ -15,15 +15,15 @@ docker build -t "$IMAGE:$LOCAL_VERSION_TAG" -t "$IMAGE:$LATEST_VERSION_TAG" . echo "Run a devnet instance in background; sleep to allow it to start" # can't use "localhost" because docker doesn't allow such mapping -docker run -d -p 127.0.0.1:5000:5000 --name devnet "$IMAGE:$LATEST_VERSION_TAG" +docker run -d -p 127.0.0.1:5050:5050 --name devnet "$IMAGE:$LATEST_VERSION_TAG" sleep 10 docker logs devnet echo "Checking if devnet instance is alive" if [ ! -z $REMOTE ]; then - ssh remote-docker curl localhost:5000/is_alive + ssh remote-docker curl localhost:5050/is_alive else - curl localhost:5000/is_alive + curl localhost:5050/is_alive fi # curling the url fails with 404 diff --git a/starknet_devnet/util.py b/starknet_devnet/util.py index 3d350684f..922cef561 100644 --- a/starknet_devnet/util.py +++ b/starknet_devnet/util.py @@ -84,8 +84,9 @@ def parse_dump_on(option: str): return DumpOn[option.upper()] sys.exit(f"Error: Invalid --dump-on option: {option}. Valid options: {DUMP_ON_OPTIONS_STRINGIFIED}") -DEFAULT_HOST = "localhost" -DEFAULT_PORT = 5000 +DEFAULT_HOST = "127.0.0.1" +DEFAULT_PORT = 5050 + def parse_args(): """ Parses CLI arguments. diff --git a/test/settings.ini b/test/settings.ini deleted file mode 100644 index 246464ca9..000000000 --- a/test/settings.ini +++ /dev/null @@ -1,5 +0,0 @@ -host=localhost -port=5000 - -GATEWAY_URL="http://$host:$port" -FEEDER_GATEWAY_URL="http://$host:$port" diff --git a/test/settings.py b/test/settings.py index 717e715f8..1cfc78c4c 100644 --- a/test/settings.py +++ b/test/settings.py @@ -1,7 +1,7 @@ """Constants used in test files.""" -HOST = "localhost" -PORT = "5000" +HOST = "127.0.0.1" +PORT = "5050" L1_HOST = "localhost" L1_PORT = "8545"