From 2e70efc10af3793acddbd285d4c300e1e63b34e2 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 1 Jun 2023 12:04:57 +0000 Subject: [PATCH] fix: do not overwrite comet config when set in `InterceptConfigsPreRunHandler` (backport #16395) (#16399) Co-authored-by: Julien Robert --- CHANGELOG.md | 1 + server/util.go | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3cc44f06434..cfbe88faf27b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (server) [#16395](https://github.com/cosmos/cosmos-sdk/pull/16395) Do not override some Comet config is purposely set differently in `InterceptConfigsPreRunHandler`. * (cli) [#16312](https://github.com/cosmos/cosmos-sdk/pull/16312) Allow any addresses in `client.ValidatePromptAddress`. * (x/group) [#16017](https://github.com/cosmos/cosmos-sdk/pull/16017) Correctly apply account number in group v2 migration. diff --git a/server/util.go b/server/util.go index 9d105671d4b4..ea8d9ffc985a 100644 --- a/server/util.go +++ b/server/util.go @@ -233,12 +233,16 @@ func interceptConfigs(rootViper *viper.Viper, customAppTemplate string, customCo return nil, fmt.Errorf("error in config file: %w", err) } - conf.RPC.PprofListenAddress = "localhost:6060" - conf.P2P.RecvRate = 5120000 - conf.P2P.SendRate = 5120000 - conf.Consensus.TimeoutCommit = 5 * time.Second + defaultCometCfg := tmcfg.DefaultConfig() + // The SDK is opinionated about those comet values, so we set them here. + // We verify first that the user has not changed them for not overriding them. + if conf.Consensus.TimeoutCommit == defaultCometCfg.Consensus.TimeoutCommit { + conf.Consensus.TimeoutCommit = 5 * time.Second + } + if conf.RPC.PprofListenAddress == defaultCometCfg.RPC.PprofListenAddress { + conf.RPC.PprofListenAddress = "localhost:6060" + } tmcfg.WriteConfigFile(tmCfgFile, conf) - case err != nil: return nil, err