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

change default listen address to 127.0.0.1 #96

Merged
merged 5 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [#93](https://github.com/crypto-com/pystarport/pull/93) add default gas prices for golang relayer
- [#94](https://github.com/crypto-com/pystarport/pull/94) allow custom broadcast mode when create node
- [#95](https://github.com/crypto-com/pystarport/pull/95) make golang relayer optional
- [#96](https://github.com/crypto-com/pystarport/pull/96) change default listen address to 127.0.0.1

*Feb 7, 2023*

Expand Down
77 changes: 44 additions & 33 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ python = "^3.8"
fire = "^0.4.0"
tomlkit = "^0.7.0"
jsonmerge = "^1.7.0"
PyYAML = "^5.3.1"
python-dateutil = "^2.8.1"
durations = "^0.3.3"
supervisor = "^4.2.1"
Expand All @@ -24,6 +23,7 @@ multitail2 = "^1.5.2"
python-dotenv = "^0.19.2"
pyyaml-include = "^1.3"
jsonnet = "^0.18.0"
pyyaml = "^6.0.1"

[tool.poetry.dev-dependencies]
pytest = "^6.2.5"
Expand Down
26 changes: 13 additions & 13 deletions pystarport/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def create_node(
self,
base_port=None,
moniker=None,
hostname="localhost",
hostname="127.0.0.1",
statesync=False,
mnemonic=None,
broadcastmode="sync"
Expand Down Expand Up @@ -684,7 +684,7 @@ def process_config(config, base_port):
if "base_port" not in val:
val["base_port"] = base_port + i * 10
if "hostname" not in val:
val["hostname"] = "localhost"
val["hostname"] = "127.0.0.1"


def init_devnet(
Expand Down Expand Up @@ -933,9 +933,9 @@ def relayer_chain_config_hermes(data_dir, chain, relayer_chains_config):
{
"key_name": "relayer",
"id": chain_id,
"rpc_addr": f"http://localhost:{rpc_port}",
"grpc_addr": f"http://localhost:{grpc_port}",
"websocket_addr": f"ws://localhost:{rpc_port}/websocket",
"rpc_addr": f"http://127.0.0.1:{rpc_port}",
"grpc_addr": f"http://127.0.0.1:{grpc_port}",
"websocket_addr": f"ws://127.0.0.1:{rpc_port}/websocket",
"rpc_timeout": "10s",
"account_prefix": chain.get("account-prefix", "cro"),
"store_prefix": "ibc",
Expand Down Expand Up @@ -966,7 +966,7 @@ def relayer_chain_config_rly(data_dir, chain, relayer_chains_config):
"key-directory": f"{folder}/node0",
"key": "relayer",
"chain-id": chain_id,
"rpc-addr": f"http://localhost:{rpc_port}",
"rpc-addr": f"http://127.0.0.1:{rpc_port}",
"account-prefix": chain.get("account-prefix", "cro"),
"keyring-backend": "test",
"gas-adjustment": chain_config.get("gas_multiplier", 1.2),
Expand Down Expand Up @@ -1181,17 +1181,17 @@ def edit_tm_cfg(path, base_port, peers, config, *, custom_edit=None):
# tendermint is start in process, not needed
# doc['proxy_app'] = 'tcp://127.0.0.1:%d' % abci_port(base_port)
rpc = doc["rpc"]
rpc["laddr"] = "tcp://0.0.0.0:%d" % ports.rpc_port(base_port)
rpc["pprof_laddr"] = rpc["pprof-laddr"] = "localhost:%d" % (
rpc["laddr"] = "tcp://127.0.0.1:%d" % ports.rpc_port(base_port)
rpc["pprof_laddr"] = rpc["pprof-laddr"] = "127.0.0.1:%d" % (
ports.pprof_port(base_port),
)
rpc["timeout_broadcast_tx_commit"] = rpc["timeout-broadcast-tx-commit"] = "30s"
rpc["grpc_laddr"] = rpc["grpc-laddr"] = "tcp://0.0.0.0:%d" % (
rpc["grpc_laddr"] = rpc["grpc-laddr"] = "tcp://127.0.0.1:%d" % (
ports.grpc_port_tx_only(base_port),
)
p2p = doc["p2p"]
# p2p["use-legacy"] = True
p2p["laddr"] = "tcp://0.0.0.0:%d" % ports.p2p_port(base_port)
p2p["laddr"] = "tcp://127.0.0.1:%d" % ports.p2p_port(base_port)
yihuang marked this conversation as resolved.
Show resolved Hide resolved
p2p["persistent_peers"] = p2p["persistent-peers"] = peers
p2p["addr_book_strict"] = p2p["addr-book-strict"] = False
p2p["allow_duplicate_ip"] = p2p["allow-duplicate-ip"] = True
Expand All @@ -1217,10 +1217,10 @@ def edit_app_cfg(path, base_port, app_config):
"enable": True,
"swagger": True,
"enable-unsafe-cors": True,
"address": "tcp://0.0.0.0:%d" % ports.api_port(base_port),
"address": "tcp://127.0.0.1:%d" % ports.api_port(base_port),
},
"grpc": {
"address": "0.0.0.0:%d" % ports.grpc_port(base_port),
"address": "127.0.0.1:%d" % ports.grpc_port(base_port),
},
"pruning": "nothing",
"state-sync": {
Expand All @@ -1240,7 +1240,7 @@ def edit_app_cfg(path, base_port, app_config):
with open(path) as f:
doc = tomlkit.parse(f.read())
doc["grpc-web"] = {}
doc["grpc-web"]["address"] = "0.0.0.0:%d" % ports.grpc_web_port(base_port)
doc["grpc-web"]["address"] = "127.0.0.1:%d" % ports.grpc_web_port(base_port)
patch_toml_doc(doc, jsonmerge.merge(default_patch, app_config))
open(path, "w").write(tomlkit.dumps(doc))

Expand Down
4 changes: 2 additions & 2 deletions pystarport/tests/test_expansion/base.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
'app-config': {
'minimum-gas-prices': '5000000000000basetcro',
'json-rpc': {
address: '0.0.0.0:{EVMRPC_PORT}',
'ws-address': '0.0.0.0:{EVMRPC_PORT_WS}',
address: '127.0.0.1:{EVMRPC_PORT}',
'ws-address': '127.0.0.1:{EVMRPC_PORT_WS}',
},
},
validators: [{
Expand Down
4 changes: 2 additions & 2 deletions pystarport/tests/test_expansion/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ cronos_777-1:
app-config:
minimum-gas-prices: 5000000000000basetcro
json-rpc:
address: "0.0.0.0:{EVMRPC_PORT}"
ws-address: "0.0.0.0:{EVMRPC_PORT_WS}"
address: "127.0.0.1:{EVMRPC_PORT}"
ws-address: "127.0.0.1:{EVMRPC_PORT_WS}"
validators:
- coins: 1000000000000000000stake,10000000000000000000000basetcro
staked: 1000000000000000000stake
Expand Down