From c1c25b1818b520559fe0fb226516e807d3bcf651 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 20 Jan 2023 16:48:07 +0100 Subject: [PATCH] fix(rpc): bind default json-rpc listen address to localhost (backport #1613) (#1621) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(rpc): bind default json-rpc listen address to localhost (#1613) * update nix * bind default json-rpc to 127.0.0.1 * add change doc * Update CHANGELOG.md Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> (cherry picked from commit 3587015b27625bc6c0a002142db0a4dfdc9ecf59) # Conflicts: # CHANGELOG.md * address merge conflicts Co-authored-by: mmsqe Co-authored-by: MalteHerrmann --- CHANGELOG.md | 3 ++- go.mod | 1 - gomod2nix.toml | 20 +++++++++---------- scripts/contract-test.sh | 2 +- scripts/ethermint-devnet.yaml | 4 ++-- scripts/integration-test-all.sh | 2 +- scripts/start.sh | 2 +- server/config/config.go | 6 +++--- .../integration_tests/configs/default.jsonnet | 4 ++-- testutil/network/network.go | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e498c2a4e6..3ff16a0001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,7 +36,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog -## [v0.21.0-rc1] - 2022-1-13 +## [v0.21.0-rc2] - 2022-1-20 ### State Machine Breaking @@ -53,6 +53,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes * (rpc) [#1600](https://github.com/evmos/ethermint/pull/1600) Revert changes from `TypedEvents` +* (rpc) [#1613](https://github.com/evmos/ethermint/pull/1613) Change the default json-rpc listen address to localhost. * (proto) [#1586](https://github.com/evmos/ethermint/pull/1586) Avoid duplicate register proto type in `evm` & `feemarket` ## [v0.20.0] - 2022-12-28 diff --git a/go.mod b/go.mod index f45db540ee..f03d6b5dc8 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,6 @@ require ( github.com/tyler-smith/go-bip39 v1.1.0 golang.org/x/net v0.5.0 golang.org/x/text v0.6.0 - golang.org/x/text v0.6.0 google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 google.golang.org/grpc v1.52.0 sigs.k8s.io/yaml v1.3.0 diff --git a/gomod2nix.toml b/gomod2nix.toml index d54d7f90a2..21e2192e8d 100644 --- a/gomod2nix.toml +++ b/gomod2nix.toml @@ -358,8 +358,8 @@ schema = 3 version = "v0.0.5" hash = "sha256-/5i70IkH/qSW5KjGzv8aQNKh9tHoz98tqtL0K2DMFn4=" [mod."github.com/onsi/ginkgo/v2"] - version = "v2.6.1" - hash = "sha256-OEiWYKCGPCaqL3vzSrHquHGm+Q8URT2anpanAVK5hRo=" + version = "v2.7.0" + hash = "sha256-BKqQKCsPA73FaQwYpAY+QsWFHIncrG5jgRhC2IiNmCk=" [mod."github.com/onsi/gomega"] version = "v1.24.2" hash = "sha256-iascSzzBT1Uv/XybezSblIwwrq78BU4a9BVB5MvK6MM=" @@ -496,8 +496,8 @@ schema = 3 version = "v0.0.0-20220722155223-a9213eeb770e" hash = "sha256-kNgzydWRpjm0sZl4uXEs3LX5L0xjJtJRAFf/CTlYUN4=" [mod."golang.org/x/net"] - version = "v0.4.0" - hash = "sha256-7IwGZh/xg4mQz88cJio2Ov5d3jGRXKj1itlAja/EAbQ=" + version = "v0.5.0" + hash = "sha256-HpbIAiLs7S1+tVsaSSdbCPw1IK43A0bFFuSzPSyjLbo=" [mod."golang.org/x/oauth2"] version = "v0.0.0-20221014153046-6fdb5e3db783" hash = "sha256-IoygidVNqyAZmN+3macDeIefK8hhJToygpcqlwehdYQ=" @@ -505,14 +505,14 @@ schema = 3 version = "v0.1.0" hash = "sha256-Hygjq9euZ0qz6TvHYQwOZEjNiTbTh1nSLRAWZ6KFGR8=" [mod."golang.org/x/sys"] - version = "v0.3.0" - hash = "sha256-TIHhfYbZ99sCU1ZMikxwomXH5AEtD/lA1VMMW+UAhbU=" + version = "v0.4.0" + hash = "sha256-jchMzHCH5dg+IL/F+LqaX/fyAcB/nvHQpfBjqwaRJH0=" [mod."golang.org/x/term"] - version = "v0.3.0" - hash = "sha256-NKv2o8wz8DB/2W2h/muGEIHb+S06mBXZxhG254RpQ5s=" + version = "v0.4.0" + hash = "sha256-wQKxHV10TU4vCU8Re2/hFmAbur/jRWEOB8QXBzgTFNY=" [mod."golang.org/x/text"] - version = "v0.5.0" - hash = "sha256-ztH+xQyM/clOcQl+y/UEPcfNKbc3xApMbEPDDZ9up0o=" + version = "v0.6.0" + hash = "sha256-+bpeRWR3relKACdal6NPj+eP5dnWCplTViArSN7/qA4=" [mod."golang.org/x/xerrors"] version = "v0.0.0-20220907171357-04be3eba64a2" hash = "sha256-6+zueutgefIYmgXinOflz8qGDDDj0Zhv+2OkGhBTKno=" diff --git a/scripts/contract-test.sh b/scripts/contract-test.sh index 951a4c20a4..807d26f5bb 100755 --- a/scripts/contract-test.sh +++ b/scripts/contract-test.sh @@ -35,7 +35,7 @@ cat $HOME/.ethermint/config/genesis.json | jq '.app_state["mint"]["params"]["min "$PWD"/build/ethermintd validate-genesis # Start the node (remove the --pruning=nothing flag if historical queries are not needed) in background and log to file -"$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe --json-rpc.address="0.0.0.0:8545" --keyring-backend test > ethermintd.log 2>&1 & +"$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe --json-rpc.address="127.0.0.1:8545" --keyring-backend test > ethermintd.log 2>&1 & # Give ethermintd node enough time to launch sleep 5 diff --git a/scripts/ethermint-devnet.yaml b/scripts/ethermint-devnet.yaml index a6f7707611..5716821f05 100755 --- a/scripts/ethermint-devnet.yaml +++ b/scripts/ethermint-devnet.yaml @@ -7,8 +7,8 @@ ethermint_9000-1: index-events: - ethereum_tx.ethereumTxHash 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}" api: "eth,net,web3,debug" validators: - coins: 1000000000000000000stake,10000000000000000000000aphoton diff --git a/scripts/integration-test-all.sh b/scripts/integration-test-all.sh index 4436bad47a..fce8d73965 100755 --- a/scripts/integration-test-all.sh +++ b/scripts/integration-test-all.sh @@ -16,7 +16,7 @@ REMOVE_DATA_DIR=false RPC_PORT="854" # Ethereum JSONRPC Websocket WS_PORT="855" -IP_ADDR="0.0.0.0" +IP_ADDR="127.0.0.1" KEY="mykey" CHAINID="ethermint_9000-1" diff --git a/scripts/start.sh b/scripts/start.sh index c05bff709e..65c3e14bcc 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -11,7 +11,7 @@ TEST_QTD=1 #PORT AND RPC_PORT 3 initial digits, to be concat with a suffix later when node is initialized RPC_PORT="854" -IP_ADDR="0.0.0.0" +IP_ADDR="127.0.0.1" MODE="rpc" KEY="mykey" diff --git a/server/config/config.go b/server/config/config.go index 760bd9aaaa..8156527eef 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -35,13 +35,13 @@ const ( DefaultGRPCAddress = "0.0.0.0:9900" // DefaultJSONRPCAddress is the default address the JSON-RPC server binds to. - DefaultJSONRPCAddress = "0.0.0.0:8545" + DefaultJSONRPCAddress = "127.0.0.1:8545" // DefaultJSONRPCWsAddress is the default address the JSON-RPC WebSocket server binds to. - DefaultJSONRPCWsAddress = "0.0.0.0:8546" + DefaultJSONRPCWsAddress = "127.0.0.1:8546" // DefaultJsonRPCMetricsAddress is the default address the JSON-RPC Metrics server binds to. - DefaultJSONRPCMetricsAddress = "0.0.0.0:6065" + DefaultJSONRPCMetricsAddress = "127.0.0.1:6065" // DefaultEVMTracer is the default vm.Tracer type DefaultEVMTracer = "" diff --git a/tests/integration_tests/configs/default.jsonnet b/tests/integration_tests/configs/default.jsonnet index b181297d5b..b4674a47f1 100644 --- a/tests/integration_tests/configs/default.jsonnet +++ b/tests/integration_tests/configs/default.jsonnet @@ -13,8 +13,8 @@ 'minimum-gas-prices': '0aphoton', 'index-events': ['ethereum_tx.ethereumTxHash'], '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}', api: 'eth,net,web3,debug', 'feehistory-cap': 100, 'block-range-cap': 10000, diff --git a/testutil/network/network.go b/testutil/network/network.go index 781595c94c..495f50be04 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -332,7 +332,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) { if err != nil { return nil, err } - appCfg.JSONRPC.Address = fmt.Sprintf("0.0.0.0:%s", jsonRPCPort) + appCfg.JSONRPC.Address = fmt.Sprintf("127.0.0.1:%s", jsonRPCPort) } appCfg.JSONRPC.Enable = true appCfg.JSONRPC.API = config.GetAPINamespaces()