From 188d9238e72a1c5c2c11d85aa02e6a31a93796db Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Tue, 26 Sep 2023 15:04:44 +0200 Subject: [PATCH] add a default ttl to the mempool config --- app/default_overrides.go | 3 ++- cmd/celestia-appd/cmd/root.go | 37 ++++++----------------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/app/default_overrides.go b/app/default_overrides.go index 4b3fbdc884..dfc065e1c4 100644 --- a/app/default_overrides.go +++ b/app/default_overrides.go @@ -218,7 +218,8 @@ func DefaultConsensusConfig() *tmcfg.Config { // TODO: make TimeoutBroadcastTx configurable per https://github.com/celestiaorg/celestia-app/issues/1034 cfg.RPC.TimeoutBroadcastTxCommit = 50 * time.Second cfg.RPC.MaxBodyBytes = int64(8388608) // 8 MiB - cfg.Mempool.TTLNumBlocks = 10 + cfg.Mempool.TTLNumBlocks = 5 + cfg.Mempool.TTLDuration = time.Duration(cfg.Mempool.TTLNumBlocks) * appconsts.GoalBlockTime // Given that there is a stateful transaction size check in CheckTx, // We set a loose upper bound on what we expect the transaction to // be based on the upper bound size of the entire block for the given diff --git a/cmd/celestia-appd/cmd/root.go b/cmd/celestia-appd/cmd/root.go index d8fbd1231c..db1e19d458 100644 --- a/cmd/celestia-appd/cmd/root.go +++ b/cmd/celestia-appd/cmd/root.go @@ -1,7 +1,6 @@ package cmd import ( - "fmt" "io" "os" "path/filepath" @@ -82,10 +81,13 @@ func NewRootCmd() *cobra.Command { } // Override the default tendermint config for celestia-app - tmCfg := app.DefaultConsensusConfig() - customAppTemplate, customAppConfig := initAppConfig() + var ( + tmCfg = app.DefaultConsensusConfig() + appConfig = app.DefaultAppConfig() + appTemplate = serverconfig.DefaultConfigTemplate + ) - err = server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, tmCfg) + err = server.InterceptConfigsPreRunHandler(cmd, appTemplate, appConfig, tmCfg) if err != nil { return err } @@ -109,33 +111,6 @@ func NewRootCmd() *cobra.Command { return rootCmd } -// initAppConfig helps to override default appConfig template and configs. -// return "", nil if no custom configuration is required for the application. -func initAppConfig() (string, interface{}) { - type CustomAppConfig struct { - serverconfig.Config - } - - // Optionally allow the chain developer to overwrite the SDK's default - // server config. - srvCfg := serverconfig.DefaultConfig() - srvCfg.API.Enable = true - - // the default snapshot interval was determined by picking a large enough - // value as to not dramatically increase resource requirements while also - // being greater than zero so that there are more nodes that will serve - // snapshots to nodes that state sync - srvCfg.StateSync.SnapshotInterval = 1500 - srvCfg.StateSync.SnapshotKeepRecent = 2 - srvCfg.MinGasPrices = fmt.Sprintf("%v%s", appconsts.DefaultMinGasPrice, app.BondDenom) - - CelestiaAppCfg := CustomAppConfig{Config: *srvCfg} - - CelestiaAppTemplate := serverconfig.DefaultConfigTemplate - - return CelestiaAppTemplate, CelestiaAppCfg -} - func initRootCmd(rootCmd *cobra.Command, encodingConfig encoding.Config) { cfg := sdk.GetConfig() cfg.Seal()