Skip to content

Commit 58a3ffe

Browse files
mmsqefedekunze
andauthored
fix(rpc): bind default json-rpc listen address to localhost (evmos#1613) (#224)
* 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>
1 parent bded3bd commit 58a3ffe

8 files changed

Lines changed: 12 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
4545
### Bug Fixes
4646

4747
* (rpc) [#1611](https://github.com/evmos/ethermint/pull/1611) Add missing next fee in fee history, fix wrong oldestBlock and align earliest input as ethereum.
48+
* (rpc) [#1613](https://github.com/evmos/ethermint/pull/1613) Change the default json-rpc listen address to localhost.
4849
* (rpc) [#1688](https://github.com/evmos/ethermint/pull/1688) Align filter rule for `debug_traceBlockByNumber`
4950

5051
### Improvements

scripts/contract-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cat $HOME/.ethermint/config/genesis.json | jq '.app_state["mint"]["params"]["min
3535
"$PWD"/build/ethermintd validate-genesis
3636

3737
# Start the node (remove the --pruning=nothing flag if historical queries are not needed) in background and log to file
38-
"$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe --json-rpc.address="0.0.0.0:8545" --keyring-backend test > ethermintd.log 2>&1 &
38+
"$PWD"/build/ethermintd start --pruning=nothing --rpc.unsafe --json-rpc.address="127.0.0.1:8545" --keyring-backend test > ethermintd.log 2>&1 &
3939

4040
# Give ethermintd node enough time to launch
4141
sleep 5

scripts/ethermint-devnet.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ ethermint_9000-1:
77
index-events:
88
- ethereum_tx.ethereumTxHash
99
json-rpc:
10-
address: "0.0.0.0:{EVMRPC_PORT}"
11-
ws-address: "0.0.0.0:{EVMRPC_PORT_WS}"
10+
address: "127.0.0.1:{EVMRPC_PORT}"
11+
ws-address: "127.0.0.1:{EVMRPC_PORT_WS}"
1212
api: "eth,net,web3,debug"
1313
validators:
1414
- coins: 1000000000000000000stake,10000000000000000000000aphoton

scripts/integration-test-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ REMOVE_DATA_DIR=false
1616
RPC_PORT="854"
1717
# Ethereum JSONRPC Websocket
1818
WS_PORT="855"
19-
IP_ADDR="0.0.0.0"
19+
IP_ADDR="127.0.0.1"
2020

2121
KEY="mykey"
2222
CHAINID="ethermint_9000-1"

scripts/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ TEST_QTD=1
1111

1212
#PORT AND RPC_PORT 3 initial digits, to be concat with a suffix later when node is initialized
1313
RPC_PORT="854"
14-
IP_ADDR="0.0.0.0"
14+
IP_ADDR="127.0.0.1"
1515
MODE="rpc"
1616

1717
KEY="mykey"

server/config/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ const (
2020
DefaultGRPCAddress = "0.0.0.0:9900"
2121

2222
// DefaultJSONRPCAddress is the default address the JSON-RPC server binds to.
23-
DefaultJSONRPCAddress = "0.0.0.0:8545"
23+
DefaultJSONRPCAddress = "127.0.0.1:8545"
2424

2525
// DefaultJSONRPCWsAddress is the default address the JSON-RPC WebSocket server binds to.
26-
DefaultJSONRPCWsAddress = "0.0.0.0:8546"
26+
DefaultJSONRPCWsAddress = "127.0.0.1:8546"
2727

2828
// DefaultJsonRPCMetricsAddress is the default address the JSON-RPC Metrics server binds to.
29-
DefaultJSONRPCMetricsAddress = "0.0.0.0:6065"
29+
DefaultJSONRPCMetricsAddress = "127.0.0.1:6065"
3030

3131
// DefaultEVMTracer is the default vm.Tracer type
3232
DefaultEVMTracer = ""

tests/integration_tests/configs/default.jsonnet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
'minimum-gas-prices': '0aphoton',
1414
'index-events': ['ethereum_tx.ethereumTxHash'],
1515
'json-rpc': {
16-
address: '0.0.0.0:{EVMRPC_PORT}',
17-
'ws-address': '0.0.0.0:{EVMRPC_PORT_WS}',
16+
address: '127.0.0.1:{EVMRPC_PORT}',
17+
'ws-address': '127.0.0.1:{EVMRPC_PORT_WS}',
1818
api: 'eth,net,web3,debug',
1919
'feehistory-cap': 100,
2020
'block-range-cap': 10000,

testutil/network/network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
317317
if err != nil {
318318
return nil, err
319319
}
320-
appCfg.JSONRPC.Address = fmt.Sprintf("0.0.0.0:%s", jsonRPCPort)
320+
appCfg.JSONRPC.Address = fmt.Sprintf("127.0.0.1:%s", jsonRPCPort)
321321
}
322322
appCfg.JSONRPC.Enable = true
323323
appCfg.JSONRPC.API = config.GetAPINamespaces()

0 commit comments

Comments
 (0)