Compare commits

...

6 Commits

Author SHA1 Message Date
M. J. Fromberger
9177206750 Prepare changelog for Release v0.35.8 (#8988) 2022-07-14 14:49:37 -07:00
mergify[bot]
0c6efd8c51 config: update config to reflect simple-priority queue (#9007) (#9008)
Update the queue documentation to reflect the types of queues and current default queue.

(cherry picked from commit c1c501ecd4)

Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
2022-07-14 17:13:41 -04:00
Sam Kleinman
f8d15fc682 blocksync: drop support for enabled=false (#8912) 2022-07-14 13:19:12 -04:00
William Banfield
7971514b55 p2p: configure max accepted for non-legacy as well (#8999)
* p2p: configure max connected for non-legacy as well

* remove explicit 0
2022-07-14 10:11:34 -04:00
M. J. Fromberger
b94470a6a4 mempool: ensure evicted transactions are removed from the cache (#9000)
In the original implementation transactions evicted for priority were also
removed from the cache. In addition, remove expired transactions from
the cache.

Related:

- Add Has method to cache implementations.
- Update tests to exercise this condition.
2022-07-14 06:51:54 -07:00
mergify[bot]
a1c8f8df0b doc: fix typos in quick-start.md. (#8990) (#8997) 2022-07-14 11:44:08 +02:00
15 changed files with 103 additions and 53 deletions

View File

@@ -2,6 +2,41 @@
Friendly reminder: We have a [bug bounty program](https://hackerone.com/cosmos).
## v0.35.8
July 12, 2022
Special thanks to external contributors on this release: @joeabbey
This release fixes an unbounded heap growth issue in the implementation of the
priority mempool, as well as some configuration, logging, and peer dialing
improvements in the non-legacy p2p stack. It also adds a new opt-in
"simple-priority" value for the `p2p.queue-type` setting, that should improve
gossip performance for non-legacy peer networks.
### BREAKING CHANGES
- CLI/RPC/Config
- [node] [\#8902](https://github.com/tendermint/tendermint/pull/8902) Always start blocksync and avoid misconfiguration (@tychoish)
### FEATURES
- [cli] [\#8675](https://github.com/tendermint/tendermint/pull/8675) Add command to force compact goleveldb databases (@cmwaters)
### IMPROVEMENTS
- [p2p] [\#8914](https://github.com/tendermint/tendermint/pull/8914) [\#8875](https://github.com/tendermint/tendermint/pull/8875) Improvements to peer dialing (backported). (@tychoish)
- [p2p] [\#8820](https://github.com/tendermint/tendermint/pull/8820) add eviction metrics and cleanup dialing error handling (backport #8819) (@tychoish)
- [logging] [\#8896](https://github.com/tendermint/tendermint/pull/8896) Do not pre-process log results (backport #8895). (@tychoish)
- [p2p] [\#8956](https://github.com/tendermint/tendermint/pull/8956) Simpler priority queue (backport #8929). (@tychoish)
### BUG FIXES
- [mempool] [\#8944](https://github.com/tendermint/tendermint/pull/8944) Fix unbounded heap growth in the priority mempool. (@creachadair)
- [p2p] [\#8869](https://github.com/tendermint/tendermint/pull/8869) Set empty timeouts to configed values. (backport #8847). (@williambanfield)
## v0.35.7
June 16, 2022

View File

@@ -2,7 +2,7 @@
Friendly reminder: We have a [bug bounty program](https://hackerone.com/cosmos).
## v0.35.8
## v0.35.9
Month DD, YYYY
@@ -22,10 +22,6 @@ Special thanks to external contributors on this release:
### FEATURES
- [cli] [\#8675] Add command to force compact goleveldb databases (@cmwaters)
### IMPROVEMENTS
### BUG FIXES
- [mempool] \#8944 Fix unbounded heap growth in the priority mempool. (@creachadair)

View File

@@ -34,9 +34,6 @@ func AddNodeFlags(cmd *cobra.Command) {
config.PrivValidator.ListenAddr,
"socket address to listen on for connections from external priv-validator process")
// node flags
cmd.Flags().Bool("blocksync.enable", config.BlockSync.Enable, "enable fast blockchain syncing")
// TODO (https://github.com/tendermint/tendermint/issues/6908): remove this check after the v0.35 release cycle
// This check was added to give users an upgrade prompt to use the new flag for syncing.
//

View File

@@ -762,7 +762,7 @@ type P2PConfig struct { //nolint: maligned
UseLegacy bool `mapstructure:"use-legacy"`
// Makes it possible to configure which queue backend the p2p
// layer uses. Options are: "fifo", "priority" and "wdrr",
// layer uses. Options are: "fifo", "simple-priority", "priority", and "wdrr",
// with the default being "priority".
QueueType string `mapstructure:"queue-type"`
}

View File

@@ -298,10 +298,11 @@ pprof-laddr = "{{ .RPC.PprofListenAddress }}"
#######################################################
[p2p]
# Enable the legacy p2p layer.
# Select the p2p internal queue.
# Options are: "fifo", "simple-priority", "priority", and "wdrr"
# with the default being "priority".
use-legacy = {{ .P2P.UseLegacy }}
# Select the p2p internal queue
queue-type = "{{ .P2P.QueueType }}"
# Address to listen for incoming connections

View File

@@ -106,10 +106,10 @@ Next, use the `tendermint testnet` command to create four directories of config
Before you can start the network, you'll need peers identifiers (IPs are not enough and can change). We'll refer to them as ID1, ID2, ID3, ID4.
```sh
tendermint show_node_id --home ./mytestnet/node0
tendermint show_node_id --home ./mytestnet/node1
tendermint show_node_id --home ./mytestnet/node2
tendermint show_node_id --home ./mytestnet/node3
tendermint show-node-id --home ./mytestnet/node0
tendermint show-node-id --home ./mytestnet/node1
tendermint show-node-id --home ./mytestnet/node2
tendermint show-node-id --home ./mytestnet/node3
```
Finally, from each machine, run:

View File

@@ -22,6 +22,10 @@ type TxCache interface {
// Remove removes the given raw transaction from the cache.
Remove(tx types.Tx)
// Has reports whether tx is present in the cache. Checking for presence is
// not treated as an access of the value.
Has(tx types.Tx) bool
}
var _ TxCache = (*LRUTxCache)(nil)
@@ -97,6 +101,14 @@ func (c *LRUTxCache) Remove(tx types.Tx) {
}
}
func (c *LRUTxCache) Has(tx types.Tx) bool {
c.mtx.Lock()
defer c.mtx.Unlock()
_, ok := c.cacheMap[tx.Key()]
return ok
}
// NopTxCache defines a no-op raw transaction cache.
type NopTxCache struct{}
@@ -105,3 +117,4 @@ var _ TxCache = (*NopTxCache)(nil)
func (NopTxCache) Reset() {}
func (NopTxCache) Push(types.Tx) bool { return true }
func (NopTxCache) Remove(types.Tx) {}
func (NopTxCache) Has(types.Tx) bool { return false }

View File

@@ -597,6 +597,7 @@ func (txmp *TxMempool) initialTxCallback(wtx *WrappedTx, res *abci.Response) {
"old_priority", w.priority,
)
txmp.removeTxByElement(vic)
txmp.cache.Remove(w.tx)
txmp.metrics.EvictedTxs.Add(1)
// We may not need to evict all the eligible transactions. Bail out
@@ -783,9 +784,11 @@ func (txmp *TxMempool) purgeExpiredTxs(blockHeight int64) {
w := cur.Value.(*WrappedTx)
if txmp.config.TTLNumBlocks > 0 && (blockHeight-w.height) > txmp.config.TTLNumBlocks {
txmp.removeTxByElement(cur)
txmp.cache.Remove(w.tx)
txmp.metrics.EvictedTxs.Add(1)
} else if txmp.config.TTLDuration > 0 && now.Sub(w.timestamp) > txmp.config.TTLDuration {
txmp.removeTxByElement(cur)
txmp.cache.Remove(w.tx)
txmp.metrics.EvictedTxs.Add(1)
}
cur = next

View File

@@ -209,7 +209,7 @@ func TestTxMempool_Size(t *testing.T) {
}
func TestTxMempool_Eviction(t *testing.T) {
txmp := setup(t, 0)
txmp := setup(t, 1000)
txmp.config.Size = 5
txmp.config.MaxTxsBytes = 60
txExists := func(spec string) bool {
@@ -238,6 +238,7 @@ func TestTxMempool_Eviction(t *testing.T) {
mustCheckTx(t, txmp, "key1=0000=25")
require.True(t, txExists("key1=0000=25"))
require.False(t, txExists(bigTx))
require.False(t, txmp.cache.Has([]byte(bigTx)))
require.Equal(t, int64(len("key1=0000=25")), txmp.SizeBytes())
// Now fill up the rest of the slots with other transactions.
@@ -521,10 +522,10 @@ func TestTxMempool_ConcurrentTxs(t *testing.T) {
}
func TestTxMempool_ExpiredTxs_Timestamp(t *testing.T) {
txmp := setup(t, 50)
txmp := setup(t, 5000)
txmp.config.TTLDuration = 5 * time.Millisecond
added1 := checkTxs(t, txmp, 25, 0)
added1 := checkTxs(t, txmp, 10, 0)
require.Equal(t, len(added1), txmp.Size())
// Wait a while, then add some more transactions that should not be expired
@@ -540,7 +541,7 @@ func TestTxMempool_ExpiredTxs_Timestamp(t *testing.T) {
// The exact intervals are not important except that the delta should be
// large relative to the cost of CheckTx (ms vs. ns is fine here).
time.Sleep(3 * time.Millisecond)
added2 := checkTxs(t, txmp, 25, 1)
added2 := checkTxs(t, txmp, 10, 1)
// Wait a while longer, so that the first batch will expire.
time.Sleep(3 * time.Millisecond)
@@ -555,6 +556,9 @@ func TestTxMempool_ExpiredTxs_Timestamp(t *testing.T) {
if _, ok := txmp.txByKey[tx.tx.Key()]; ok {
t.Errorf("Transaction %X should have been purged for TTL", tx.tx.Key())
}
if txmp.cache.Has(tx.tx) {
t.Errorf("Transaction %X should have been removed from the cache", tx.tx.Key())
}
}
// All the transactions added later should still be around.

View File

@@ -250,7 +250,7 @@ func makeNode(cfg *config.Config,
// Determine whether we should do block sync. This must happen after the handshake, since the
// app may modify the validator set, specifying ourself as the only validator.
blockSync := cfg.BlockSync.Enable && !onlyValidatorIsUs(state, pubKey)
blockSync := !onlyValidatorIsUs(state, pubKey)
logNodeStartupInfo(state, pubKey, logger, consensusLogger, cfg.Mode)
@@ -777,30 +777,25 @@ func (n *nodeImpl) OnStart() error {
n.consensusReactor.SetStateSyncingMetrics(0)
d := types.EventDataStateSyncStatus{Complete: true, Height: state.LastBlockHeight}
if err := n.eventBus.PublishEventStateSyncStatus(d); err != nil {
if err := n.eventBus.PublishEventStateSyncStatus(
types.EventDataStateSyncStatus{Complete: true, Height: state.LastBlockHeight},
); err != nil {
n.eventBus.Logger.Error("failed to emit the statesync start event", "err", err)
}
// TODO: Some form of orchestrator is needed here between the state
// advancing reactors to be able to control which one of the three
// is running
if n.config.BlockSync.Enable {
// FIXME Very ugly to have these metrics bleed through here.
n.consensusReactor.SetBlockSyncingMetrics(1)
if err := bcR.SwitchToBlockSync(state); err != nil {
n.Logger.Error("failed to switch to block sync", "err", err)
return
}
d := types.EventDataBlockSyncStatus{Complete: false, Height: state.LastBlockHeight}
if err := n.eventBus.PublishEventBlockSyncStatus(d); err != nil {
n.eventBus.Logger.Error("failed to emit the block sync starting event", "err", err)
}
} else {
n.consensusReactor.SwitchToConsensus(state, true)
// FIXME Very ugly to have these metrics bleed through here.
n.consensusReactor.SetBlockSyncingMetrics(1)
if err := bcR.SwitchToBlockSync(state); err != nil {
n.Logger.Error("failed to switch to block sync", "err", err)
return
}
if err := n.eventBus.PublishEventBlockSyncStatus(
types.EventDataBlockSyncStatus{Complete: false, Height: state.LastBlockHeight},
); err != nil {
n.eventBus.Logger.Error("failed to emit the block sync starting event", "err", err)
}
}()
}

View File

@@ -338,6 +338,10 @@ func createBlockchainReactor(
metrics *consensus.Metrics,
) (*p2p.ReactorShim, service.Service, error) {
if !cfg.BlockSync.Enable {
logger.Error("blocksync.enable = false, but Tendermint no longer allows blocksync to be disabled. This setting is now ignored and will be removed in the next version.")
}
logger = logger.With("module", "blockchain")
switch cfg.BlockSync.Version {
@@ -441,12 +445,21 @@ func createConsensusReactor(
}
func createTransport(logger log.Logger, cfg *config.Config) *p2p.MConnTransport {
var maxAccepted uint32
switch {
case cfg.P2P.MaxConnections > 0 && !cfg.P2P.UseLegacy:
maxAccepted = uint32(cfg.P2P.MaxConnections) +
uint32(len(tmstrings.SplitAndTrimEmpty(cfg.P2P.UnconditionalPeerIDs, ",", " ")))
case cfg.P2P.MaxNumInboundPeers > 0:
maxAccepted = uint32(cfg.P2P.MaxNumInboundPeers) +
uint32(len(tmstrings.SplitAndTrimEmpty(cfg.P2P.UnconditionalPeerIDs, ",", " ")))
}
return p2p.NewMConnTransport(
logger, p2p.MConnConfig(cfg.P2P), []*p2p.ChannelDescriptor{},
p2p.MConnTransportOptions{
MaxAcceptedConnections: uint32(cfg.P2P.MaxNumInboundPeers +
len(tmstrings.SplitAndTrimEmpty(cfg.P2P.UnconditionalPeerIDs, ",", " ")),
),
MaxAcceptedConnections: maxAccepted,
},
)
}

View File

@@ -47,8 +47,6 @@ var (
"tcp": 20,
"unix": 10,
}
// FIXME: v2 disabled due to flake
nodeBlockSyncs = uniformChoice{"v0"} // "v2"
nodeMempools = uniformChoice{"v0", "v1"}
nodeStateSyncs = weightedChoice{
e2e.StateSyncDisabled: 10,
@@ -397,7 +395,7 @@ func generateNode(
StartAt: startAt,
Database: nodeDatabases.Choose(r),
PrivvalProtocol: nodePrivvalProtocols.Choose(r),
BlockSync: nodeBlockSyncs.Choose(r).(string),
BlockSync: "v0",
Mempool: nodeMempools.Choose(r).(string),
StateSync: e2e.StateSyncDisabled,
PersistInterval: ptrUint64(uint64(nodePersistIntervals.Choose(r).(int))),

View File

@@ -43,7 +43,6 @@ persist_interval = 0
perturb = ["restart"]
privval_protocol = "tcp"
seeds = ["seed01"]
block_sync = "v0"
[node.validator03]
database = "badgerdb"
@@ -52,7 +51,6 @@ abci_protocol = "grpc"
persist_interval = 3
perturb = ["kill"]
privval_protocol = "grpc"
block_sync = "v0"
retain_blocks = 10
[node.validator04]
@@ -61,11 +59,9 @@ snapshot_interval = 5
database = "rocksdb"
persistent_peers = ["validator01"]
perturb = ["pause"]
block_sync = "v0"
[node.validator05]
database = "cleveldb"
block_sync = "v0"
state_sync = "p2p"
seeds = ["seed01"]
start_at = 1005 # Becomes part of the validator set at 1010
@@ -76,7 +72,6 @@ privval_protocol = "tcp"
[node.full01]
mode = "full"
start_at = 1010
block_sync = "v0"
persistent_peers = ["validator01", "validator02", "validator03", "validator04"]
perturb = ["restart"]
retain_blocks = 10

View File

@@ -178,7 +178,7 @@ func LoadTestnet(file string) (*Testnet, error) {
ABCIProtocol: Protocol(testnet.ABCIProtocol),
PrivvalProtocol: ProtocolFile,
StartAt: nodeManifest.StartAt,
BlockSync: nodeManifest.BlockSync,
BlockSync: "v0",
Mempool: nodeManifest.Mempool,
StateSync: nodeManifest.StateSync,
PersistInterval: 1,

View File

@@ -10,7 +10,7 @@ const (
// TMVersionDefault is the used as the fallback version of Tendermint Core
// when not using git describe. It is formatted with semantic versioning.
TMVersionDefault = "0.35.7"
TMVersionDefault = "0.35.8"
// ABCISemVer is the semantic version of the ABCI library
ABCISemVer = "0.17.0"