Skip to content

Commit

Permalink
test: mempool overrides (#2823)
Browse files Browse the repository at this point in the history
I wanted to see what value we use for `MaxTxsBytes`. Since it's computed
and not hard-coded, I wrote a test to see it and verify we don't
accidentally revert it.
  • Loading branch information
rootulp authored Nov 8, 2023
1 parent 7e9fb84 commit b02fe3a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions app/default_overrides_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
"github.com/stretchr/testify/assert"
tmcfg "github.com/tendermint/tendermint/config"
)

// Test_newGovModule verifies that the gov module's genesis state has defaults
Expand Down Expand Up @@ -63,3 +64,28 @@ func TestDefaultAppConfig(t *testing.T) {
assert.Equal(t, uint32(2), cfg.StateSync.SnapshotKeepRecent)
assert.Equal(t, "0.1utia", cfg.MinGasPrices)
}

func TestDefaultConsensusConfig(t *testing.T) {
got := DefaultConsensusConfig()

t.Run("mempool overrides", func(t *testing.T) {
want := tmcfg.MempoolConfig{
// defaults
Broadcast: tmcfg.DefaultMempoolConfig().Broadcast,
CacheSize: tmcfg.DefaultMempoolConfig().CacheSize,
KeepInvalidTxsInCache: tmcfg.DefaultMempoolConfig().KeepInvalidTxsInCache,
Recheck: tmcfg.DefaultMempoolConfig().Recheck,
RootDir: tmcfg.DefaultMempoolConfig().RootDir,
Size: tmcfg.DefaultMempoolConfig().Size,
WalPath: tmcfg.DefaultMempoolConfig().WalPath,

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

0 comments on commit b02fe3a

Please sign in to comment.