From 0a01cead672e32a7c8d160821bdd19ab94239cb7 Mon Sep 17 00:00:00 2001 From: crypto-facs <84574577+crypto-facs@users.noreply.github.com> Date: Mon, 17 Jan 2022 13:08:02 -0500 Subject: [PATCH] server: add `api.enable` flag for Cosmos SDK API server (#908) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add api.enable flag for Cosmos SDK Rest server * update changelog Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> --- CHANGELOG.md | 1 + init.sh | 2 +- server/flags/flags.go | 6 +++++- server/start.go | 2 ++ tests/solidity/init-test-node.sh | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86fdfdd5..9910f0f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (ante) [tharsis#819](https://github.com/tharsis/ethermint/pull/819) remove redundant ante handlers * (app) [tharsis#873](https://github.com/tharsis/ethermint/pull/873) Validate code hash in GenesisAccount * (evm) [tharsis#901](https://github.com/tharsis/ethermint/pull/901) Support multiple MsgEthereumTx in single tx. +* (config) [tharsis#908](https://github.com/tharsis/ethermint/pull/908) Add api.enable flag for Cosmos SDK Rest server ### Bug Fixes diff --git a/init.sh b/init.sh index 5b80f348..de11d281 100755 --- a/init.sh +++ b/init.sh @@ -87,4 +87,4 @@ if [[ $1 == "pending" ]]; then fi # Start the node (remove the --pruning=nothing flag if historical queries are not needed) -ethermintd start --pruning=nothing --evm.tracer=json $TRACE --log_level $LOGLEVEL --minimum-gas-prices=0.0001aphoton --json-rpc.api eth,txpool,personal,net,debug,web3,miner +ethermintd start --pruning=nothing --evm.tracer=json $TRACE --log_level $LOGLEVEL --minimum-gas-prices=0.0001aphoton --json-rpc.api eth,txpool,personal,net,debug,web3,miner --api.enable diff --git a/server/flags/flags.go b/server/flags/flags.go index 9d797854..e213f5bb 100644 --- a/server/flags/flags.go +++ b/server/flags/flags.go @@ -24,6 +24,11 @@ const ( GRPCWebAddress = "grpc-web.address" ) +// RPCEnable Defines if Cosmos-sdk REST server should be enabled +const ( + RPCEnable = "api.enable" +) + // JSON-RPC flags const ( JSONRPCEnable = "json-rpc.enable" @@ -34,7 +39,6 @@ const ( JSONRPCEVMTimeout = "json-rpc.evm-timeout" JSONRPCTxFeeCap = "json-rpc.txfee-cap" JSONRPCFilterCap = "json-rpc.filter-cap" - JSONRPFeeHistoryCap = "json-rpc.feehistory-cap" JSONRPCLogsCap = "json-rpc.logs-cap" JSONRPCBlockRangeCap = "json-rpc.block-range-cap" ) diff --git a/server/start.go b/server/start.go index 4ccd936e..97f1d33a 100644 --- a/server/start.go +++ b/server/start.go @@ -149,6 +149,8 @@ which accepts a path for the resulting pprof file. cmd.Flags().Bool(srvflags.GRPCWebEnable, true, "Define if the gRPC-Web server should be enabled. (Note: gRPC must also be enabled.)") cmd.Flags().String(srvflags.GRPCWebAddress, serverconfig.DefaultGRPCWebAddress, "The gRPC-Web server address to listen on") + cmd.Flags().Bool(srvflags.RPCEnable, false, "Defines if Cosmos-sdk REST server should be enabled") + cmd.Flags().Bool(srvflags.JSONRPCEnable, true, "Define if the gRPC server should be enabled") cmd.Flags().StringSlice(srvflags.JSONRPCAPI, config.GetDefaultAPINamespaces(), "Defines a list of JSON-RPC namespaces that should be enabled") cmd.Flags().String(srvflags.JSONRPCAddress, config.DefaultJSONRPCAddress, "the JSON-RPC server address to listen on") diff --git a/tests/solidity/init-test-node.sh b/tests/solidity/init-test-node.sh index 7e1f7981..6f0cf15c 100755 --- a/tests/solidity/init-test-node.sh +++ b/tests/solidity/init-test-node.sh @@ -58,4 +58,4 @@ ethermintd collect-gentxs ethermintd validate-genesis # Start the node (remove the --pruning=nothing flag if historical queries are not needed) -ethermintd start --pruning=nothing --rpc.unsafe --keyring-backend test --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 +ethermintd start --pruning=nothing --rpc.unsafe --keyring-backend test --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable