Skip to content

Commit

Permalink
Perf: add an software override (1.5sec) for TimeoutPropose (backport
Browse files Browse the repository at this point in the history
…#1751) (#1804)

Co-authored-by: Teddy Ding <teddy@dydx.exchange>
  • Loading branch information
mergify[bot] and teddyding authored Jun 27, 2024
1 parent 085da35 commit e494cb4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion protocol/cmd/dydxprotocold/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package cmd

import (
"errors"
"fmt"
"io"
"os"
"path/filepath"
"time"

"cosmossdk.io/client/v2/autocli"
"cosmossdk.io/core/appmodule"
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit e494cb4

Please sign in to comment.