From aef1ac7ba5d5f2d73cba706d2d23fafeeb73d8ef Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Wed, 23 Dec 2020 16:31:00 +0400 Subject: [PATCH] modify Reactor priorities (#5826) blockchain/vX reactor priority was decreased because during the normal operation (i.e. when the node is not fast syncing) blockchain priority can't be the same as consensus reactor priority. Otherwise, it's theoretically possible to slow down consensus by constantly requesting blocks from the node. NOTE: ideally blockchain/vX reactor priority would be dynamic. e.g. when the node is fast syncing, the priority is 10 (max), but when it's done fast syncing - the priority gets decreased to 5 (only to serve blocks for other nodes). But it's not possible now, therefore I decided to focus on the normal operation (priority = 5). evidence and consensus critical messages are more important than the mempool ones, hence priorities are bumped by 1 (from 5 to 6). statesync reactor priority was changed from 1 to 5 to be the same as blockchain/vX priority. Refs https://github.com/tendermint/tendermint/issues/5816 --- blockchain/v0/reactor.go | 2 +- blockchain/v2/reactor.go | 2 +- consensus/reactor.go | 4 ++-- evidence/reactor.go | 2 +- statesync/reactor.go | 2 +- test/maverick/consensus/reactor.go | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/blockchain/v0/reactor.go b/blockchain/v0/reactor.go index 77f112180..0184d926a 100644 --- a/blockchain/v0/reactor.go +++ b/blockchain/v0/reactor.go @@ -143,7 +143,7 @@ func (bcR *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor { return []*p2p.ChannelDescriptor{ { ID: BlockchainChannel, - Priority: 10, + Priority: 5, SendQueueCapacity: 1000, RecvBufferCapacity: 50 * 4096, RecvMessageCapacity: bc.MaxMsgSize, diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go index 7cd45080f..cc9671bd0 100644 --- a/blockchain/v2/reactor.go +++ b/blockchain/v2/reactor.go @@ -570,7 +570,7 @@ func (r *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor { return []*p2p.ChannelDescriptor{ { ID: BlockchainChannel, - Priority: 10, + Priority: 5, SendQueueCapacity: 2000, RecvBufferCapacity: 50 * 4096, RecvMessageCapacity: bc.MaxMsgSize, diff --git a/consensus/reactor.go b/consensus/reactor.go index 22ec379f4..b81b5eebb 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -142,7 +142,7 @@ func (conR *Reactor) GetChannels() []*p2p.ChannelDescriptor { return []*p2p.ChannelDescriptor{ { ID: StateChannel, - Priority: 5, + Priority: 6, SendQueueCapacity: 100, RecvMessageCapacity: maxMsgSize, }, @@ -156,7 +156,7 @@ func (conR *Reactor) GetChannels() []*p2p.ChannelDescriptor { }, { ID: VoteChannel, - Priority: 5, + Priority: 7, SendQueueCapacity: 100, RecvBufferCapacity: 100 * 100, RecvMessageCapacity: maxMsgSize, diff --git a/evidence/reactor.go b/evidence/reactor.go index 46d1ed5eb..dad07bf3f 100644 --- a/evidence/reactor.go +++ b/evidence/reactor.go @@ -53,7 +53,7 @@ func (evR *Reactor) GetChannels() []*p2p.ChannelDescriptor { return []*p2p.ChannelDescriptor{ { ID: EvidenceChannel, - Priority: 5, + Priority: 6, RecvMessageCapacity: maxMsgSize, }, } diff --git a/statesync/reactor.go b/statesync/reactor.go index b4dd0934c..0a7ca68ce 100644 --- a/statesync/reactor.go +++ b/statesync/reactor.go @@ -34,7 +34,7 @@ var ( MsgType: new(ssproto.Message), Descriptor: &p2p.ChannelDescriptor{ ID: byte(SnapshotChannel), - Priority: 3, + Priority: 5, SendQueueCapacity: 10, RecvMessageCapacity: snapshotMsgSize, }, diff --git a/test/maverick/consensus/reactor.go b/test/maverick/consensus/reactor.go index f4cf12c97..e623aebee 100644 --- a/test/maverick/consensus/reactor.go +++ b/test/maverick/consensus/reactor.go @@ -144,7 +144,7 @@ func (conR *Reactor) GetChannels() []*p2p.ChannelDescriptor { return []*p2p.ChannelDescriptor{ { ID: StateChannel, - Priority: 5, + Priority: 6, SendQueueCapacity: 100, RecvMessageCapacity: maxMsgSize, }, @@ -158,7 +158,7 @@ func (conR *Reactor) GetChannels() []*p2p.ChannelDescriptor { }, { ID: VoteChannel, - Priority: 5, + Priority: 7, SendQueueCapacity: 100, RecvBufferCapacity: 100 * 100, RecvMessageCapacity: maxMsgSize,