mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
Beefy on-demand justifications as a custom RequestResponse protocol (#12124)
* client/beefy: create communication module and move gossip there * client/beefy: move beefy_protocol_name module to communication * client/beefy: move notification module under communication * client/beefy: add incoming request_response protocol handler * client/beefy: keep track of connected peers and their progress * client/beefy: add logic for generating Justif requests * client/beefy: cancel outdated on-demand justification requests * try Andre's suggestion for JustificationEngine * justif engine add justifs validation * client/beefy: impl OnDemandJustificationsEngine async next() * move beefy proto name test * client/beefy: initialize OnDemandJustificationsEngine * client/tests: allow for custom req-resp protocols * client/beefy: on-demand-justif: implement simple peer selection strategy * client/beefy: fix voter initialization Fix corner case where voter gets a single burst of finality notifications just when it starts. The notification stream was consumed by "wait_for_pallet" logic, then main loop would subscribe to finality notifications, but by that time some notifications might've been lost. Fix this by subscribing the main loop to notifications before waiting for pallet to become available. Share the same stream with the main loop so that notifications for blocks before pallet available are ignored, while _all_ notifications after pallet available are processed. Add regression test for this. Signed-off-by: acatangiu <adrian@parity.io> * client/beefy: make sure justif requests are always out for mandatory blocks * client/beefy: add test for on-demand justifications sync * client/beefy: tweak main loop event processing order * client/beefy: run on-demand-justif-handler under same async task as voter * client/beefy: add test for known-peers * client/beefy: reorg request-response module * client/beefy: add issue references for future work todos * client/beefy: consolidate on-demand-justifications engine state machine Signed-off-by: acatangiu <adrian@parity.io> * client/beefy: fix for polkadot companion * client/beefy: implement review suggestions * cargo fmt and clippy * fix merge damage * fix rust-doc * fix merge damage * fix merge damage * client/beefy: add test for justif proto name Signed-off-by: acatangiu <adrian@parity.io>
This commit is contained in:
@@ -48,7 +48,7 @@ use sc_consensus::{
|
||||
Verifier,
|
||||
};
|
||||
use sc_network::{
|
||||
config::{NetworkConfiguration, Role, SyncMode},
|
||||
config::{NetworkConfiguration, RequestResponseConfig, Role, SyncMode},
|
||||
Multiaddr, NetworkService, NetworkWorker,
|
||||
};
|
||||
use sc_network_common::{
|
||||
@@ -688,6 +688,8 @@ pub struct FullPeerConfig {
|
||||
pub block_announce_validator: Option<Box<dyn BlockAnnounceValidator<Block> + Send + Sync>>,
|
||||
/// List of notification protocols that the network must support.
|
||||
pub notifications_protocols: Vec<ProtocolName>,
|
||||
/// List of request-response protocols that the network must support.
|
||||
pub request_response_protocols: Vec<RequestResponseConfig>,
|
||||
/// The indices of the peers the peer should be connected to.
|
||||
///
|
||||
/// If `None`, it will be connected to all other peers.
|
||||
@@ -790,6 +792,9 @@ where
|
||||
network_config.transport = TransportConfig::MemoryOnly;
|
||||
network_config.listen_addresses = vec![listen_addr.clone()];
|
||||
network_config.allow_non_globals_in_dht = true;
|
||||
network_config
|
||||
.request_response_protocols
|
||||
.extend(config.request_response_protocols);
|
||||
network_config.extra_sets = config
|
||||
.notifications_protocols
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user