From e494cb433659573d8491f89de99a8a45ff389eca Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:51:41 -0400 Subject: [PATCH] Perf: add an software override (1.5sec) for `TimeoutPropose` (backport #1751) (#1804) Co-authored-by: Teddy Ding --- protocol/cmd/dydxprotocold/cmd/root.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/protocol/cmd/dydxprotocold/cmd/root.go b/protocol/cmd/dydxprotocold/cmd/root.go index c4cae45379..6a2d71649b 100644 --- a/protocol/cmd/dydxprotocold/cmd/root.go +++ b/protocol/cmd/dydxprotocold/cmd/root.go @@ -2,9 +2,11 @@ package cmd import ( "errors" + "fmt" "io" "os" "path/filepath" + "time" "cosmossdk.io/client/v2/autocli" "cosmossdk.io/core/appmodule" @@ -55,6 +57,9 @@ const ( EnvPrefix = "DYDX" flagIAVLCacheSize = "iavl-cache-size" + + // TimeoutProposeOverride is the software override for the `timeout_propose` consensus parameter. + TimeoutProposeOverride = 1500 * time.Millisecond ) // NewRootCmd creates a new root command for `dydxprotocold`. It is called once in the main function. @@ -63,11 +68,18 @@ func NewRootCmd( option *RootCmdOption, homeDir string, ) *cobra.Command { + logger := log.NewLogger(os.Stdout) return NewRootCmdWithInterceptors( option, homeDir, func(serverCtxPtr *server.Context) { - + // Provide an override for `timeout_propose`. This value should be consistent across the network + // for synchrony, and should never be tweaked by individual validators in practice. + logger.Info(fmt.Sprintf( + "Overriding [consensus.timeout_propose] from %v to software constant: %v", + serverCtxPtr.Config.Consensus.TimeoutPropose, + TimeoutProposeOverride)) + serverCtxPtr.Config.Consensus.TimeoutPropose = TimeoutProposeOverride }, func(s string, appConfig *DydxAppConfig) (string, *DydxAppConfig) { return s, appConfig