Skip to content

Commit

Permalink
feat: add default time based TTL to mempool config (#2578)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters authored Sep 27, 2023
1 parent 2c18e01 commit 46c554c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 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
31 changes: 8 additions & 23 deletions cmd/celestia-appd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ func NewRootCmd() *cobra.Command {
return err
}

// Override the default tendermint config for celestia-app
tmCfg := app.DefaultConsensusConfig()
customAppTemplate, customAppConfig := initAppConfig()

err = server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, tmCfg)
// Override the default tendermint config and app config for celestia-app
var (
tmCfg = app.DefaultConsensusConfig()
appConfig = app.DefaultAppConfig()
appTemplate = serverconfig.DefaultConfigTemplate
)

err = server.InterceptConfigsPreRunHandler(cmd, appTemplate, appConfig, tmCfg)
if err != nil {
return err
}
Expand All @@ -108,24 +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 := app.DefaultAppConfig()

CelestiaAppCfg := CustomAppConfig{Config: *srvCfg}

CelestiaAppTemplate := serverconfig.DefaultConfigTemplate

return CelestiaAppTemplate, CelestiaAppCfg
}

// setDefaultConsensusParams sets the default consensus parameters for the
// embedded server context.
func setDefaultConsensusParams(command *cobra.Command) error {
Expand Down

0 comments on commit 46c554c

Please sign in to comment.