diff --git a/CHANGELOG.md b/CHANGELOG.md index b1c5815..18b39a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,10 +39,11 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking -- (fees) [\#691](https://github.com/tharsis/evmos/pull/691) Internal Api audit. +- (fees) [\#691](https://github.com/tharsis/evmos/pull/691) Internal API audit. ### Improvements +- (cmd) [\#696](https://github.com/tharsis/evmos/pull/696) Set a custom tendermint node configuration on initialization. - (fees) [\#685](https://github.com/tharsis/evmos/pull/685) Internal Specification audit. ## [v5.0.0] - 2022-06-14 diff --git a/cmd/evmosd/root.go b/cmd/evmosd/root.go index 7338d18..bb136e2 100644 --- a/cmd/evmosd/root.go +++ b/cmd/evmosd/root.go @@ -6,6 +6,7 @@ import ( "io" "os" "path/filepath" + "time" "github.com/cosmos/cosmos-sdk/simapp/params" "github.com/cosmos/cosmos-sdk/snapshots" @@ -13,6 +14,7 @@ import ( "github.com/spf13/cast" "github.com/spf13/cobra" + tmcfg "github.com/tendermint/tendermint/config" tmcli "github.com/tendermint/tendermint/libs/cli" "github.com/tendermint/tendermint/libs/log" dbm "github.com/tendermint/tm-db" @@ -91,9 +93,20 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { return err } + // override the app and tendermint configuration customAppTemplate, customAppConfig := initAppConfig() + customTMConfig := initTendermintConfig() - return sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig) + err = sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig) + if err != nil { + return err + } + + // TODO: remove the lines below once Cosmos SDK v0.46 is released + serverCtx := sdkserver.GetServerContextFromCmd(cmd) + serverCtx.Config = customTMConfig + + return sdkserver.SetCmdServerContext(cmd, serverCtx) }, } @@ -206,6 +219,15 @@ func initAppConfig() (string, interface{}) { return customAppTemplate, srvCfg } +// initTendermintConfig overrides the default Tendermint Config values. +// It sets the timeout commit default to "1s" in order to get ~2s block times +func initTendermintConfig() *tmcfg.Config { + cfg := tmcfg.DefaultConfig() + + cfg.Consensus.TimeoutCommit = time.Second + return cfg +} + type appCreator struct { encCfg params.EncodingConfig }