From bf9179dbca2d3a1de82d236a8dc6b93e1b66e9e8 Mon Sep 17 00:00:00 2001 From: Rootul P Date: Wed, 25 Oct 2023 12:57:32 -0400 Subject: [PATCH] chore: disable API, GRPC, and GRPC web by default (#2761) Closes https://github.com/celestiaorg/celestia-app/issues/2758 ## Testing ``` ./scripts/single-node.sh cat ~/.celestia-app/config/app.toml ``` Verified that ```toml [api] # Enable defines if the API server should be enabled. enable = false ``` ```toml [grpc] # Enable defines if the gRPC server should be enabled. enable = false ``` ```toml [grpc-web] # GRPCWebEnable defines if the gRPC-web should be enabled. # NOTE: gRPC must also be enabled, otherwise, this configuration is a no-op. enable = false ``` (cherry picked from commit b786b081b18b8eca9af45bd453c71012bb941d3f) --- app/default_overrides.go | 4 +++- app/default_overrides_test.go | 12 ++++++++++++ scripts/single-node.sh | 4 +++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/default_overrides.go b/app/default_overrides.go index 81086ab4ec..6079c3fcfc 100644 --- a/app/default_overrides.go +++ b/app/default_overrides.go @@ -257,7 +257,9 @@ func DefaultConsensusConfig() *tmcfg.Config { func DefaultAppConfig() *serverconfig.Config { cfg := serverconfig.DefaultConfig() - cfg.API.Enable = true + cfg.API.Enable = false + cfg.GRPC.Enable = false + cfg.GRPCWeb.Enable = false // the default snapshot interval was determined by picking a large enough // value as to not dramatically increase resource requirements while also diff --git a/app/default_overrides_test.go b/app/default_overrides_test.go index 8987df18d5..944343f70e 100644 --- a/app/default_overrides_test.go +++ b/app/default_overrides_test.go @@ -51,3 +51,15 @@ func TestDefaultGenesis(t *testing.T) { assert.Equal(t, distributiontypes.DefaultParams().WithdrawAddrEnabled, distributionGenesisState.Params.WithdrawAddrEnabled) assert.Equal(t, distributiontypes.DefaultParams().CommunityTax, distributionGenesisState.Params.CommunityTax) } + +func TestDefaultAppConfig(t *testing.T) { + cfg := DefaultAppConfig() + + assert.False(t, cfg.API.Enable) + assert.False(t, cfg.GRPC.Enable) + assert.False(t, cfg.GRPCWeb.Enable) + + assert.Equal(t, uint64(1500), cfg.StateSync.SnapshotInterval) + assert.Equal(t, uint32(2), cfg.StateSync.SnapshotKeepRecent) + assert.Equal(t, "0.1utia", cfg.MinGasPrices) +} diff --git a/scripts/single-node.sh b/scripts/single-node.sh index d2ffbe40dd..eb7cfe27e0 100755 --- a/scripts/single-node.sh +++ b/scripts/single-node.sh @@ -91,4 +91,6 @@ sed -i'.bak' 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' "${CELESTIA_APP echo "Starting celestia-app..." celestia-appd start \ --home ${CELESTIA_APP_HOME} \ - --api.enable + --api.enable \ + --grpc.enable \ + --grpc-web.enable