From 61ab10d6550a0e3dc31beae97f3193f968741aa1 Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Thu, 30 Aug 2018 14:41:58 -0700 Subject: [PATCH] config: reduce default mempool size (#2300) * config: reduce default mempool size This reduces the mempool size from 100k to 5k. Note that each secp256k1 sig takes .5ms to compute. Therefore an adversary could previously delay every node on the network's computation time upon receiving a block by 50 seconds. This now reduces that ability to being able to only delay each node by 2.5 seconds. This change should be reverted once ABCI recheck is implemented. * (squash this) fix test --- CHANGELOG_PENDING.md | 1 + config/config.go | 6 ++++-- consensus/mempool_test.go | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index 6f594f69..ade22d21 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -32,6 +32,7 @@ IMPROVEMENTS: - [mempool] Now stores txs by hash inside of the cache, to mitigate memory leakage - [config] Replace db_path with db_dir from automatically generated configuration files. Issue reported to Cosmos SDK ([#1712](https://github.com/cosmos/cosmos-sdk/issues/1712)) +- [config] Reduce default mempool size from 100k to 5k, until ABCI rechecking is implemented. BUG FIXES: - [mempool] No longer possible to fill up linked list without getting caching diff --git a/config/config.go b/config/config.go index 51683ef0..48793f0f 100644 --- a/config/config.go +++ b/config/config.go @@ -421,8 +421,10 @@ func DefaultMempoolConfig() *MempoolConfig { RecheckEmpty: true, Broadcast: true, WalPath: filepath.Join(defaultDataDir, "mempool.wal"), - Size: 100000, - CacheSize: 100000, + // Each signature verification takes .5ms, size reduced until we implement + // ABCI Recheck + Size: 5000, + CacheSize: 10000, } } diff --git a/consensus/mempool_test.go b/consensus/mempool_test.go index c905f50b..81d7693f 100644 --- a/consensus/mempool_test.go +++ b/consensus/mempool_test.go @@ -99,7 +99,7 @@ func TestMempoolTxConcurrentWithCommit(t *testing.T) { height, round := cs.Height, cs.Round newBlockCh := subscribe(cs.eventBus, types.EventQueryNewBlock) - NTxs := 10000 + NTxs := 3000 go deliverTxsRange(cs, 0, NTxs) startTestRound(cs, height, round)