From 7fb4868dcbe153705b3dd4da97cf393e690febab Mon Sep 17 00:00:00 2001 From: Fridrik Asmundsson Date: Thu, 19 Dec 2024 20:21:43 +0000 Subject: [PATCH] hack: Prevent node from starting up with invalid timeout_commit of 0 Since newest cometbft defaults to timeout_commit of 0 we always default to that in our config.toml file as this code is generated by cosmossdk init function handler. To fix this properly I need to figure out how to pass in the config as context value to the cobra.command as a viper instance. Until then putting this error here as to preventing us forgetting to set it to the correct time_commit (which I assume will be 1sec) --- cli/commands/server/start.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cli/commands/server/start.go b/cli/commands/server/start.go index fb08d9e748..613f77e8d1 100644 --- a/cli/commands/server/start.go +++ b/cli/commands/server/start.go @@ -23,6 +23,7 @@ package server import ( "context" + "fmt" pruningtypes "cosmossdk.io/store/pruning/types" types "github.com/berachain/beacon-kit/cli/commands/server/types" @@ -106,6 +107,10 @@ custom: allow pruning options to be manually specified through 'pruning-keep-rec RunE: func(cmd *cobra.Command, _ []string) error { logger := clicontext.GetLoggerFromCmd[LoggerT](cmd) cfg := clicontext.GetConfigFromCmd(cmd) + if cfg.Consensus.TimeoutCommit == 0 { + return fmt.Errorf("please edit your config.toml file and set timeout_commit to 1s") + } + v := clicontext.GetViperFromCmd(cmd) _, err := GetPruningOptionsFromFlags(v) if err != nil {