Skip to content

Commit

Permalink
feat: increase default mempool TTLNumBlocks to 12 (#3961)
Browse files Browse the repository at this point in the history
Motivation in the **Mempool TTL duration** section of
#3959 (comment)

## Description

Modify the default consensus node config for mempools so that:

- TTLNumBlocks from 5 to 12 because 12 six second blocks = 72 seconds
which is comparable to the existing 75 second TTLDuration.
- ~~MaxTxBytes from approx 7.5 MiB to 8 MiB because it's easier to
understand and communicate~~
- ~~MaxTxsBytes from approx 37.6 MiB to 40 MiB because it's easier to
understand and communicate~~

## Testing

`make install && ./scripts/single-node.sh` then cat the config

```toml
version = "v1"
ttl-duration = "1m15s"
ttl-num-blocks = 12
```
  • Loading branch information
rootulp authored Oct 15, 2024
1 parent a742bd3 commit b1f43f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
15 changes: 4 additions & 11 deletions app/default_overrides.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
"github.com/celestiaorg/celestia-app/v3/x/mint"
minttypes "github.com/celestiaorg/celestia-app/v3/x/mint/types"
"github.com/celestiaorg/go-square/v2/share"
"github.com/cosmos/cosmos-sdk/codec"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -259,19 +258,13 @@ func DefaultEvidenceParams() tmproto.EvidenceParams {
func DefaultConsensusConfig() *tmcfg.Config {
cfg := tmcfg.DefaultConfig()
// Set broadcast timeout to be 50 seconds in order to avoid timeouts for long block times
// 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 = 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
// version. This acts as a first line of DoS protection
upperBoundBytes := appconsts.DefaultSquareSizeUpperBound * appconsts.DefaultSquareSizeUpperBound * share.ContinuationSparseShareContentSize
cfg.Mempool.MaxTxBytes = upperBoundBytes
cfg.Mempool.MaxTxsBytes = int64(upperBoundBytes) * cfg.Mempool.TTLNumBlocks
cfg.Mempool.TTLNumBlocks = 12
cfg.Mempool.TTLDuration = 75 * time.Second
cfg.Mempool.MaxTxBytes = 7_897_088
cfg.Mempool.MaxTxsBytes = 39_485_440
cfg.Mempool.Version = "v1" // prioritized mempool

cfg.Consensus.TimeoutPropose = appconsts.TimeoutPropose
Expand Down
4 changes: 2 additions & 2 deletions app/default_overrides_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ func TestDefaultConsensusConfig(t *testing.T) {
Size: tmcfg.DefaultMempoolConfig().Size,
WalPath: tmcfg.DefaultMempoolConfig().WalPath,

// overrides
// Overrides
MaxTxBytes: 7_897_088,
MaxTxsBytes: 39_485_440,
TTLDuration: 75 * time.Second,
TTLNumBlocks: 5,
TTLNumBlocks: 12,
Version: "v1",
}
assert.Equal(t, want, *got.Mempool)
Expand Down

0 comments on commit b1f43f5

Please sign in to comment.