nile
nile copied to clipboard
BUG: nile node --host 0.0.0.0 creates incorrect node.json file
I'm using docker to run nile, therefore I'm binding the starknet-devnet node to 0.0.0.0 (all interfaces), in order to be able to access the server from my host (with Braavos in browser for example). The command:
nile node --host 0.0.0.0
The following snippet shows that in node.py, the "network" is being assigned as 0.0.0.0 instead of localhost
https://github.com/OpenZeppelin/nile/blob/bb37ca4cd8effd164bef05d200b38dd835235423/src/nile/core/node.py#L13-L22
and after that the node.json file is created with the following content:
{"0.0.0.0": "http://0.0.0.0:5050/"}
This results in a posterior error when deploying to the default network "localhost", because the gateway for starknet-devnet is set incorrectly, when trying to get the string from the node.json file (is expecting a "localhost" key that doesn't exists).
Solution
When host is 0.0.0.0 create the node.json file with the following content:
{"localhost": "http://127.0.0.1:5050/"}