sc-consensus-beefy: improve gossip logic (#1852)
- Remove cached messages used for deduplication in `GossipValidator` since they're already deduplicated in upper layer `NetworkGossip`. - Add cache for "justified rounds" to quickly discard any further (even if potentially different) justifications at the gossip level, once a valid one (for a respective round) is submitted to the worker. - Add short-circuit in worker `finalize()` method to not attempt to finalize same block multiple times (for example when we get justifications for same block from multiple components like block-import, gossip or on-demand). - Change a test which had A LOT of latency in syncing blocks for some weird reason and would only run after ~150seconds. It now runs instantly. Fixes https://github.com/paritytech/polkadot-sdk/issues/1728
Showing
- substrate/client/consensus/beefy/src/communication/gossip.rs 55 additions, 101 deletionssubstrate/client/consensus/beefy/src/communication/gossip.rs
- substrate/client/consensus/beefy/src/communication/mod.rs 1 addition, 1 deletionsubstrate/client/consensus/beefy/src/communication/mod.rs
- substrate/client/consensus/beefy/src/tests.rs 3 additions, 9 deletionssubstrate/client/consensus/beefy/src/tests.rs
- substrate/client/consensus/beefy/src/worker.rs 8 additions, 3 deletionssubstrate/client/consensus/beefy/src/worker.rs
Please register or sign in to comment