mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 01:41:03 +00:00
Reduce consensus spam (#1658)
* core: fix predicate for dropping grandpa round messages * core: grandpa: drop commits topic on authority set change * core: gossip: only drop known messages based on expiration time * core: grandpa: don't broadcast commit messages * core: gossip: don't assume topics are header hashes * core: gossip: expire messages more agressively * core: grandpa: fix test environment * core: gossip: fix tests * core: gossip: track dead topics (and ignore messages) * core: gossip: test dead topic pruning
This commit is contained in:
committed by
Robert Habermeier
parent
641bb7cb46
commit
4983f113e6
@@ -231,7 +231,10 @@ pub trait Network<Block: BlockT>: Clone {
|
||||
fn send_message(&self, round: u64, set_id: u64, message: Vec<u8>);
|
||||
|
||||
/// Clean up messages for a round.
|
||||
fn drop_messages(&self, round: u64, set_id: u64);
|
||||
fn drop_round_messages(&self, round: u64, set_id: u64);
|
||||
|
||||
/// Clean up messages for a given authority set id (e.g. commit messages).
|
||||
fn drop_set_messages(&self, set_id: u64);
|
||||
|
||||
/// Get a stream of commit messages for a specific set-id. This stream
|
||||
/// should never logically conclude.
|
||||
@@ -283,9 +286,14 @@ impl<B: BlockT, S: network::specialization::NetworkSpecialization<B>, H: ExHashT
|
||||
self.service.gossip_consensus_message(topic, message, false);
|
||||
}
|
||||
|
||||
fn drop_messages(&self, round: u64, set_id: u64) {
|
||||
fn drop_round_messages(&self, round: u64, set_id: u64) {
|
||||
let topic = message_topic::<B>(round, set_id);
|
||||
self.service.consensus_gossip().write().collect_garbage(|t| t == &topic);
|
||||
self.service.consensus_gossip().write().collect_garbage_for_topic(topic);
|
||||
}
|
||||
|
||||
fn drop_set_messages(&self, set_id: u64) {
|
||||
let topic = commit_topic::<B>(set_id);
|
||||
self.service.consensus_gossip().write().collect_garbage_for_topic(topic);
|
||||
}
|
||||
|
||||
fn commit_messages(&self, set_id: u64) -> Self::In {
|
||||
@@ -294,7 +302,7 @@ impl<B: BlockT, S: network::specialization::NetworkSpecialization<B>, H: ExHashT
|
||||
|
||||
fn send_commit(&self, _round: u64, set_id: u64, message: Vec<u8>) {
|
||||
let topic = commit_topic::<B>(set_id);
|
||||
self.service.gossip_consensus_message(topic, message, true);
|
||||
self.service.gossip_consensus_message(topic, message, false);
|
||||
}
|
||||
|
||||
fn announce(&self, round: u64, _set_id: u64, block: B::Hash) {
|
||||
|
||||
Reference in New Issue
Block a user