Skip to content

Commit

Permalink
add a default ttl to the mempool config
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters committed Sep 26, 2023
1 parent 04fed82 commit 188d923
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 32 deletions.
3 changes: 2 additions & 1 deletion app/default_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 6 additions & 31 deletions cmd/celestia-appd/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"fmt"
"io"
"os"
"path/filepath"
Expand Down Expand Up @@ -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
}
Expand All @@ -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()
Expand Down

0 comments on commit 188d923

Please sign in to comment.